dark-capistrano-recipes 0.6.11 → 0.6.12.0

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/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- :patch: 11
2
+ :patch: 12
3
3
  :major: 0
4
- :build:
4
+ :build: 0
5
5
  :minor: 6
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dark-capistrano-recipes}
8
- s.version = "0.6.11"
8
+ s.version = "0.6.12.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Phil Misiowiec", "Leonardo Bighetti"]
12
- s.date = %q{2010-10-04}
12
+ s.date = %q{2010-10-07}
13
13
  s.description = %q{Extend the Capistrano gem with these useful recipes}
14
14
  s.email = %q{leonardobighetti@gmail.com}
15
15
  s.extra_rdoc_files = [
data/lib/helpers.rb CHANGED
@@ -21,11 +21,11 @@ def is_using_nginx
21
21
  end
22
22
 
23
23
  def is_using_passenger
24
- is_using('passenger',:server)
24
+ is_using('passenger',:app_server)
25
25
  end
26
26
 
27
27
  def is_using_unicorn
28
- is_using('unicorn',:server)
28
+ is_using('unicorn',:app_server)
29
29
  end
30
30
 
31
31
  def is_using_god
@@ -56,6 +56,14 @@ def parse_config(file)
56
56
  return ERB.new(template).result(binding) # parse it
57
57
  end
58
58
 
59
+
60
+ # Prompts the user for a message to agree/decline,
61
+ #
62
+ def ask(message, default=true)
63
+ Capistrano::CLI.ui.agree(message)
64
+
65
+ end
66
+
59
67
  # Generates a configuration file parsing through ERB
60
68
  # Fetches local file and uploads it to remote_file
61
69
  # Make sure your user has the right permissions.
@@ -6,9 +6,9 @@ Capistrano::Configuration.instance(:must_exist).load do
6
6
 
7
7
 
8
8
  # Server settings
9
- set :server, :unicorn unless exists?(:server)
10
- set :web_server, :nginx unless exists?(:web_server)
11
- set :runner, user unless exists?(:runner)
9
+ set :app_server, :unicorn unless exists?(:app_server)
10
+ set :web_server, :nginx unless exists?(:web_server)
11
+ set :runner, user unless exists?(:runner)
12
12
 
13
13
  # The port to listen to, normally we default to 80
14
14
  set :application_port, 80 unless exists?(:application_port)
@@ -11,7 +11,7 @@ Capistrano::Configuration.instance(:must_exist).load do
11
11
 
12
12
  # [internal] runs bundle install on the app server
13
13
  task :install, :roles => :app, :except => { :no_release => true } do
14
- run "cd #{current_path} && bundle install --deployment"
14
+ run "cd #{current_path} && bundle install --deployment --without=development test"
15
15
  end
16
16
  end
17
17
 
data/lib/recipes/god.rb CHANGED
@@ -14,7 +14,7 @@ Capistrano::Configuration.instance(:must_exist).load do
14
14
  end
15
15
 
16
16
  _cset(:bin_god) { defined?(:rvm_ruby_string) ? 'bootup_god' : 'god' }
17
- _cset(:server_name) { "#{application}-#{server}" }
17
+ _cset(:server_name) { "#{application}-#{app_server}" }
18
18
  _cset(:god_init_local) { "#{docs_path}/god/god.init" }
19
19
  _cset :god_init_temp, '/tmp/god.init'
20
20
  _cset :god_init_remote, '/etc/init.d/god'
@@ -72,10 +72,19 @@ Capistrano::Configuration.instance(:must_exist).load do
72
72
  puts "God is no more."
73
73
  end
74
74
 
75
- task :restart_unicorn, :roles => :app do
76
- sudo "#{bin_god} restart #{server_name}"
75
+ desc "Restarts everything"
76
+ namespace :restart do
77
+ task :default, :roles => :app, :except => { :no_release => true } do
78
+ sudo "#{bin_god} restart #{application}"
79
+ end
80
+
81
+ desc "Restarts the app server"
82
+ task :app, :roles => :app, :except => { :no_release => true } do
83
+ sudo "#{bin_god} restart #{server-name}"
84
+ end
77
85
  end
78
86
 
87
+ desc "Fetches the log for the whole group"
79
88
  task :log, :roles => :app do
80
89
  sudo "#{bin_god} log #{application}"
81
90
  end
@@ -111,6 +120,6 @@ Capistrano::Configuration.instance(:must_exist).load do
111
120
  end
112
121
  end
113
122
  after 'deploy:setup' do
114
- god.setup if is_using_god && Capistrano::CLI.ui.agree("Create app.god in app's shared path? [Yn]")
115
- end
123
+ god.setup if Capistrano::CLI.ui.agree("Create app.god in app's shared path? [Yn]")
124
+ end if is_using_god
116
125
  end
data/lib/recipes/nginx.rb CHANGED
@@ -48,7 +48,9 @@ Capistrano::Configuration.instance(:must_exist).load do
48
48
 
49
49
  end
50
50
 
51
- after 'deploy:setup', 'nginx:setup' if is_using_nginx && Capistrano::CLI.ui.agree("Create nginx configuration file? [Yn]")
51
+ after 'deploy:setup' do
52
+ nginx.setup if Capistrano::CLI.ui.agree("Create nginx configuration file? [Yn]")
53
+ end if is_using_nginx
52
54
 
53
55
  end
54
56
 
@@ -1,12 +1,15 @@
1
1
  Capistrano::Configuration.instance(:must_exist).load do
2
2
  # These are set to the same structure in shared <=> current
3
3
  set :normal_symlinks, %w(
4
+ tmp
5
+ log
4
6
  config/database.yml
5
7
  ) unless exists?(:normal_symlinks)
6
8
 
7
9
  # Weird symlinks go somewhere else. Weird.
8
10
  set :weird_symlinks, {
9
- 'bundle' => 'vendor/bundle'
11
+ 'bundle' => 'vendor/bundle',
12
+ 'pids' => 'tmp/pids'
10
13
  } unless exists?(:weird_symlinks)
11
14
 
12
15
  namespace :symlinks do
@@ -47,21 +47,19 @@ Capistrano::Configuration.instance(:must_exist).load do
47
47
  # Unicorn
48
48
  #------------------------------------------------------------------------------
49
49
  namespace :unicorn do
50
- desc "Start unicorn"
50
+ desc "Starts unicorn directly"
51
51
  task :start, :roles => :app do
52
52
  run unicorn_start_cmd
53
53
  end
54
54
 
55
- desc "Stop unicorn"
56
- task :stop, :roles => :app do
55
+ desc "Stops unicorn directly"
56
+ task :stop, :roles => :app do
57
57
  run unicorn_stop_cmd
58
58
  end
59
59
 
60
- desc "Restart unicorn"
61
- task :restart, :roles => :app do
62
- run unicorn_restart_cmd do |ch, stream, out|
63
-
64
- end
60
+ desc "Restarts unicorn directly"
61
+ task :restart, :roles => :app do
62
+ run unicorn_restart_cmd
65
63
  end
66
64
 
67
65
  desc <<-EOF
@@ -71,13 +69,19 @@ Capistrano::Configuration.instance(:must_exist).load do
71
69
  EOF
72
70
  task :setup, :roles => :app , :except => { :no_release => true } do
73
71
  # TODO: refactor this to a more generic setup task once we have more socket tasks.
74
- sudo "mkdir -p #{sockets_path}"
75
- sudo "chown #{user}:#{group} #{sockets_path} -R"
72
+ commands = []
73
+ commands << "mkdir -p #{sockets_path}"
74
+ commands << "chown #{user}:#{group} #{sockets_path} -R"
75
+ commands << "chmod +rw #{sockets_path}"
76
+
77
+ run commands.join(" && ")
76
78
  generate_config(unicorn_local_config,unicorn_remote_config)
77
79
  end
78
80
  end
79
81
 
80
- after 'deploy:setup', 'unicorn:setup' if is_using_unicorn && Capistrano::CLI.ui.agree("Create unicorn configuration file? [Yn]")
82
+ after 'deploy:setup' do
83
+ unicorn.setup if Capistrano::CLI.ui.agree("Create unicorn configuration file? [Yn]")
84
+ end if is_using_unicorn
81
85
 
82
86
  end
83
87
 
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dark-capistrano-recipes
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 79
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 11
10
- version: 0.6.11
9
+ - 12
10
+ - 0
11
+ version: 0.6.12.0
11
12
  platform: ruby
12
13
  authors:
13
14
  - Phil Misiowiec
@@ -16,7 +17,7 @@ autorequire:
16
17
  bindir: bin
17
18
  cert_chain: []
18
19
 
19
- date: 2010-10-04 00:00:00 -03:00
20
+ date: 2010-10-07 00:00:00 -03:00
20
21
  default_executable:
21
22
  dependencies:
22
23
  - !ruby/object:Gem::Dependency