diff --git a/attributes/default.rb b/attributes/default.rb index e2e9e17..b34c35a 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -26,6 +26,7 @@ default['jekyll']['domain_name'] = node['fqdn'] default['jekyll']['packages'] = [] +default['jekyll']['command'] = 'jekyll' default['jekyll']['options'] = [] default['jekyll']['gem']['source'] = 'https://rubygems.org/' @@ -33,3 +34,5 @@ default['jekyll']['rbenv']['activated'] = false default['jekyll']['rbenv']['version'] = '1.9.3-p194' + +default['jekyll']['apache']['enabled'] = false diff --git a/metadata.rb b/metadata.rb index ae85f50..5618e5a 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,11 +1,13 @@ +name 'jekyll' maintainer "Mike Adolphs" maintainer_email "mike@fooforge.com" license "Apache 2.0" description "Installs/Configures a Jekyll blog" long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "0.1.0" +version "0.1.10" depends "rbenv" # http://fnichol.github.com/chef-rbenv/ depends "apache2" supports "debian" +supports "centos" diff --git a/recipes/_deploy_blog.rb b/recipes/_deploy_blog.rb index 46d98ba..b75530f 100644 --- a/recipes/_deploy_blog.rb +++ b/recipes/_deploy_blog.rb @@ -1,34 +1,39 @@ +execute "jekyll-build" do + cwd node['jekyll']['deploy_directory'] + command "jekyll build" + action :nothing + only_if "test -f /var/chef/cache/jekyll_bootstrapped" +end + git node['jekyll']['deploy_directory'] do repository node['jekyll']['repository'] reference node['jekyll']['reference'] user node['jekyll']['user'] group node['jekyll']['group'] - action :sync + notifies :run, 'execute[jekyll-build]', :immediately end # Build command with options if defined for blog generation unless node['jekyll']['options'].empty? - options = node['jekyll']['options'].each { |opt| opt.prepend('--')} - options = options.join(' ') - jekyll_command = "jekyll #{options}" + options = node['jekyll']['options'].join(' ') + jekyll_command = "#{node['jekyll']['command']} #{options}" else - jekyll_command = "jekyll" + jekyll_command = "#{node['jekyll']['command']}" end unless node['jekyll']['rbenv']['activated'] execute 'Deploy Jekyll blog' do cwd node['jekyll']['deploy_directory'] - - command "bundle install && #{jekyll_command}" + command "bundle install && #{jekyll_command} && touch /var/chef/cache/jekyll_bootstrapped" action :run + not_if "test -f /var/chef/cache/jekyll_bootstrapped" end else rbenv_script 'Deploy Jekyll blog' do rbenv_version node['jekyll']['rbenv']['version'] root_path node['rbenv']['root_path'] cwd node['jekyll']['deploy_directory'] - code %{ bundle install && source /etc/profile.d/rbenv.sh && #{jekyll_command} } end end diff --git a/recipes/_setup_webserver.rb b/recipes/_setup_webserver.rb index afdbb09..7cde0ef 100644 --- a/recipes/_setup_webserver.rb +++ b/recipes/_setup_webserver.rb @@ -1,3 +1,5 @@ +return if node['jekyll']['apache']['enabled'] == false + domain_name = node['jekyll']['domain_name'] web_app "jekyll-#{domain_name}" do