openminds_deploy 1.0.5.beta2 → 1.0.5.beta3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md ADDED
@@ -0,0 +1,105 @@
1
+ # Openminds Deploy Gem
2
+
3
+ This is a set of defaults for deploying to the Openminds shared hosting servers. These include our best practices for deployment, and should make a very clean Capfile.
4
+
5
+ ## Installation
6
+ These deploy recipes are all available in the openminds_deploy gem, which can be installed via rubygems:
7
+
8
+ gem install openminds_deploy
9
+
10
+ ## Available recipes
11
+ * openminds_deploy/defaults - Defaults for every deployment.
12
+ * openminds_deploy/git - for deploying with git.
13
+ * openminds_deploy/svn - for deploying with SVN.
14
+ * openminds_deploy/passenger - for deploying to a passenger account (zink, pro-004, pro-005, pro-006, pro-007)
15
+ * openminds_deploy/lighttpd - for deploying to a lighttpd account (zuurstof, kobalt, koper)
16
+ * openminds_deploy/rails3 - if you're deploying a Rails3 application. Takes care of Bundler
17
+
18
+ ## Example recipe
19
+
20
+ In this recipe we just set-up our user & application-name, the repository (git in this case) where our application can be found, the server we are deploying to, and require the necessary deployment files.
21
+
22
+ The block around it is a convenience rescue if someone would deploy with this Capfile that doesn't have this gem installed. The require's can be edited like you need.
23
+
24
+ load 'deploy' if respond_to?(:namespace) # cap2 differentiator
25
+
26
+ set :user, 'account_name'
27
+ set :application, 'my_application'
28
+
29
+ set :repository, 'git@server.openminds.be:git/my_application.git'
30
+
31
+ server 'server.openminds.be', :app, :web, :db, :primary => true
32
+
33
+ begin
34
+ require 'openminds_deploy/defaults'
35
+ require 'openminds_deploy/git'
36
+ require 'openminds_deploy/passenger'
37
+ require 'openminds_deploy/rails3'
38
+ rescue LoadError => e
39
+ $stderr.puts <<INSTALL
40
+ There was an exception while trying to deploy your application. Most likely you do not have the openminds_deploy gem installed.
41
+ You can install the gem like this:
42
+ gem install openminds_deploy
43
+ INSTALL
44
+ $stderr.puts "Exception thrown: #{e}"
45
+ exit 1
46
+ end
47
+
48
+ If you want to override some settings from the openminds_deploy recipes, define them after the openminds block.
49
+
50
+ ...
51
+ begin
52
+ require 'openminds_deploy/defaults'
53
+ rescue LoadError
54
+ $stderr.puts "Install the openminds_deploy gem"
55
+ exit 1
56
+ end
57
+
58
+ set :deploy_to, "/home/#{user}/apps/staging/#{application}"
59
+
60
+ ### Rails 3.1 with asset pipeline
61
+
62
+ If you deploy a Rails 3.1 application with the default settings, you need to precompile the assets upon deployment. If you are using capistrano >= 2.8.0 you can add the following line to your Capifile:
63
+
64
+ load 'deploy/assets'
65
+
66
+ If you are using an older version of capistrano, you should upgrade to a later version. If for some reason you can't do that, you can append these lines to your Capfile:
67
+
68
+ before "deploy:symlink", "deploy:assets"
69
+
70
+ namespace :deploy do
71
+ desc "Compile assets"
72
+ task :assets do
73
+ run "cd #{release_path}; RAILS_ENV=production bundle exec rake assets:precompile"
74
+ end
75
+ end
76
+
77
+ Also, the standard capistrano behavior will try to touch the
78
+ public/images, public/javascripts, public/stylesheets which will
79
+ cause warnings. Add this line to the Capfile or deploy.rb to
80
+ avoid that:
81
+
82
+ set :normalize_asset_timestamps, false
83
+
84
+ ## Recipes in detail
85
+ ### openminds_deploy/defaults
86
+ * sets up variables like `use_sudo` and `group_writable`
87
+ * enables SSH forwarding
88
+ * adds a task to link config/database.yml
89
+ * automatically checks if new migrations are available and asks you if you want to run them if there are
90
+
91
+ ### openminds_deploy/git
92
+ * sets up the SCM and enables git-submodules to be installed
93
+
94
+ ### openminds_deploy/svn
95
+ * sets up the SCM for svn and adds a password-prompt (don't keep your password in your SCM!)
96
+
97
+ ### openminds_deploy/passenger
98
+ * sets up all stop/start/restart tasks for Passenger
99
+
100
+ ### openminds_deploy/lighttpd
101
+ * sets up all stop/start/restart tasks for Lighttpd
102
+
103
+ ### openminds_deploy/rails3
104
+ * sets up bundling tasks with Bundler and does a basic check to see if the server you're on supports Rails 3.
105
+ * only precompiles assets if there are changes detected in your assets or Gemfile
@@ -33,9 +33,13 @@ configuration.load do
33
33
  desc 'Prompts if new migrations are available and runs them if you want to'
34
34
  namespace :deploy do
35
35
  task :needs_migrations, :roles => :db, :only => {:primary => true} do
36
- old_rev = capture("cd #{previous_release} && git log --pretty=format:'%H' -n 1 | cat").strip
37
- new_rev = capture("cd #{latest_release} && git log --pretty=format:'%H' -n 1 | cat").strip
38
- migrations_changed = capture("cd #{latest_release} && git diff #{old_rev} #{new_rev} --name-only | cat").include?('db/migrate')
36
+ migrations_changed = if previous_release.nil?
37
+ true # propably first deploy, so no migrations to compare
38
+ else
39
+ old_rev = capture("cd #{previous_release} && git log --pretty=format:'%H' -n 1 | cat").strip
40
+ new_rev = capture("cd #{latest_release} && git log --pretty=format:'%H' -n 1 | cat").strip
41
+ capture("cd #{latest_release} && git diff #{old_rev} #{new_rev} --name-only | cat").include?('db/migrate')
42
+ end
39
43
  if migrations_changed && Capistrano::CLI.ui.ask("New migrations pending. Enter 'yes' to run db:migrate") == 'yes'
40
44
  migrate
41
45
  end
@@ -45,6 +49,6 @@ configuration.load do
45
49
 
46
50
  desc 'Tail application log'
47
51
  task :tail_log, :roles => :app do
48
- sudo "tail -f #{shared_path}/log/#{rails_env}.log"
52
+ run "tail -f #{shared_path}/log/#{rails_env}.log"
49
53
  end
50
54
  end
@@ -24,14 +24,19 @@ configuration.load do
24
24
  namespace :deploy do
25
25
  namespace :assets do
26
26
  task :precompile, :roles => :web, :except => {:no_release => true} do
27
- old_rev = capture("cd #{previous_release} && git log --pretty=format:'%H' -n 1 | cat").strip
28
- new_rev = capture("cd #{latest_release} && git log --pretty=format:'%H' -n 1 | cat").strip
29
- assets_changed = capture("cd #{latest_release} && git diff #{old_rev} #{new_rev} --name-only | cat").include?('asset')
30
- gemfile_changed = capture("cd #{latest_release} && git diff #{old_rev} #{new_rev} --name-only | cat").include?('Gemfile.lock')
31
- if assets_changed || (gemfile_changed && Capistrano::CLI.ui.ask("Gemfile changed. Enter 'yes' to precomple assets?") == 'yes')
27
+ changed = if previous_release.nil?
28
+ # Propably first deploy, so precompile them anyway.
32
29
  run "cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile"
33
30
  else
34
- logger.info 'Skipping asset precompilation because there were no asset changes.'
31
+ old_rev = capture("cd #{previous_release} && git log --pretty=format:'%H' -n 1 | cat").strip
32
+ new_rev = capture("cd #{latest_release} && git log --pretty=format:'%H' -n 1 | cat").strip
33
+ assets_changed = capture("cd #{latest_release} && git diff #{old_rev} #{new_rev} --name-only | cat").include?('asset')
34
+ gemfile_changed = capture("cd #{latest_release} && git diff #{old_rev} #{new_rev} --name-only | cat").include?('Gemfile.lock')
35
+ if assets_changed || (gemfile_changed && Capistrano::CLI.ui.ask("Gemfile changed. Enter 'yes' to precomple assets?") == 'yes')
36
+ run "cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile"
37
+ else
38
+ logger.info 'Skipping asset precompilation because there were no asset changes.'
39
+ end
35
40
  end
36
41
  end
37
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openminds_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5.beta2
4
+ version: 1.0.5.beta3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-04-04 00:00:00.000000000 Z
15
+ date: 2012-04-19 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: capistrano
@@ -35,7 +35,7 @@ email: devel@openminds.be
35
35
  executables: []
36
36
  extensions: []
37
37
  extra_rdoc_files:
38
- - README.rdoc
38
+ - README.md
39
39
  files:
40
40
  - lib/openminds_deploy/defaults.rb
41
41
  - lib/openminds_deploy/git.rb
@@ -44,7 +44,7 @@ files:
44
44
  - lib/openminds_deploy/rails3.rb
45
45
  - lib/openminds_deploy/svn.rb
46
46
  - lib/openminds_deploy.rb
47
- - README.rdoc
47
+ - README.md
48
48
  homepage: http://www.openminds.be
49
49
  licenses: []
50
50
  post_install_message:
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
66
  version: 1.3.1
67
67
  requirements: []
68
68
  rubyforge_project:
69
- rubygems_version: 1.8.21
69
+ rubygems_version: 1.8.22
70
70
  signing_key:
71
71
  specification_version: 3
72
72
  summary: Common capistrano recipes for Openminds applications
data/README.rdoc DELETED
@@ -1,99 +0,0 @@
1
- = Openminds Deploy Gem
2
-
3
- This is a set of defaults for deploying to the Openminds shared hosting servers. These include our best practices for deployment, and should make a very clean Capfile.
4
-
5
- == Installation
6
- These deploy recipes are all available in the openminds_deploy gem, which can be installed via rubygems:
7
- gem install openminds_deploy
8
-
9
- == Available recipes
10
- * openminds_deploy/defaults - Defaults for every deployment.
11
- * openminds_deploy/git - for deploying with git.
12
- * openminds_deploy/svn - for deploying with SVN.
13
- * openminds_deploy/passenger - for deploying to a passenger account (zink, pro-004, pro-005, pro-006)
14
- * openminds_deploy/lighttpd - for deploying to a lighttpd account (zuurstof, kobalt, koper)
15
- * openminds_deploy/rails3 - if you're deploying a Rails3 application. Takes care of Bundler
16
-
17
- == Example recipe
18
-
19
- In this recipe we just set-up our user & application-name, the repository (git in this case) where our application can be found, the server we are deploying to, and require the necessary deployment files.
20
-
21
- The block around it is a convenience rescue if someone would deploy with this Capfile that doesn't have this gem installed. The require's can be edited like you need.
22
-
23
- load 'deploy' if respond_to?(:namespace) # cap2 differentiator
24
-
25
- set :user, 'account_name'
26
- set :application, 'my_application'
27
-
28
- set :repository, 'git@server.openminds.be:git/my_application.git'
29
-
30
- server 'server.openminds.be', :app, :web, :db, :primary => true
31
-
32
- begin
33
- require 'openminds_deploy/defaults'
34
- require 'openminds_deploy/git'
35
- require 'openminds_deploy/passenger'
36
- require 'openminds_deploy/rails3'
37
- rescue LoadError => e
38
- $stderr.puts <<INSTALL
39
- There was an exception while trying to deploy your application. Most likely you do not have the openminds_deploy gem installed.
40
- You can install the gem like this:
41
- gem install openminds_deploy
42
- INSTALL
43
- $stderr.puts "Exception thrown: #{e}"
44
- exit 1
45
- end
46
-
47
- If you want to override some settings from the openminds_deploy recipes, define them after the openminds block.
48
- ...
49
- begin
50
- require 'openminds_deploy/defaults'
51
- rescue LoadError
52
- $stderr.puts "Install the openminds_deploy gem"
53
- exit 1
54
- end
55
-
56
- set :deploy_to, "/home/#{user}/apps/staging/#{application}"
57
-
58
- === Rails 3.1 with asset pipeline
59
-
60
- If you deploy a Rails 3.1 application with the default settings, you need to precompile the assets upon deployment. If you are using capistrano >= 2.8.0 you can add the following line to your Capifile:
61
-
62
- load 'deploy/assets'
63
-
64
- If you are using an older version of capistrano, you should upgrade to a later version. If for some reason you can't do that, you can append these lines to your Capfile:
65
-
66
- before "deploy:symlink", "deploy:assets"
67
-
68
- namespace :deploy do
69
- desc "Compile assets"
70
- task :assets do
71
- run "cd #{release_path}; RAILS_ENV=production bundle exec rake assets:precompile"
72
- end
73
- end
74
-
75
- Also, the standard capistrano behavior will try to touch the
76
- public/images, public/javascripts, public/stylesheets which will
77
- cause warnings. Add this line to the Capfile or deploy.rb to
78
- avoid that:
79
-
80
- set :normalize_asset_timestamps, false
81
-
82
- == Recipes in detail
83
- === openminds_deploy/defaults
84
- This sets up variables like use_sudo and group_writable, enables SSH forwarding, and adds a task to link config/database.yml.
85
-
86
- === openminds_deploy/git
87
- This sets up the SCM and enables git-submodules to be installed.
88
-
89
- === openminds_deploy/svn
90
- This sets up the SCM for svn and adds a password-prompt (don't keep your password in your SCM!).
91
-
92
- === openminds_deploy/passenger
93
- This sets up all stop/start/restart tasks for Passenger.
94
-
95
- === openminds_deploy/lighttpd
96
- This sets up all stop/start/restart tasks for Lighttpd.
97
-
98
- === openminds_deploy/rails3
99
- This sets up bundling tasks with Bundler and does a basic check to see if the server you're on supports Rails 3.