remoting 0.2.11 → 0.2.12

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Remoting
2
2
 
3
- *Remoting* is a great way to turn plain rake tasks in scripts to administer the server remote. It provides a little framework to run remote commands over SSH along with a DSL to define remote scripts.
3
+ *Remoting* is a great way to turn plain rake tasks in scripts to manage your production server remotely. It provides a little framework to run remote commands over SSH along with a DSL to define remote scripts. Interactive tasks that involves `sudo` are supported too.
4
4
 
5
5
  Install
6
6
 
@@ -16,15 +16,15 @@ Generate `remote.yml` stub
16
16
 
17
17
  Edit `config/remote.yml`
18
18
 
19
- ``` yml
20
- remote:
21
- any_setting_you_like: Here you can define properties that will be available in 'config' struct inside rake tasks!
22
- example: Below are some tipical configuration settings you may wish to define ...
23
- login: user@server
24
- dest: /var/ror/myapp
25
- repo: git@gitserver:myapp.git
26
- ruby: 1.9.3
27
- gemset: myapp
19
+ ``` yaml
20
+ remote:
21
+ any_setting_you_like: Here you can define properties that will be available in 'config' struct inside rake tasks!
22
+ example: Below are some tipical configuration settings you may wish to define ...
23
+ login: user@server
24
+ dest: /var/ror/myapp
25
+ repo: git@gitserver:myapp.git
26
+ ruby: 1.9.3
27
+ gemset: myapp
28
28
  ```
29
29
 
30
30
  ## Usage
@@ -34,16 +34,16 @@ Just require `remoting/task` inside your tasks. NOTE: you can also require it gl
34
34
  _ex._
35
35
 
36
36
  ``` rb
37
- desc "Restart the server"
38
- task :restart do
39
- require 'remoting/task'
37
+ desc "Restart the server"
38
+ task :restart do
39
+ require 'remoting/task'
40
40
 
41
- remote('restart', config.login) do
42
- mkdir '-p', config.dest.join('tmp')
43
- touch config.dest.join('tmp', 'restart.txt')
44
- end
41
+ remote('restart', config.login) do
42
+ mkdir '-p', config.dest.join('tmp')
43
+ touch config.dest.join('tmp', 'restart.txt')
44
+ end
45
45
 
46
- end
46
+ end
47
47
  ```
48
48
 
49
49
  Methods invoked inside the `remote` block are executed inside a ssh session. `remote` takes two arguments: `name` and `login`. `name` serves only for logging purposal while `login` is the login string to access the server supplied in the form of `user@host`
@@ -53,15 +53,15 @@ Methods invoked inside the `remote` block are executed inside a ssh session. `re
53
53
  By examples
54
54
 
55
55
  ``` rb
56
- remote("my task", config.login) do
56
+ remote("my task", config.login) do
57
57
 
58
- ps("aux") | grep("mysql")
59
- echo 'noise' > "/dev/null"
60
- echo 'setting=value' >> "settings.conf"
61
- tail -100 config.dir.join('log', 'logfile.log')
62
- command("[[ -f \"path\" ]] && run_a_command")
58
+ ps("aux") | grep("mysql")
59
+ echo 'noise' > "/dev/null"
60
+ echo 'setting=value' >> "settings.conf"
61
+ tail -100 config.dir.join('log', 'logfile.log')
62
+ command("[[ -f \"path\" ]] && run_a_command")
63
63
 
64
- end
64
+ end
65
65
  ```
66
66
 
67
67
  ### Local Tasks using DSL
@@ -69,15 +69,15 @@ By examples
69
69
  You can also define local tasks using the same DSL
70
70
 
71
71
  ``` rb
72
- desc "Setup git origin"
73
- task :init do
74
- require 'remoting/task'
72
+ desc "Setup git origin"
73
+ task :init do
74
+ require 'remoting/task'
75
75
 
76
- local('init') do
77
- git :init
78
- git :remote, :add, :origin, config.repo
79
- end
80
- end
76
+ local('init') do
77
+ git :init
78
+ git :remote, :add, :origin, config.repo
79
+ end
80
+ end
81
81
  ```
82
82
 
83
83
  Methods invoked inside the `local` block are executed locally. `local` takes only the `name` parameter.
@@ -90,30 +90,30 @@ Invoking `remote` with `:interactive => true` will tell `remote` to yield the pr
90
90
  #### Example 1. Rails remote console (by popular demand):
91
91
 
