Skip to content

permissions changed during generate #473

Closed
jimpriest opened this Issue Mar 10, 2012 · 3 comments

3 participants

@jimpriest

I've been working the last few days to get Octopress working on Windows and deploy to my off-site host.

I've got things working but have one weird issue and I'm not sure if it's something I'm doing wrong, a config issue I'm missing or something wacky with Windows.

So I add a post, then I do a 'rake generate'. Then I'd do 'rake deploy' and I'd get a lot of permission issues.

It took me awhile to figure out what was going on - but when I do 'rake generate' Octopress creates the /public/mysite/assets and /blog directories with no permissions. So when I try to deploy it fails.

drwxr-xr-x+ 1 Jim None    0 Mar  9 19:06 images
drwxr-xr-x+ 1 Jim None    0 Mar  9 19:06 stylesheets
drwxr-xr-x+ 1 Jim None    0 Mar  9 19:06 javascripts
drwxr-xr-x+ 1 Jim None    0 Mar  9 19:34 about
-rwxr-xr-x+ 1 Jim None  664 Mar  9 20:07 sitemap.xml
-rwxr-xr-x+ 1 Jim None  884 Mar  9 20:07 atom.xml
d---------+ 1 Jim None    0 Mar  9 20:07 blog
-rwxr-xr-x+ 1 Jim None 3957 Mar  9 20:07 index.html
d---------+ 1 Jim None    0 Mar  9 20:07 assets
-rwxr-xr-x+ 1 Jim None  400 Mar  9 20:07 favicon.png

I can do a simple chmod -755 -R mysite and then it will deploy fine.

But as soon as I run 'rake generate' again - it's reset.

I've tried running cygwin as an admin - no change.

Anyone have any ideas? Can I integrate the chmod command into the 'rake generate' (I'm new to Ruby)

@jimpriest

Totally lost and digging through Ruby docs :)

I tried to add something like this to the generate method

FileUtils.chmod_R(0755, public_dir)

It's not throwing an error but it's not changing the permissions either :\

@jimpriest

Not sure if this is the best way but it seems to work:

desc "Generate jekyll site"
task :generate do
  raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
  puts "## Generating Site with Jekyll..."
  system "compass compile --css-dir #{source_dir}/stylesheets"
  system "jekyll"
  puts "## Fixing permissions after rake generate"
  changePerm = `chmod 755 -R #{public_dir}`
  puts changePerm
end
@KenanY
KenanY commented Mar 15, 2012

Do you deploy with rsync? If so I discovered that there's a chmod argument for it. Example, for 755 I add this argument: --chmod=u+rwX,g+rwX,o+rX,o-w to the part of the Rakefile where it executes the rsync command.

@imathis imathis closed this Jun 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.