soprano 0.3 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -23,4 +23,3 @@ Gemfile.lock
23
23
  pkg/*
24
24
 
25
25
  ## PROJECT::SPECIFIC
26
- .rvmrc
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use 1.9.3@soprano --create
data/README.md CHANGED
@@ -33,7 +33,30 @@ To start using Soprano you just need to add `require "soprano"` to your
33
33
 
34
34
  ## Features
35
35
 
36
- Readme about features in process...
36
+ ### Remote
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
43
+
44
+ Similar tasks exist for rake, thor and runner. Try `cap -T remote`. Note:
45
+ runner does not put to the STDOUT anything.
46
+
47
+ Don't forget to use `-s` option. Also wrap `cmd=` argument in quotes.
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.
51
+
52
+ You also have `cap remote:tail` to tail the application log.
53
+
54
+ If all you need is just remotely run the rake tasks, you may also want to
55
+ consider using [Cape](https://github.com/njonsson/cape).
56
+
57
+ ### Other
58
+
59
+ Readme about other features in process...
37
60
 
38
61
  ## Thanks
39
62
 
@@ -1,3 +1,3 @@
1
1
  module Capone
2
- VERSION = "0.3"
2
+ VERSION = "0.5"
3
3
  end
@@ -1,7 +1,10 @@
1
1
  on :load do
2
- strategy = fetch(:daemon_strategy, :passenger)
2
+ strategy = fetch(:daemon_strategy)
3
3
 
4
4
  if [:passenger, :mongrel_cluster].include? strategy
5
- load File.join(File.dirname(__FILE__), "daemon_strategies", "#{strategy}.rb")
5
+ puts "Providing strategy via set :daemon_strategy, #{strategy} is deprecated!"
6
+ puts "Use require 'servers/#{strategy}' instead."
7
+
8
+ load File.join(File.dirname(__FILE__), "servers", "#{strategy}.rb")
6
9
  end
7
10
  end
data/recipes/defaults.rb CHANGED
@@ -19,9 +19,6 @@ 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
-
25
22
  # set :install_gems, true
26
23
 
27
24
  # set :backup_database_before_migrations, false
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(:web_server, :nginx) == :nginx
29
+ if fetch(:link_vhost_from_app, false)
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/remote.rb ADDED
@@ -0,0 +1,43 @@
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
data/soprano.gemspec CHANGED
@@ -19,4 +19,5 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
  s.add_dependency "capistrano", ">= 2.5.0"
22
+ s.add_development_dependency "rake"
22
23
  end
metadata CHANGED
@@ -1,98 +1,97 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: soprano
3
- version: !ruby/object:Gem::Version
4
- hash: 13
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.5'
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- version: "0.3"
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Dmitriy Kiriyenko
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-11-04 00:00:00 Z
18
- dependencies:
19
- - !ruby/object:Gem::Dependency
12
+ date: 2012-03-31 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
20
15
  name: capistrano
21
- prerelease: false
22
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
23
17
  none: false
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- hash: 27
28
- segments:
29
- - 2
30
- - 5
31
- - 0
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
32
21
  version: 2.5.0
33
22
  type: :runtime
34
- version_requirements: *id001
35
- description: |-
36
- Soprano is the set of rake tasks and capistrano recipes.
37
- Use it to avoid writing typical scenarios and maintaining them
38
- in favour of configuring your builds and deploys declaratively.
39
- email:
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 2.5.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
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:
40
50
  - dmitriy.kiriyenko@gmail.com
41
51
  executables: []
42
-
43
52
  extensions: []
44
-
45
53
  extra_rdoc_files: []
46
-
47
- files:
54
+ files:
48
55
  - .gitignore
56
+ - .rvmrc
49
57
  - Gemfile
50
58
  - LICENSE
51
59
  - README.md
52
60
  - Rakefile
53
61
  - lib/soprano.rb
54
62
  - lib/soprano/version.rb
55
- - recipes/daemon_strategies/mongrel_cluster.rb
56
- - recipes/daemon_strategies/passenger.rb
57
63
  - recipes/daemon_strategy.rb
58
64
  - recipes/db.rb
59
65
  - recipes/defaults.rb
60
66
  - recipes/delayed_job.rb
61
67
  - recipes/nginx.rb
68
+ - recipes/remote.rb
62
69
  - recipes/replicate.rb
70
+ - recipes/servers/mongrel_cluster.rb
71
+ - recipes/servers/passenger.rb
63
72
  - soprano.gemspec
64
73
  homepage: https://github.com/dmitriy-kiriyenko/soprano
65
74
  licenses: []
66
-
67
75
  post_install_message:
68
76
  rdoc_options: []
69
-
70
- require_paths:
77
+ require_paths:
71
78
  - lib
72
- required_ruby_version: !ruby/object:Gem::Requirement
79
+ required_ruby_version: !ruby/object:Gem::Requirement
73
80
  none: false
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- hash: 3
78
- segments:
79
- - 0
80
- version: "0"
81
- required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
86
  none: false
83
- requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- hash: 3
87
- segments:
88
- - 0
89
- version: "0"
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
90
91
  requirements: []
91
-
92
92
  rubyforge_project:
93
- rubygems_version: 1.8.7
93
+ rubygems_version: 1.8.21
94
94
  signing_key:
95
95
  specification_version: 3
96
96
  summary: Soprano is the set of rake tasks and capistrano recipes.
97
97
  test_files: []
98
-