92
92
  ``` rb
93
- # my_remote_task.rake
94
-
95
- desc "Open rails console on server"
96
- task :console do
97
- require 'remoting/task'
98
-
99
- remote('console', config.login, :interactive => true) do
100
- cd config.dest
101
- source '$HOME/.rvm/scripts/rvm'
102
- bundle :exec, "rails c production"
103
- end
104
- end
93
+ # my_remote_task.rake
94
+
95
+ desc "Open rails console on server"
96
+ task :console do
97
+ require 'remoting/task'
98
+
99
+ remote('console', config.login, :interactive => true) do
100
+ cd config.dest
101
+ source '$HOME/.rvm/scripts/rvm'
102
+ bundle :exec, "rails c production"
103
+ end
104
+ end
105
105
  ```
106
106
 
107
107
  #### Example 2. Reloading Apache configuration (involves sudo):
108
108
 
109
109
  ``` rb
110
- task :reload do
111
- require 'remoting/task'
110
+ task :reload do
111
+ require 'remoting/task'
112
112
 
113
- remote('reload', config.login, :interactive => true) do
114
- sudo "/etc/init.d/apache2 reload"
115
- end
116
- end
113
+ remote('reload', config.login, :interactive => true) do
114
+ sudo "/etc/init.d/apache2 reload"
115
+ end
116
+ end
117
117
  ```
118
118
 
119
119
  ## A note on modularity
@@ -121,14 +121,14 @@ Invoking `remote` with `:interactive => true` will tell `remote` to yield the pr
121
121
  A complete deployment manager (like Capistrano even if probably not as good as it is) can be easily built over *remoting*. Capistrano recipes can be ordinary rake tasks packed as gems. Plus various _deployment strategies_ can be assembled as dependencies of a main `deploy` task.
122
122
 
123
123
  ``` rb
124
- # Gemfile
125
- gem 'remoting_scm_git' # provides 'remoting:scm:push, remoting:scm:update_remoting_code'
126
- gem 'remoting_server_passenger' # provides 'remoting:server:restart'
127
-
128
- # remoting.rake
129
- desc "Deploy application on server"
130
- task :deploy => ["remoting:scm:push", "remoting:scm:update_remoting_code", "remoting:bundle", "remoting:server:restart"] do
131
- end
124
+ # Gemfile
125
+ gem 'remoting_scm_git' # provides 'remoting:scm:push, remoting:scm:update_remoting_code'
126
+ gem 'remoting_server_passenger' # provides 'remoting:server:restart'
127
+
128
+ # remoting.rake
129
+ desc "Deploy application on server"
130
+ task :deploy => ["remoting:scm:push", "remoting:scm:update_remoting_code", "remoting:bundle", "remoting:server:restart"] do
131
+ end
132
132
  ```
133
133
 
134
134
  ## Examples
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.11
1
+ 0.2.12
data/lib/remoting/task.rb CHANGED
@@ -15,14 +15,14 @@ module Remoting
15
15
 
16
16
  def local(name, *args, &block)
17
17
  bold("Executing '#{name}' on local ...")
18
- commands = ::remoting::Dsl::ScriptBuilder.build(&block)
18
+ commands = ::Remoting::Dsl::ScriptBuilder.build(&block)
19
19
  commander = LocalCommander.new(*args)
20
20
  run(commander, commands)
21
21
  end
22
22
 
23
23
  def remote(name, login, *args, &block)
24
24
  bold("Executing '#{name}' on '#{login}' ...")
25
- commands = ::remoting::Dsl::ScriptBuilder.build(&block)
25
+ commands = ::Remoting::Dsl::ScriptBuilder.build(&block)
26
26
  commander = RemoteCommander.new(login, *args)
27
27
  run(commander, commands)
28
28
  end
@@ -32,7 +32,7 @@ module Remoting
32
32
  end
33
33
 
34
34
  def shell
35
- @shell ||= ::remoting::Shell.new
35
+ @shell ||= ::Remoting::Shell.new
36
36
  end
37
37
 
38
38
  %w(bold error success yes? no? say continue?).each do |meth|
@@ -43,7 +43,7 @@ module Remoting
43
43
  end
44
44
 
45
45
  unless self.respond_to?(:_remoting_task_included)
46
- include remoting::Task
46
+ include Remoting::Task
47
47
  end
48
48
 
49
49
 
data/remoting.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "remoting"
8
- s.version = "0.2.11"
8
+ s.version = "0.2.12"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["mcasimir"]
12
- s.date = "2012-05-08"
12
+ s.date = "2012-06-23"
13
13
  s.description = "Remoting is a great way to turn plain rake tasks in scripts to administer the server remote. It provides a little framework to run remote commands over SSH along with a DSL to define remote scripts."
14
14
  s.email = "maurizio.cas@gmail.com"
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remoting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.2.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-08 00:00:00.000000000 Z
12
+ date: 2012-06-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -105,7 +105,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
105
105
  version: '0'
106
106
  segments:
107
107
  - 0
108
- hash: 3696629613796511813
108
+ hash: 2822376162977596700
109
109
  required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  none: false
111
111
  requirements: