soprano 0.6 → 0.20
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 +10 -24
- data/lib/soprano/version.rb +1 -1
- data/recipes/daemon_strategy.rb +2 -5
- data/recipes/db.rb +0 -1
- data/recipes/defaults.rb +3 -0
- data/recipes/gems.rb +23 -0
- data/recipes/nginx.rb +1 -1
- data/recipes/whenever.rb +17 -0
- data/soprano.gemspec +0 -1
- metadata +60 -55
- data/.rvmrc +0 -1
- data/recipes/remote.rb +0 -43
- /data/recipes/{servers → daemon_strategies}/mongrel_cluster.rb +0 -0
- /data/recipes/{servers → daemon_strategies}/passenger.rb +0 -0
data/README.md
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# Soprano
|
2
2
|
|
3
|
-
[](http://www.imdb.com/title/tt0141842/)
|
4
|
-
|
5
3
|
Soprano is the set of Capistrano recipes that help me to deploy my
|
6
4
|
applications.
|
7
5
|
|
@@ -16,7 +14,7 @@ been borrowed from its sources.
|
|
16
14
|
|
17
15
|
For Rails 3 add to your `Gemfile`:
|
18
16
|
|
19
|
-
gem 'soprano', :require => false
|
17
|
+
gem 'soprano', :require => false, :version => '>= 0.1.0'
|
20
18
|
|
21
19
|
## Example usage
|
22
20
|
|
@@ -33,37 +31,25 @@ To start using Soprano you just need to add `require "soprano"` to your
|
|
33
31
|
|
34
32
|
## Features
|
35
33
|
|
36
|
-
###
|
37
|
-
|
38
|
-
*Sometimes* we need to execute an arbitrary command or script on our
|
39
|
-
server within the application. To aid with thin, Soprano offers a bunch
|
40
|
-
of `remote` scripts. For example:
|
41
|
-
|
42
|
-
cap remote:command -s cmd="ls -l" # You'll even get the output
|
34
|
+
### Whenever
|
43
35
|
|
44
|
-
|
45
|
-
runner does not put to the STDOUT anything.
|
36
|
+
Using [whenever](https://github.com/javan/whenever) is as easy as `set`ing `:whenever` to `true`. Just like this:
|
46
37
|
|
47
|
-
|
48
|
-
Yeah, this is not comfortable, but it's intentional. Consider it a
|
49
|
-
syntax vinegar. If you have a repeated task, write a Capistrano recipe
|
50
|
-
for it. This remote calls are for really occasional tasks.
|
38
|
+
set :whenever, true
|
51
39
|
|
52
|
-
|
40
|
+
Whenever will use your application deploy path as crontab identifier.
|
53
41
|
|
54
|
-
|
55
|
-
consider using [Cape](https://github.com/njonsson/cape).
|
42
|
+
You may wish to override the command, used to invoke whenever, e.g., to use Bundler:
|
56
43
|
|
57
|
-
|
44
|
+
set :whenever_command, 'bundle exec whenever'
|
58
45
|
|
59
|
-
|
46
|
+
Other features in process...
|
60
47
|
|
61
48
|
## Thanks
|
62
49
|
|
63
|
-
- Jamis Buck for [Capistrano](
|
50
|
+
- Jamis Buck for [Capistrano](http://github.com/jamis/capistrano),
|
64
51
|
- Rubaidh Ltd for their awesome
|
65
|
-
[Rubaidhstrano](http://github.com/rubaidh/rubaidhstrano)
|
66
|
-
- Denis Barushev for [Capone](https://github.com/denis/capone).
|
52
|
+
[Rubaidhstrano](http://github.com/rubaidh/rubaidhstrano).
|
67
53
|
|
68
54
|
## Copyright
|
69
55
|
|
data/lib/soprano/version.rb
CHANGED
data/recipes/daemon_strategy.rb
CHANGED
@@ -1,10 +1,7 @@
|
|
1
1
|
on :load do
|
2
|
-
strategy = fetch(:daemon_strategy)
|
2
|
+
strategy = fetch(:daemon_strategy, :mongrel_cluster)
|
3
3
|
|
4
4
|
if [:passenger, :mongrel_cluster].include? strategy
|
5
|
-
|
6
|
-
puts "Use require 'servers/#{strategy}' instead."
|
7
|
-
|
8
|
-
load File.join(File.dirname(__FILE__), "servers", "#{strategy}.rb")
|
5
|
+
load File.join(File.dirname(__FILE__), "daemon_strategies", "#{strategy}.rb")
|
9
6
|
end
|
10
7
|
end
|
data/recipes/db.rb
CHANGED
data/recipes/defaults.rb
CHANGED
@@ -19,6 +19,9 @@ ssh_options[:forward_agent] = true
|
|
19
19
|
|
20
20
|
# You can redefine these variables in your config/deploy.rb
|
21
21
|
|
22
|
+
# set :daemon_strategy, :mongrel_cluster
|
23
|
+
# set :web_server, :nginx
|
24
|
+
|
22
25
|
# set :install_gems, true
|
23
26
|
|
24
27
|
# set :backup_database_before_migrations, false
|
data/recipes/gems.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
namespace :soprano do
|
2
|
+
namespace :gems do
|
3
|
+
desc <<-DESC
|
4
|
+
Install gems needed by application.
|
5
|
+
DESC
|
6
|
+
task :install, :roles => :app do
|
7
|
+
run "rake gems:install -f #{release_path}/Rakefile RAILS_ENV=#{rails_env}"
|
8
|
+
end
|
9
|
+
|
10
|
+
desc <<-DESC
|
11
|
+
Update installed gems.
|
12
|
+
DESC
|
13
|
+
task :update, :roles => :app do
|
14
|
+
sudo "gem update --no-rdoc --no-ri"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
on :load do
|
20
|
+
if fetch(:install_gems, true)
|
21
|
+
after "deploy:update_code", "soprano:gems:install"
|
22
|
+
end
|
23
|
+
end
|
data/recipes/nginx.rb
CHANGED
@@ -26,7 +26,7 @@ namespace :soprano do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
on :load do
|
29
|
-
if fetch(:
|
29
|
+
if fetch(:web_server, :nginx) == :nginx
|
30
30
|
before "deploy:start", "soprano:nginx:enable_vhost"
|
31
31
|
after "deploy:stop", "soprano:nginx:disable_vhost"
|
32
32
|
after "deploy:restart", "soprano:nginx:reload_if_config_file_changed"
|
data/recipes/whenever.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
namespace :soprano do
|
2
|
+
namespace :whenever do
|
3
|
+
desc <<-DESC
|
4
|
+
Update the crontab file with whenever.
|
5
|
+
DESC
|
6
|
+
task :update_crontab, :roles => :db do
|
7
|
+
whenever_command = fetch(:whenever_command, "whenever")
|
8
|
+
run "cd #{release_path} && #{whenever_command} --set environment=#{rails_env} --update-crontab #{deploy_to}"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
on :load do
|
14
|
+
if fetch(:whenever, false)
|
15
|
+
after "deploy:symlink", "soprano:whenever:update_crontab"
|
16
|
+
end
|
17
|
+
end
|
data/soprano.gemspec
CHANGED
metadata
CHANGED
@@ -1,97 +1,102 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: soprano
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 35
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 20
|
9
|
+
version: "0.20"
|
6
10
|
platform: ruby
|
7
|
-
authors:
|
11
|
+
authors:
|
8
12
|
- Dmitriy Kiriyenko
|
9
13
|
autorequire:
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
16
|
+
|
17
|
+
date: 2011-07-01 00:00:00 +03:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: capistrano
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 2.5.0
|
22
|
-
type: :runtime
|
23
22
|
prerelease: false
|
24
|
-
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
24
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 27
|
29
|
+
segments:
|
30
|
+
- 2
|
31
|
+
- 5
|
32
|
+
- 0
|
29
33
|
version: 2.5.0
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
version: '0'
|
38
|
-
type: :development
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
46
|
-
description: ! "Soprano is the set of rake tasks and capistrano recipes.\n Use
|
47
|
-
it to avoid writing typical scenarios and maintaining them\n in
|
48
|
-
favour of configuring your builds and deploys declaratively."
|
49
|
-
email:
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
description: |-
|
37
|
+
Soprano is the set of rake tasks and capistrano recipes.
|
38
|
+
Use it to avoid writing typical scenarios and maintaining them
|
39
|
+
in favour of configuring your builds and deploys declaratively.
|
40
|
+
email:
|
50
41
|
- dmitriy.kiriyenko@gmail.com
|
51
42
|
executables: []
|
43
|
+
|
52
44
|
extensions: []
|
45
|
+
|
53
46
|
extra_rdoc_files: []
|
54
|
-
|
47
|
+
|
48
|
+
files:
|
55
49
|
- .gitignore
|
56
|
-
- .rvmrc
|
57
50
|
- Gemfile
|
58
51
|
- LICENSE
|
59
52
|
- README.md
|
60
53
|
- Rakefile
|
61
54
|
- lib/soprano.rb
|
62
55
|
- lib/soprano/version.rb
|
56
|
+
- recipes/daemon_strategies/mongrel_cluster.rb
|
57
|
+
- recipes/daemon_strategies/passenger.rb
|
63
58
|
- recipes/daemon_strategy.rb
|
64
59
|
- recipes/db.rb
|
65
60
|
- recipes/defaults.rb
|
66
61
|
- recipes/delayed_job.rb
|
62
|
+
- recipes/gems.rb
|
67
63
|
- recipes/nginx.rb
|
68
|
-
- recipes/remote.rb
|
69
64
|
- recipes/replicate.rb
|
70
|
-
- recipes/
|
71
|
-
- recipes/servers/passenger.rb
|
65
|
+
- recipes/whenever.rb
|
72
66
|
- soprano.gemspec
|
67
|
+
has_rdoc: true
|
73
68
|
homepage: https://github.com/dmitriy-kiriyenko/soprano
|
74
69
|
licenses: []
|
70
|
+
|
75
71
|
post_install_message:
|
76
72
|
rdoc_options: []
|
77
|
-
|
73
|
+
|
74
|
+
require_paths:
|
78
75
|
- lib
|
79
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
77
|
none: false
|
81
|
-
requirements:
|
82
|
-
- -
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
|
85
|
-
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
hash: 3
|
82
|
+
segments:
|
83
|
+
- 0
|
84
|
+
version: "0"
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
86
|
none: false
|
87
|
-
requirements:
|
88
|
-
- -
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
hash: 3
|
91
|
+
segments:
|
92
|
+
- 0
|
93
|
+
version: "0"
|
91
94
|
requirements: []
|
95
|
+
|
92
96
|
rubyforge_project:
|
93
|
-
rubygems_version: 1.
|
97
|
+
rubygems_version: 1.5.2
|
94
98
|
signing_key:
|
95
99
|
specification_version: 3
|
96
100
|
summary: Soprano is the set of rake tasks and capistrano recipes.
|
97
101
|
test_files: []
|
102
|
+
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm use 1.9.3@soprano --create
|
data/recipes/remote.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
namespace :remote do
|
2
|
-
def get_cmd
|
3
|
-
cmd = self[:cmd]
|
4
|
-
raise "A command must be given. Pleae, call the task with -s cmd=\"your command\"" unless cmd
|
5
|
-
cmd
|
6
|
-
end
|
7
|
-
|
8
|
-
def remote_call(command)
|
9
|
-
run wrap_command(command) do |channel, stream, data|
|
10
|
-
puts "#{data}"
|
11
|
-
break if stream == :err
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def wrap_command(command)
|
16
|
-
"cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec #{command}"
|
17
|
-
end
|
18
|
-
|
19
|
-
desc "execute an arbitrary command from application folder"
|
20
|
-
task "command", :roles => :app do
|
21
|
-
remote_call get_cmd
|
22
|
-
end
|
23
|
-
|
24
|
-
desc "execute an arbitrary rake task from application folder"
|
25
|
-
task "rake", :roles => :app do
|
26
|
-
remote_call "rake #{get_cmd}"
|
27
|
-
end
|
28
|
-
|
29
|
-
desc "execute an arbitrary thor script from application folder"
|
30
|
-
task "thor", :roles => :app do
|
31
|
-
remote_call "thor #{get_cmd}"
|
32
|
-
end
|
33
|
-
|
34
|
-
desc "execute an arbitrary ruby script in application environment"
|
35
|
-
task "runner", :roles => :app do
|
36
|
-
remote_call "script/rails runner \"#{get_cmd}\""
|
37
|
-
end
|
38
|
-
|
39
|
-
desc "tail the application log"
|
40
|
-
task :tail, :roles => :app do
|
41
|
-
remote_call("tail -n 10000 -f log/#{rails_env}.log")
|
42
|
-
end
|
43
|
-
end
|
File without changes
|
File without changes
|