Fixed a bunch of permissions errors. Making the entire blog group-writable by default
authorelliottcable <[email protected]>
Sun, 18 May 2008 00:04:59 +0000 (17 16:04 -0800)
committerelliottcable <[email protected]>
Sun, 18 May 2008 00:04:59 +0000 (17 16:04 -0800)
lib/git-blog.rb
prepped/.gitignore [changed mode: 0644->0755]
prepped/post-receive.hook [changed mode: 0755->0644]
prepped/posts/.gitignore [changed mode: 0644->0755]

index 8638a54..78ea4c9 100644 (file)
@@ -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 /^\</        then 'xhtml'
     when /^\%/        then 'haml'
@@ -143,7 +153,7 @@ task :deploy => :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})"
old mode 100644 (file)
new mode 100755 (executable)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100644 (file)
new mode 100755 (executable)