From 25c78395116606e01202077caed4c47811873e0a Mon Sep 17 00:00:00 2001 From: elliottcable Date: Sat, 17 May 2008 16:04:59 -0800 Subject: [PATCH] Fixed a bunch of permissions errors. Making the entire blog group-writable by default --- lib/git-blog.rb | 16 +++++++++++++--- prepped/.gitignore | 0 prepped/post-receive.hook | 0 prepped/posts/.gitignore | 0 4 files changed, 13 insertions(+), 3 deletions(-) mode change 100644 => 100755 prepped/.gitignore mode change 100755 => 100644 prepped/post-receive.hook mode change 100644 => 100755 prepped/posts/.gitignore diff --git a/lib/git-blog.rb b/lib/git-blog.rb index 8638a54..78ea4c9 100644 --- a/lib/git-blog.rb +++ b/lib/git-blog.rb @@ -23,6 +23,14 @@ task :initialize do cp GitBlog::Location / :prepped / :design / file, 'design' end + Dir['**/**'].each do |file| + if File.directory? file + chmod 0775, file + else + chmod 0664, file + end + end + blog.add blog.commit_all("A bird... no, a plane... no, a git-blog!") end @@ -52,6 +60,8 @@ task :servable do should_be_initialized File.expand_path('.') mv_f '.git' / :hooks / 'post-receive', '.git' / :hooks / 'post-receive.old' cp GitBlog::Location / :prepped / 'post-receive.hook', '.git' / :hooks / 'post-receive' + chmod 0775, '.git' / :hooks / 'post-receive' + puts '** git-blog is prepared for serving (git post-recieve hook prepared)' end desc 'Create and open for editing a new post' @@ -75,7 +85,7 @@ task :post do end unless @resume - File.open temporary_post, File::RDWR|File::TRUNC|File::CREAT do |post| + File.open temporary_post, File::RDWR|File::TRUNC|File::CREAT, 0664 do |post| post.puts 'Replace this text with your title!' post.puts '==================================' post.print "\n"; post.close @@ -84,7 +94,7 @@ task :post do system "#{ENV['VISUAL']} #{temporary_post}" - first_line = File.open(temporary_post, File::RDWR|File::CREAT).gets.chomp + first_line = File.open(temporary_post, File::RDONLY).gets.chomp markup = case first_line when /^\ :clobber do to_html(Object.new, {:content => parsed, :title => post_title}) destination = path.gsub /.#{markup}$/, '.xhtml' - file = File.open destination, File::RDWR|File::TRUNC|File::CREAT + file = File.open destination, File::RDWR|File::TRUNC|File::CREAT, 0664 file.puts completed file.close puts "#{path} -> #{destination} (as #{markup})" diff --git a/prepped/.gitignore b/prepped/.gitignore old mode 100644 new mode 100755 diff --git a/prepped/post-receive.hook b/prepped/post-receive.hook old mode 100755 new mode 100644 diff --git a/prepped/posts/.gitignore b/prepped/posts/.gitignore old mode 100644 new mode 100755 -- 2.11.4.GIT