soprano 0.30 → 0.40
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 +21 -1
- data/lib/soprano/version.rb +1 -1
- data/recipes/remote.rb +43 -0
- data/soprano.gemspec +1 -0
- metadata +22 -5
data/README.md
CHANGED
@@ -33,7 +33,27 @@ To start using Soprano you just need to add `require "soprano"` to your
|
|
33
33
|
|
34
34
|
## Features
|
35
35
|
|
36
|
-
|
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
|
+
### Other
|
55
|
+
|
56
|
+
Readme about other features in process...
|
37
57
|
|
38
58
|
## Thanks
|
39
59
|
|
data/lib/soprano/version.rb
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
|
data/soprano.gemspec
CHANGED
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soprano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 91
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 40
|
9
|
+
version: "0.40"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Dmitriy Kiriyenko
|
@@ -14,7 +14,8 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-11-
|
17
|
+
date: 2011-11-16 00:00:00 +02:00
|
18
|
+
default_executable:
|
18
19
|
dependencies:
|
19
20
|
- !ruby/object:Gem::Dependency
|
20
21
|
name: capistrano
|
@@ -32,6 +33,20 @@ dependencies:
|
|
32
33
|
version: 2.5.0
|
33
34
|
type: :runtime
|
34
35
|
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rake
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
version: "0"
|
48
|
+
type: :development
|
49
|
+
version_requirements: *id002
|
35
50
|
description: |-
|
36
51
|
Soprano is the set of rake tasks and capistrano recipes.
|
37
52
|
Use it to avoid writing typical scenarios and maintaining them
|
@@ -59,8 +74,10 @@ files:
|
|
59
74
|
- recipes/defaults.rb
|
60
75
|
- recipes/delayed_job.rb
|
61
76
|
- recipes/nginx.rb
|
77
|
+
- recipes/remote.rb
|
62
78
|
- recipes/replicate.rb
|
63
79
|
- soprano.gemspec
|
80
|
+
has_rdoc: true
|
64
81
|
homepage: https://github.com/dmitriy-kiriyenko/soprano
|
65
82
|
licenses: []
|
66
83
|
|
@@ -90,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
107
|
requirements: []
|
91
108
|
|
92
109
|
rubyforge_project:
|
93
|
-
rubygems_version: 1.
|
110
|
+
rubygems_version: 1.6.2
|
94
111
|
signing_key:
|
95
112
|
specification_version: 3
|
96
113
|
summary: Soprano is the set of rake tasks and capistrano recipes.
|