taketo 0.2.0 → 0.3.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/.gitignore +2 -0
- data/CHANGELOG.md +85 -0
- data/README.md +29 -89
- data/VERSION +1 -1
- data/lib/taketo/actions/login.rb +2 -2
- data/lib/taketo/commands/mosh_command.rb +30 -0
- data/lib/taketo/commands/ssh_command.rb +4 -20
- data/lib/taketo/commands/ssh_options.rb +32 -0
- data/lib/taketo/commands.rb +18 -2
- data/lib/taketo/constructs/command.rb +0 -1
- data/lib/taketo/constructs/config.rb +0 -1
- data/lib/taketo/constructs/environment.rb +0 -2
- data/lib/taketo/constructs/group.rb +0 -1
- data/lib/taketo/constructs/project.rb +0 -1
- data/lib/taketo/constructs/server.rb +6 -3
- data/lib/taketo/constructs.rb +9 -7
- data/lib/taketo/dsl.rb +1 -0
- data/scripts/zsh/completion/_taketo +1 -0
- data/spec/acceptance/connect_to_server_spec.rb +19 -0
- data/spec/lib/taketo/actions_spec.rb +1 -1
- data/spec/lib/taketo/commands/mosh_command_spec.rb +25 -0
- data/spec/lib/taketo/commands/ssh_command_spec.rb +4 -7
- data/spec/lib/taketo/commands_spec.rb +19 -0
- data/spec/lib/taketo/constructs/base_construct_spec.rb +1 -1
- data/spec/lib/taketo/constructs/command_spec.rb +1 -1
- data/spec/lib/taketo/constructs/config_spec.rb +1 -1
- data/spec/lib/taketo/constructs/environment_spec.rb +1 -1
- data/spec/lib/taketo/constructs/group_spec.rb +1 -1
- data/spec/lib/taketo/constructs/project_spec.rb +1 -1
- data/spec/lib/taketo/constructs/server_spec.rb +12 -1
- data/spec/lib/taketo/dsl_spec.rb +5 -0
- metadata +40 -24
- checksums.yaml +0 -7
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
The Changelog:
|
2
|
+
--------------
|
3
|
+
|
4
|
+
### v0.2.0 (12.04.2013) ###
|
5
|
+
* Add --edit-config option to launch editor with taketo config
|
6
|
+
|
7
|
+
### v0.2.0.alpha (11.02.2013) ###
|
8
|
+
* Add support for server groups. The list of servers in particular group can be obtained
|
9
|
+
with the following command:
|
10
|
+
```taketo <group_name> --list```
|
11
|
+
|
12
|
+
This becomes especially useful with [tmuxall](https://github.com/v-yarotsky/tmuxall).
|
13
|
+
|
14
|
+
### v0.1.2 (12.12.2012) ###
|
15
|
+
* Fix server aliases bug, bump version to 0.1.2 at 12.12.2012 :)
|
16
|
+
|
17
|
+
### v0.1.1 (04.12.2012) ###
|
18
|
+
* Add basic autocompletion support for ZSH, see scripts/zsh/completion
|
19
|
+
|
20
|
+
### v0.1.0 (04.12.2012) ###
|
21
|
+
* Servers can now be outside projects and environments (userful for standalone servers)
|
22
|
+
* SSH config is being generated both for hostnames and global aliases
|
23
|
+
|
24
|
+
### v0.0.10 (17.11.2012) ###
|
25
|
+
* Add ability to generate ssh config
|
26
|
+
|
27
|
+
### v0.0.9 (17.11.2012) ###
|
28
|
+
* Add default_command server config option
|
29
|
+
|
30
|
+
### v0.0.8 (17.11.2012) ###
|
31
|
+
* Add per-config, per-project and per-environment default server config support, i.e.
|
32
|
+
```ruby
|
33
|
+
default_server_config { env :TERM => 'xterm-256color' } # Global default server config
|
34
|
+
|
35
|
+
project :p1 do
|
36
|
+
default_server_config { env :FOO => 'bar' } # global default server config is merged
|
37
|
+
...
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
* Shared server configs can be included without redundant empty-array arguments, i.e.
|
42
|
+
```ruby
|
43
|
+
include_shared_server_configs(:foo, :bar, :baz => [:arg1, :arg2], :qux => :arg3)
|
44
|
+
```
|
45
|
+
|
46
|
+
### v0.0.7 (08.10.2012) ###
|
47
|
+
* Add ability to include several shared server config at once
|
48
|
+
Use hash as include_shared_server_config parameter to include
|
49
|
+
multiple shared server configs with arguments, like:
|
50
|
+
```ruby
|
51
|
+
include_shared_server_configs(:foo => :some_arg, :bar => [:arg1, :arg2])
|
52
|
+
```
|
53
|
+
or just enumerate them if no arguments needed:
|
54
|
+
```ruby
|
55
|
+
include_shared_server_configs(:baz, :quux)
|
56
|
+
```
|
57
|
+
|
58
|
+
NOTE: This change will break your config if you've used parametrized
|
59
|
+
shared server configs before; rewrite them using hash-form
|
60
|
+
|
61
|
+
### v0.0.6 (26.07.2012) ###
|
62
|
+
* Add identity_file server config option
|
63
|
+
* Add shared server config support
|
64
|
+
|
65
|
+
### v0.0.5 (24.07.2012) ###
|
66
|
+
* Add --directory option, which enables specifying directory on remote server upon launch
|
67
|
+
* Add global_alias config option for servers
|
68
|
+
|
69
|
+
### v0.0.4 (22.07.2012) ###
|
70
|
+
* Add --view option. Now you can view your config quickly: ```taketo my_project:environment:server --view``` or just ```taketo --view```
|
71
|
+
* Now commands can have description
|
72
|
+
|
73
|
+
### v0.0.3 (22.07.2012) ###
|
74
|
+
* Add default_destination config option
|
75
|
+
* Add intelligent destination resolving
|
76
|
+
|
77
|
+
### v0.0.2 (21.07.2012) ###
|
78
|
+
* Add ability to define environment variables
|
79
|
+
* Add support for server commands
|
80
|
+
|
81
|
+
### v0.0.1 (13.06.2012) ###
|
82
|
+
* Initial release
|
83
|
+
* Support for simplest configs
|
84
|
+
|
85
|
+
|
data/README.md
CHANGED
@@ -42,7 +42,7 @@ However, I recommend doing a few things for better user experience:
|
|
42
42
|
Usage:
|
43
43
|
------
|
44
44
|
|
45
|
-
|
45
|
+
put a config into ```~/.taketo.rc.rb```:
|
46
46
|
|
47
47
|
```ruby
|
48
48
|
project :my_project do
|
@@ -157,101 +157,41 @@ Also it's possible to specify default server configuration for any scope (whole
|
|
157
157
|
|
158
158
|
Default configs are merged appropriately.
|
159
159
|
|
160
|
+
Servers can be scoped by groups, i.e.:
|
160
161
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
$ taketo my_project:frontends --list | sed 's/^/taketo /' | tmuxall -n MY_PROJECT_FRONTENDS
|
169
|
-
|
170
|
-
This will work since taketo v0.2.0, so stay tuned
|
171
|
-
|
172
|
-
The Changelog:
|
173
|
-
--------------
|
174
|
-
|
175
|
-
### v0.2.0.alpha (11.02.2013) ###
|
176
|
-
* Add support for server groups. The list of servers in particular group can be obtained
|
177
|
-
with the following command:
|
178
|
-
```taketo <group_name> --list```
|
162
|
+
```ruby
|
163
|
+
project :my_project do
|
164
|
+
group :frontends do
|
165
|
+
server do
|
166
|
+
...
|
167
|
+
end
|
168
|
+
end
|
179
169
|
|
180
|
-
|
170
|
+
group :db do
|
171
|
+
...
|
172
|
+
end
|
173
|
+
end
|
174
|
+
```
|
181
175
|
|
182
|
-
|
183
|
-
|
176
|
+
List of servers included in given group can be obtained this way ```taketo --list <project or environment or group>```
|
177
|
+
(useful in conjunction with [tmuxall](https://github.com/v-yarotsky/tmuxall) gem)
|
184
178
|
|
185
|
-
|
186
|
-
* Add basic autocompletion support for ZSH, see scripts/zsh/completion
|
179
|
+
An SSH config file can be generated from taketo config. To do so, run ```taketo --generate-ssh-config```.
|
187
180
|
|
188
|
-
|
189
|
-
* Servers can now be outside projects and environments (userful for standalone servers)
|
190
|
-
* SSH config is being generated both for hostnames and global aliases
|
181
|
+
Taketo provides support for SSH and [Mobile Shell](http://mosh.mit.edu/). Example:
|
191
182
|
|
192
|
-
|
193
|
-
|
183
|
+
```ruby
|
184
|
+
project :my_project do
|
185
|
+
server do
|
186
|
+
ssh_command :mosh
|
187
|
+
end
|
188
|
+
end
|
189
|
+
```
|
194
190
|
|
195
|
-
|
196
|
-
|
191
|
+
Tips:
|
192
|
+
-----
|
197
193
|
|
198
|
-
|
199
|
-
* Add per-config, per-project and per-environment default server config support, i.e.
|
200
|
-
```ruby
|
201
|
-
default_server_config { env :TERM => 'xterm-256color' } # Global default server config
|
194
|
+
Taketo is especially useful in conjunction with [tmuxall](https://github.com/v-yarotsky/tmuxall) gem:
|
202
195
|
|
203
|
-
|
204
|
-
default_server_config { env :FOO => 'bar' } # global default server config is merged
|
205
|
-
...
|
206
|
-
end
|
207
|
-
```
|
208
|
-
|
209
|
-
* Shared server configs can be included without redundant empty-array arguments, i.e.
|
210
|
-
```ruby
|
211
|
-
include_shared_server_configs(:foo, :bar, :baz => [:arg1, :arg2], :qux => :arg3)
|
212
|
-
```
|
213
|
-
|
214
|
-
### v0.0.7 (08.10.2012) ###
|
215
|
-
* Add ability to include several shared server config at once
|
216
|
-
Use hash as include_shared_server_config parameter to include
|
217
|
-
multiple shared server configs with arguments, like:
|
218
|
-
```ruby
|
219
|
-
include_shared_server_configs(:foo => :some_arg, :bar => [:arg1, :arg2])
|
220
|
-
```
|
221
|
-
or just enumerate them if no arguments needed:
|
222
|
-
```ruby
|
223
|
-
include_shared_server_configs(:baz, :quux)
|
224
|
-
```
|
225
|
-
|
226
|
-
NOTE: This change will break your config if you've used parametrized
|
227
|
-
shared server configs before; rewrite them using hash-form
|
228
|
-
|
229
|
-
### v0.0.6 (26.07.2012) ###
|
230
|
-
* Add identity_file server config option
|
231
|
-
* Add shared server config support
|
232
|
-
|
233
|
-
### v0.0.5 (24.07.2012) ###
|
234
|
-
* Add --directory option, which enables specifying directory on remote server upon launch
|
235
|
-
* Add global_alias config option for servers
|
236
|
-
|
237
|
-
### v0.0.4 (22.07.2012) ###
|
238
|
-
* Add --view option. Now you can view your config quickly: ```taketo my_project:environment:server --view``` or just ```taketo --view```
|
239
|
-
* Now commands can have description
|
240
|
-
|
241
|
-
### v0.0.3 (22.07.2012) ###
|
242
|
-
* Add default_destination config option
|
243
|
-
* Add intelligent destination resolving
|
244
|
-
|
245
|
-
### v0.0.2 (21.07.2012) ###
|
246
|
-
* Add ability to define environment variables
|
247
|
-
* Add support for server commands
|
248
|
-
|
249
|
-
### v0.0.1 (13.06.2012) ###
|
250
|
-
* Initial release
|
251
|
-
* Support for simplest configs
|
252
|
-
|
253
|
-
|
254
|
-
TO-DO:
|
255
|
-
------
|
196
|
+
$ taketo my_project:frontends --list | sed 's/^/taketo /' | tmuxall -n MY_PROJECT_FRONTENDS
|
256
197
|
|
257
|
-
* Command completion
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/lib/taketo/actions/login.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'taketo/commands
|
1
|
+
require 'taketo/commands'
|
2
2
|
require 'taketo/actions/base_action'
|
3
3
|
require 'taketo/server_resolver'
|
4
4
|
|
@@ -9,7 +9,7 @@ module Taketo
|
|
9
9
|
def run
|
10
10
|
server = ServerResolver.new(config, destination_path).resolve
|
11
11
|
server_command = remote_command(server)
|
12
|
-
command_to_execute = Commands
|
12
|
+
command_to_execute = Commands[server.ssh_command].new(server).render(server_command.render(server, options))
|
13
13
|
execute(command_to_execute)
|
14
14
|
end
|
15
15
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Taketo
|
2
|
+
module Commands
|
3
|
+
|
4
|
+
class MoshCommand
|
5
|
+
include SSHOptions
|
6
|
+
|
7
|
+
def initialize(server, options = {})
|
8
|
+
@server = server
|
9
|
+
end
|
10
|
+
|
11
|
+
def render(rendered_command)
|
12
|
+
%Q[#{program} #{ssh_program} -- #{username}#{host} #{remote_shell_program} "#{rendered_command}"].squeeze(" ")
|
13
|
+
end
|
14
|
+
|
15
|
+
def program
|
16
|
+
"mosh"
|
17
|
+
end
|
18
|
+
|
19
|
+
def ssh_program
|
20
|
+
%Q[--ssh="ssh #{port} #{identity_file}"].squeeze(" ") if @server.port || @server.identity_file
|
21
|
+
end
|
22
|
+
|
23
|
+
def remote_shell_program
|
24
|
+
"/bin/sh -c"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
@@ -1,35 +1,19 @@
|
|
1
|
-
require 'forwardable'
|
2
|
-
require 'shellwords'
|
3
|
-
|
4
1
|
module Taketo
|
5
2
|
module Commands
|
6
3
|
|
7
4
|
class SSHCommand
|
8
|
-
|
9
|
-
include Shellwords
|
5
|
+
include SSHOptions
|
10
6
|
|
11
7
|
def initialize(server, options = {})
|
12
8
|
@server = server
|
13
9
|
end
|
14
10
|
|
15
11
|
def render(rendered_command)
|
16
|
-
%Q[
|
17
|
-
end
|
18
|
-
|
19
|
-
def host
|
20
|
-
shellescape @server.host
|
21
|
-
end
|
22
|
-
|
23
|
-
def port
|
24
|
-
%Q[-p #{@server.port}] if @server.port
|
25
|
-
end
|
26
|
-
|
27
|
-
def username
|
28
|
-
%Q[#{shellescape @server.username}@] if @server.username
|
12
|
+
%Q[#{program} #{port} #{identity_file} #{username}#{host} "#{rendered_command}"].squeeze(" ")
|
29
13
|
end
|
30
14
|
|
31
|
-
def
|
32
|
-
|
15
|
+
def program
|
16
|
+
"ssh -t"
|
33
17
|
end
|
34
18
|
end
|
35
19
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'shellwords'
|
2
|
+
|
3
|
+
module Taketo
|
4
|
+
module Commands
|
5
|
+
|
6
|
+
module SSHOptions
|
7
|
+
|
8
|
+
include Shellwords
|
9
|
+
def initialize(server)
|
10
|
+
@server = server
|
11
|
+
end
|
12
|
+
|
13
|
+
def host
|
14
|
+
shellescape @server.host
|
15
|
+
end
|
16
|
+
|
17
|
+
def port
|
18
|
+
%Q[-p #{@server.port}] if @server.port
|
19
|
+
end
|
20
|
+
|
21
|
+
def username
|
22
|
+
%Q[#{shellescape @server.username}@] if @server.username
|
23
|
+
end
|
24
|
+
|
25
|
+
def identity_file
|
26
|
+
%Q[-i #{shellescape @server.identity_file}] if @server.identity_file
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
data/lib/taketo/commands.rb
CHANGED
@@ -1,7 +1,23 @@
|
|
1
1
|
module Taketo
|
2
|
+
|
2
3
|
module Commands
|
4
|
+
autoload :SSHOptions, 'taketo/commands/ssh_options'
|
5
|
+
autoload :SSHCommand, 'taketo/commands/ssh_command'
|
6
|
+
autoload :MoshCommand, 'taketo/commands/mosh_command'
|
7
|
+
|
8
|
+
class CommandNotFoundError < StandardError; end
|
9
|
+
|
10
|
+
def self.[](name)
|
11
|
+
commands_map = {
|
12
|
+
:ssh => SSHCommand,
|
13
|
+
:mosh => MoshCommand,
|
14
|
+
}
|
15
|
+
commands_map.fetch(name) do
|
16
|
+
raise CommandNotFoundError,
|
17
|
+
"Command #{name.inspect} not found. Available commands are: #{commands_map.keys.join(", ")}"
|
18
|
+
end
|
19
|
+
end
|
3
20
|
end
|
4
|
-
end
|
5
21
|
|
6
|
-
|
22
|
+
end
|
7
23
|
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'taketo/constructs/base_construct'
|
2
|
-
require 'taketo/constructs/command'
|
3
1
|
require 'taketo/support'
|
4
2
|
|
5
3
|
module Taketo
|
@@ -7,13 +5,14 @@ module Taketo
|
|
7
5
|
|
8
6
|
class Server < BaseConstruct
|
9
7
|
attr_reader :environment_variables
|
10
|
-
attr_accessor :host, :port, :username, :default_location, :default_command, :global_alias, :identity_file
|
8
|
+
attr_accessor :ssh_command, :host, :port, :username, :default_location, :default_command, :global_alias, :identity_file
|
11
9
|
|
12
10
|
has_nodes :commands, :command
|
13
11
|
|
14
12
|
def initialize(name)
|
15
13
|
super
|
16
14
|
@environment_variables = {}
|
15
|
+
@ssh_command = :ssh
|
17
16
|
end
|
18
17
|
|
19
18
|
def env(env_variables)
|
@@ -25,6 +24,10 @@ module Taketo
|
|
25
24
|
env(:RAILS_ENV => parent.rails_env) if parent.respond_to?(:rails_env)
|
26
25
|
end
|
27
26
|
|
27
|
+
def ssh_command=(ssh_command)
|
28
|
+
@ssh_command = ssh_command.to_sym
|
29
|
+
end
|
30
|
+
|
28
31
|
def global_alias=(alias_name)
|
29
32
|
@global_alias = alias_name.to_s
|
30
33
|
end
|
data/lib/taketo/constructs.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
module Taketo
|
2
|
+
|
2
3
|
module Constructs
|
4
|
+
autoload :BaseConstruct, 'taketo/constructs/base_construct'
|
5
|
+
autoload :Config, 'taketo/constructs/config'
|
6
|
+
autoload :Project, 'taketo/constructs/project'
|
7
|
+
autoload :Environment, 'taketo/constructs/environment'
|
8
|
+
autoload :Server, 'taketo/constructs/server'
|
9
|
+
autoload :Group, 'taketo/constructs/group'
|
10
|
+
autoload :Command, 'taketo/constructs/command'
|
3
11
|
end
|
12
|
+
|
4
13
|
end
|
5
14
|
|
6
|
-
require 'taketo/constructs/base_construct'
|
7
|
-
require 'taketo/constructs/config'
|
8
|
-
require 'taketo/constructs/project'
|
9
|
-
require 'taketo/constructs/environment'
|
10
|
-
require 'taketo/constructs/server'
|
11
|
-
require 'taketo/constructs/group'
|
12
|
-
require 'taketo/constructs/command'
|
data/lib/taketo/dsl.rb
CHANGED
@@ -70,6 +70,7 @@ module Taketo
|
|
70
70
|
define_scope :command, :server
|
71
71
|
|
72
72
|
define_method_in_scope(:default_destination, :config) { |destination| current_scope_object.default_destination = destination }
|
73
|
+
define_method_in_scope(:ssh_command, :server) { |ssh_command| current_scope_object.ssh_command = ssh_command }
|
73
74
|
define_method_in_scope(:host, :server) { |hostname| current_scope_object.host = hostname }
|
74
75
|
define_method_in_scope(:port, :server) { |port_number| current_scope_object.port = port_number }
|
75
76
|
define_method_in_scope(:user, :server) { |username| current_scope_object.username = username }
|
@@ -13,6 +13,7 @@ _taketo() {
|
|
13
13
|
'(--view)--view[Show config contents in a tree form]' \
|
14
14
|
'(--list)--list[List scopes]' \
|
15
15
|
'(--dry-run)--dry-run[Print out what would be run]' \
|
16
|
+
'(--edit-config)--edit-config[Open taketo config in EDITOR]' \
|
16
17
|
'(--generate-ssh-config)--generate-ssh-config[Generate SSH config from taketo config]' \
|
17
18
|
'(--version)--version[Display taketo version and exit]' \
|
18
19
|
'1: :->dest' && ret=0
|
@@ -59,5 +59,24 @@ feature "connect to server" do
|
|
59
59
|
stderr.should be_empty
|
60
60
|
exit_status.should be_success
|
61
61
|
end
|
62
|
+
|
63
|
+
scenario "mosh instead of good ol' ssh" do
|
64
|
+
create_config <<-CONFIG
|
65
|
+
project :slots do
|
66
|
+
environment :staging do
|
67
|
+
server do
|
68
|
+
ssh_command :mosh
|
69
|
+
identity_file "/home/gor/.ssh/foo bar"
|
70
|
+
host "2.3.4.5"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
CONFIG
|
75
|
+
|
76
|
+
run "taketo --dry-run"
|
77
|
+
stdout.should == %q{mosh --ssh="ssh -i /home/gor/.ssh/foo\ bar" -- 2.3.4.5 /bin/sh -c "RAILS_ENV=staging bash"}
|
78
|
+
stderr.should be_empty
|
79
|
+
exit_status.should be_success
|
80
|
+
end
|
62
81
|
end
|
63
82
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'taketo/commands'
|
3
|
+
|
4
|
+
include Taketo::Commands
|
5
|
+
|
6
|
+
describe "Mosh Command" do
|
7
|
+
let(:server) do
|
8
|
+
stub(:Server, :host => "1.2.3.4",
|
9
|
+
:port => 22,
|
10
|
+
:username => "deployer",
|
11
|
+
:identity_file => "/home/gor/.ssh/qqq")
|
12
|
+
end
|
13
|
+
|
14
|
+
subject(:mosh_command) { MoshCommand.new(server) }
|
15
|
+
|
16
|
+
it "composes command based on provided server object" do
|
17
|
+
mosh_command.render("foobar").should == %q[mosh --ssh="ssh -p 22 -i /home/gor/.ssh/qqq" -- deployer@1.2.3.4 /bin/sh -c "foobar"]
|
18
|
+
end
|
19
|
+
|
20
|
+
it "ignores absent parts if they are not required" do
|
21
|
+
server.stub(:port => nil, :username => nil, :identity_file => nil)
|
22
|
+
mosh_command.render("foobar").should == %q[mosh -- 1.2.3.4 /bin/sh -c "foobar"]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
@@ -1,17 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'taketo/commands
|
2
|
+
require 'taketo/commands'
|
3
3
|
|
4
4
|
include Taketo::Commands
|
5
5
|
|
6
6
|
describe "SSH Command" do
|
7
7
|
let(:server) do
|
8
|
-
stub(:Server, :
|
9
|
-
:host => "1.2.3.4",
|
8
|
+
stub(:Server, :host => "1.2.3.4",
|
10
9
|
:port => 22,
|
11
|
-
:username => "deployer",
|
12
|
-
:
|
13
|
-
:identity_file => "/home/gor/.ssh/qqq",
|
14
|
-
:environment_variables => {})
|
10
|
+
:username => "deployer",
|
11
|
+
:identity_file => "/home/gor/.ssh/qqq")
|
15
12
|
end
|
16
13
|
|
17
14
|
subject(:ssh_command) { SSHCommand.new(server) }
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'taketo/commands'
|
3
|
+
|
4
|
+
include Taketo
|
5
|
+
|
6
|
+
describe "Commands" do
|
7
|
+
describe ".[]" do
|
8
|
+
it "returns class by name" do
|
9
|
+
Commands[:mosh].should == Commands::MoshCommand
|
10
|
+
end
|
11
|
+
|
12
|
+
it "raises ArgumentError if command not found" do
|
13
|
+
expect do
|
14
|
+
Commands[:never_existed_here]
|
15
|
+
end.to raise_error(Commands::CommandNotFoundError, /not found/i)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'support/helpers/construct_spec_helper'
|
3
|
-
require 'taketo/constructs
|
3
|
+
require 'taketo/constructs'
|
4
4
|
|
5
5
|
include Taketo
|
6
6
|
|
@@ -61,6 +61,17 @@ describe "Server" do
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
+
describe "#ssh_command" do
|
65
|
+
it "stores symbol" do
|
66
|
+
server.ssh_command = "ohai"
|
67
|
+
expect(server.ssh_command).to eq(:ohai)
|
68
|
+
end
|
69
|
+
|
70
|
+
it "has #ssh_command = :ssh by default" do
|
71
|
+
expect(server.ssh_command).to eq(:ssh)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
64
75
|
specify "#global_alias= stores string" do
|
65
76
|
server.global_alias = :foo
|
66
77
|
expect(server.global_alias).to eq("foo")
|
data/spec/lib/taketo/dsl_spec.rb
CHANGED
@@ -197,6 +197,10 @@ describe "DSL" do
|
|
197
197
|
end
|
198
198
|
end
|
199
199
|
|
200
|
+
describe "#ssh_command" do
|
201
|
+
it_behaves_like "a scoped method", :ssh_command, :server, :ssh_command=, "mosh"
|
202
|
+
end
|
203
|
+
|
200
204
|
describe "#host" do
|
201
205
|
it_behaves_like "a scoped method", :host, :server, :host=, "127.0.0.2"
|
202
206
|
end
|
@@ -225,6 +229,7 @@ describe "DSL" do
|
|
225
229
|
it_behaves_like "a scoped method", :identity_file, :server, :identity_file=, "/home/gor/.ssh/qqq"
|
226
230
|
end
|
227
231
|
|
232
|
+
|
228
233
|
describe "#default_command" do
|
229
234
|
it_behaves_like "a scoped method", :default_command, :server, :default_command=, :tmux
|
230
235
|
end
|
metadata
CHANGED
@@ -1,75 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taketo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease:
|
5
|
+
version: 0.3.0
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Vladimir Yarotsky
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-
|
12
|
+
date: 2013-07-08 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rspec
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.11'
|
15
22
|
requirement: !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
16
24
|
requirements:
|
17
25
|
- - ~>
|
18
26
|
- !ruby/object:Gem::Version
|
19
27
|
version: '2.11'
|
20
28
|
type: :development
|
21
29
|
prerelease: false
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
22
32
|
version_requirements: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
23
34
|
requirements:
|
24
35
|
- - ~>
|
25
36
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
37
|
+
version: '0.9'
|
29
38
|
requirement: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
30
40
|
requirements:
|
31
41
|
- - ~>
|
32
42
|
- !ruby/object:Gem::Version
|
33
43
|
version: '0.9'
|
34
44
|
type: :development
|
35
45
|
prerelease: false
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: simplecov
|
36
48
|
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
37
50
|
requirements:
|
38
51
|
- - ~>
|
39
52
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: simplecov
|
53
|
+
version: '0.6'
|
43
54
|
requirement: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
44
56
|
requirements:
|
45
57
|
- - ~>
|
46
58
|
- !ruby/object:Gem::Version
|
47
59
|
version: '0.6'
|
48
60
|
type: :development
|
49
61
|
prerelease: false
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: open4
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
51
66
|
requirements:
|
52
67
|
- - ~>
|
53
68
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: open4
|
69
|
+
version: '1.3'
|
57
70
|
requirement: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
58
72
|
requirements:
|
59
73
|
- - ~>
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '1.3'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '1.3'
|
69
|
-
description: |2
|
70
|
-
Taketo is an utility to aid quick access to often used servers for web-developers.
|
71
|
-
Taketo uses a config written in ruby using light DSL.
|
72
|
-
See http://github.com/v-yarotsky/taketo for additional instructions
|
78
|
+
description: ! " Taketo is an utility to aid quick access to often used servers
|
79
|
+
for web-developers.\n Taketo uses a config written in ruby using light DSL.\n
|
80
|
+
\ See http://github.com/v-yarotsky/taketo for additional instructions\n"
|
73
81
|
email: vladimir.yarotksy@gmail.com
|
74
82
|
executables:
|
75
83
|
- taketo
|
@@ -81,6 +89,7 @@ files:
|
|
81
89
|
- .gitignore
|
82
90
|
- .travis.yml
|
83
91
|
- .yardopts
|
92
|
+
- CHANGELOG.md
|
84
93
|
- Gemfile
|
85
94
|
- Gemfile.lock
|
86
95
|
- LICENSE.txt
|
@@ -99,7 +108,9 @@ files:
|
|
99
108
|
- lib/taketo/actions/view.rb
|
100
109
|
- lib/taketo/associated_nodes.rb
|
101
110
|
- lib/taketo/commands.rb
|
111
|
+
- lib/taketo/commands/mosh_command.rb
|
102
112
|
- lib/taketo/commands/ssh_command.rb
|
113
|
+
- lib/taketo/commands/ssh_options.rb
|
103
114
|
- lib/taketo/config_printer_visitor.rb
|
104
115
|
- lib/taketo/config_traverser.rb
|
105
116
|
- lib/taketo/config_validator.rb
|
@@ -140,7 +151,9 @@ files:
|
|
140
151
|
- spec/integration/dsl_integration_spec.rb
|
141
152
|
- spec/lib/taketo/actions_spec.rb
|
142
153
|
- spec/lib/taketo/associated_nodes_spec.rb
|
154
|
+
- spec/lib/taketo/commands/mosh_command_spec.rb
|
143
155
|
- spec/lib/taketo/commands/ssh_command_spec.rb
|
156
|
+
- spec/lib/taketo/commands_spec.rb
|
144
157
|
- spec/lib/taketo/config_printer_visitor_spec.rb
|
145
158
|
- spec/lib/taketo/config_traverser_spec.rb
|
146
159
|
- spec/lib/taketo/config_validator_spec.rb
|
@@ -171,24 +184,25 @@ files:
|
|
171
184
|
homepage: http://github.com/v-yarotsky/taketo
|
172
185
|
licenses:
|
173
186
|
- MIT
|
174
|
-
metadata: {}
|
175
187
|
post_install_message:
|
176
188
|
rdoc_options: []
|
177
189
|
require_paths:
|
178
190
|
- lib
|
179
191
|
required_ruby_version: !ruby/object:Gem::Requirement
|
192
|
+
none: false
|
180
193
|
requirements:
|
181
|
-
- - '>='
|
194
|
+
- - ! '>='
|
182
195
|
- !ruby/object:Gem::Version
|
183
196
|
version: '0'
|
184
197
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
198
|
+
none: false
|
185
199
|
requirements:
|
186
|
-
- - '>='
|
200
|
+
- - ! '>='
|
187
201
|
- !ruby/object:Gem::Version
|
188
202
|
version: 1.3.6
|
189
203
|
requirements: []
|
190
204
|
rubyforge_project:
|
191
|
-
rubygems_version:
|
205
|
+
rubygems_version: 1.8.25
|
192
206
|
signing_key:
|
193
207
|
specification_version: 3
|
194
208
|
summary: A tiny helper utility to make access to servers eaiser for different projects
|
@@ -208,7 +222,9 @@ test_files:
|
|
208
222
|
- spec/integration/dsl_integration_spec.rb
|
209
223
|
- spec/lib/taketo/actions_spec.rb
|
210
224
|
- spec/lib/taketo/associated_nodes_spec.rb
|
225
|
+
- spec/lib/taketo/commands/mosh_command_spec.rb
|
211
226
|
- spec/lib/taketo/commands/ssh_command_spec.rb
|
227
|
+
- spec/lib/taketo/commands_spec.rb
|
212
228
|
- spec/lib/taketo/config_printer_visitor_spec.rb
|
213
229
|
- spec/lib/taketo/config_traverser_spec.rb
|
214
230
|
- spec/lib/taketo/config_validator_spec.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 029c1faa2c6ca7f98624297fb06f91d808fcb0f7
|
4
|
-
data.tar.gz: b271faf2011fcc1df7c02a8a4faaf5f058539579
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 6c3e8368d01c29ca74ab7bd0162fdd37bed1c56cf2258f2b621e992e116ed709c4667b01e0cdcf1011b262004765d35b163c017e692a838c0f190722f72e98c3
|
7
|
-
data.tar.gz: b3117151aded8ce18fb21961aea05ae3745fa9523393b1379d05bc332a657dc02421fcc3742cb67066d5a1cb4cb185e7239fe79c1a5825643028e8af1331caf6
|