taketo 0.1.3 → 0.2.0.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/Gemfile +1 -0
  2. data/Gemfile.lock +8 -0
  3. data/README.md +16 -1
  4. data/Rakefile +1 -0
  5. data/VERSION +1 -1
  6. data/bin/taketo +17 -89
  7. data/lib/taketo/actions/base_action.rb +29 -0
  8. data/lib/taketo/actions/generate_ssh_config.rb +22 -0
  9. data/lib/taketo/actions/group_action.rb +15 -0
  10. data/lib/taketo/actions/list.rb +22 -0
  11. data/lib/taketo/actions/login.rb +40 -0
  12. data/lib/taketo/actions/matches.rb +28 -0
  13. data/lib/taketo/actions/node_action.rb +15 -0
  14. data/lib/taketo/actions/server_action.rb +14 -0
  15. data/lib/taketo/actions/view.rb +24 -0
  16. data/lib/taketo/actions.rb +21 -0
  17. data/lib/taketo/associated_nodes.rb +4 -0
  18. data/lib/taketo/commands.rb +2 -1
  19. data/lib/taketo/config_validator.rb +4 -0
  20. data/lib/taketo/config_visitor.rb +3 -1
  21. data/lib/taketo/constructs/config.rb +2 -1
  22. data/lib/taketo/constructs/environment.rb +9 -0
  23. data/lib/taketo/constructs/group.rb +20 -0
  24. data/lib/taketo/constructs/project.rb +2 -1
  25. data/lib/taketo/constructs/server.rb +1 -1
  26. data/lib/taketo/constructs.rb +1 -0
  27. data/lib/taketo/constructs_factory.rb +4 -0
  28. data/lib/taketo/destination_matcher.rb +4 -4
  29. data/lib/taketo/dsl.rb +18 -17
  30. data/lib/taketo/group_list_visitor.rb +11 -0
  31. data/lib/taketo/group_resolver.rb +12 -0
  32. data/lib/taketo/{destination_resolver.rb → node_resolver.rb} +5 -27
  33. data/lib/taketo/server_resolver.rb +29 -0
  34. data/spec/acceptance/command_spec.rb +2 -1
  35. data/spec/acceptance/completion_spec.rb +26 -9
  36. data/spec/acceptance/config_dsl_spec.rb +74 -13
  37. data/spec/acceptance/config_validation_spec.rb +20 -5
  38. data/spec/acceptance/connect_to_server_spec.rb +6 -3
  39. data/spec/acceptance/error_handling_spec.rb +2 -2
  40. data/spec/acceptance/generate_ssh_config_spec.rb +1 -1
  41. data/spec/acceptance/help_spec.rb +4 -2
  42. data/spec/acceptance/location_spec.rb +2 -1
  43. data/spec/acceptance_spec_helper.rb +1 -1
  44. data/spec/lib/taketo/actions_spec.rb +17 -0
  45. data/spec/lib/taketo/associated_nodes_spec.rb +34 -0
  46. data/spec/lib/taketo/config_validator_spec.rb +1 -1
  47. data/spec/lib/taketo/constructs/config_spec.rb +4 -1
  48. data/spec/lib/taketo/constructs/environment_spec.rb +6 -1
  49. data/spec/lib/taketo/constructs/group_spec.rb +30 -0
  50. data/spec/lib/taketo/constructs/project_spec.rb +2 -0
  51. data/spec/lib/taketo/constructs/server_spec.rb +6 -2
  52. data/spec/lib/taketo/constructs_factory_spec.rb +5 -0
  53. data/spec/lib/taketo/dsl_spec.rb +86 -74
  54. data/spec/lib/taketo/group_list_visitor_spec.rb +20 -0
  55. data/spec/lib/taketo/group_resolver_spec.rb +59 -0
  56. data/spec/lib/taketo/{destination_resolver_spec.rb → server_resolver_spec.rb} +3 -29
  57. data/spec/support/helpers/construct_spec_helper.rb +9 -0
  58. data/spec/support/helpers/dsl_spec_helper.rb +31 -9
  59. data/spec/support/matchers/enclose_scope_matcher.rb +15 -7
  60. metadata +41 -20
data/Gemfile CHANGED
@@ -5,5 +5,6 @@ group :development do
5
5
  gem "rake", "~> 0.9"
6
6
  gem 'simplecov', '~> 0.6', :require => false
7
7
  gem 'open4', '~> 1.3'
8
+ gem 'pry'
8
9
  end
9
10
 
data/Gemfile.lock CHANGED
@@ -1,9 +1,15 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
+ coderay (1.0.7)
4
5
  diff-lcs (1.1.3)
6
+ method_source (0.8)
5
7
  multi_json (1.3.7)
6
8
  open4 (1.3.0)
9
+ pry (0.9.10)
10
+ coderay (~> 1.0.5)
11
+ method_source (~> 0.8)
12
+ slop (~> 3.3.1)
7
13
  rake (0.9.5)
8
14
  rspec (2.12.0)
9
15
  rspec-core (~> 2.12.0)
@@ -17,12 +23,14 @@ GEM
17
23
  multi_json (~> 1.0)
18
24
  simplecov-html (~> 0.7.1)
19
25
  simplecov-html (0.7.1)
26
+ slop (3.3.2)
20
27
 
21
28
  PLATFORMS
22
29
  ruby
23
30
 
24
31
  DEPENDENCIES
25
32
  open4 (~> 1.3)
33
+ pry
26
34
  rake (~> 0.9)
27
35
  rspec (~> 2.11)
28
36
  simplecov (~> 0.6)
data/README.md CHANGED
@@ -3,6 +3,7 @@ Take Me To
3
3
 
4
4
  [![Build Status](https://secure.travis-ci.org/v-yarotsky/taketo.png)](http://travis-ci.org/v-yarotsky/taketo)
5
5
  [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/v-yarotsky/taketo)
6
+ [![Gem Version](https://badge.fury.io/rb/taketo.png)](http://badge.fury.io/rb/taketo)
6
7
 
7
8
  A tiny helper utility to make access to servers easier for different projects and environments.
8
9
 
@@ -30,7 +31,7 @@ However, I recommend doing a few things for better user experience:
30
31
  1. In ~/.zshrc (or ~/.bashrc if you use Bash) create an alias for taketo:
31
32
  ```alias to="taketo"```
32
33
  2. In case you use RVM, I recommend to create a wrapper for taketo,
33
- which would use newest ruby: ```rvm wrapper ruby-1.9.3-p194-perf@global --no-prefix taketo```.
34
+ which would use newest ruby: ```rvm wrapper ruby-1.9.3-p194-perf@global --no-prefix taketo```.
34
35
  Of course, you will need to install taketo for corresponding ruby and gemset.
35
36
  Also, keep in mind that the fewer gems are installed into the gemset, the faster things will work.
36
37
  3. In case you use ZSH – install [taketo ZSH completion](https://raw.github.com/v-yarotsky/taketo/master/scripts/zsh/completion/_taketo).
@@ -157,11 +158,25 @@ Default configs are merged appropriately.
157
158
 
158
159
  An SSH config file can be generated from taketo config. To do so, run ```taketo --generate-ssh-config```.
159
160
 
161
+ Tips:
162
+ -----
160
163
 
164
+ Taketo is especially useful in conjunction with [tmuxall](https://github.com/v-yarotsky/tmuxall) gem:
165
+
166
+ $ taketo my_project:frontends --list | sed 's/^/taketo /' | tmuxall -n MY_PROJECT_FRONTENDS
167
+
168
+ This will work since taketo v0.2.0, so stay tuned
161
169
 
162
170
  The Changelog:
163
171
  --------------
164
172
 
173
+ ### v0.2.0.alpha (11.02.2013) ###
174
+ * Add support for server groups. The list of servers in particular group can be obtained
175
+ with the following command:
176
+ ```taketo <group_name> --list```
177
+
178
+ This becomes especially useful with [tmuxall](https://github.com/v-yarotsky/tmuxall).
179
+
165
180
  ### v0.1.2 (12.12.2012) ###
166
181
  * Fix server aliases bug, bump version to 0.1.2 at 12.12.2012 :)
167
182
 
data/Rakefile CHANGED
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
  require 'rubygems'
3
3
  require 'bundler'
4
+ require 'bundler/gem_tasks'
4
5
 
5
6
  begin
6
7
  Bundler.setup(:default, :development)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.2.0.alpha
data/bin/taketo CHANGED
@@ -2,12 +2,10 @@
2
2
 
3
3
  require 'rubygems'
4
4
 
5
+ require 'optparse'
5
6
  require 'taketo'
6
- require 'taketo/constructs_factory'
7
7
  require 'taketo/commands'
8
- require 'taketo/destination_resolver'
9
- require 'taketo/destination_matcher'
10
- require 'optparse'
8
+ require 'taketo/actions'
11
9
 
12
10
  Signal.trap("SIGINT") do
13
11
  puts "Terminating"
@@ -19,107 +17,37 @@ include Taketo
19
17
  DEFAULT_CONFIG_FILE = File.join(ENV['HOME'], ".taketo.rc.rb")
20
18
 
21
19
  def parse_options
22
- options = { :config => DEFAULT_CONFIG_FILE }
20
+ options = { :config => DEFAULT_CONFIG_FILE, :action => :login }
23
21
 
24
22
  OptionParser.new do |opts|
25
23
  opts.banner = "Usage: taketo [destination] [options]"
26
24
  opts.version = ::Taketo::VERSION
25
+
27
26
  opts.separator ""
28
27
  opts.separator "Common options:"
29
28
 
30
- opts.on("-f CONFIG", "--config", "Use custom config file (default: #{DEFAULT_CONFIG_FILE})") do |c|
31
- options[:config] = c
32
- end
33
-
29
+ opts.on("-f CONFIG", "--config", "Use custom config file (default: #{DEFAULT_CONFIG_FILE})") { |v| options[:config] = v }
34
30
  opts.on("-c COMMAND", "--command", "Command to execute on destination server",
35
- " (COMMAND either declared in config or passed as an argument)") do |c|
36
- raise OptionParser::MissingArgument if String(c).strip.empty?
37
- options[:command] = c
38
- end
39
-
40
- opts.on("-d DIRECTORY", "--directory", "Directory on destination server to cd to") do |d|
41
- raise OptionParser::MissingArgument if String(d).strip.empty?
42
- options[:directory] = d
43
- end
44
-
45
- opts.on("-v", "--view", "Show config contents and exit") do |v|
46
- require 'taketo/config_printer_visitor'
47
- options[:view] = v
48
- end
49
-
50
- opts.on("--generate-ssh-config", "Generate SSH config from taketo config") do |g|
51
- require 'taketo/ssh_config_generator_visitor'
52
- options[:generate_ssh_config] = g
53
- end
31
+ " (COMMAND either declared in config or passed as an argument)") { |v| options[:command] = v }
32
+ opts.on("-d DIRECTORY", "--directory", "Directory on destination server to cd to") { |v| options[:directory] = v }
33
+ opts.on("-v", "--view", "Show config contents and exit") { |v| options[:action] = :view; options[:view] = true }
34
+ opts.on("--generate-ssh-config", "Generate SSH config from taketo config") { |v| options[:action] = :generate_ssh_config }
35
+ opts.on("--list", "List servers in given group") { |v| options[:action] = :list; options[:list] = true }
54
36
 
55
37
  opts.separator "Special options:"
56
38
 
57
- opts.on("--dry-run", "Print out what would be run") do |v|
58
- options[:dry_run] = v
59
- end
60
-
61
- opts.on("--debug") do |d|
62
- options[:debug] = d
63
- end
64
-
65
- opts.on("--matches") do |m|
66
- options[:matches] = m
67
- end
68
-
39
+ opts.on("--dry-run", "Print out what would be run") { |v| options[:dry_run] = v }
40
+ opts.on("--debug") { |v| options[:debug] = v }
41
+ opts.on("--matches") { |v| options[:action] = :matches }
69
42
  end.parse!
70
43
 
71
- options
72
- end
73
-
74
- def parse_config(config)
75
- DSL.new.configure(config).tap do |config|
76
- traverser = ConfigTraverser.new(config)
77
- ConfigValidator.new(traverser).validate!
78
- end
79
- end
80
-
81
- def remote_command(server, options)
82
- command = options[:command]
83
- if String(command).empty?
84
- server.default_command
85
- else
86
- server.find_command(command.to_sym) || Constructs::Command.explicit_command(command)
87
- end
88
- end
89
-
90
- def execute(shell_command, options)
91
- if options[:dry_run]
92
- puts shell_command
93
- else
94
- system shell_command
95
- end
44
+ options.merge!(:destination_path => ARGV.shift.to_s)
96
45
  end
97
46
 
98
47
  begin
99
- options = parse_options
100
- config = parse_config(options[:config])
101
- destination_path = ARGV.shift.to_s
102
- resolver = DestinationResolver.new(config, destination_path)
103
-
104
- if options.delete(:matches)
105
- puts DestinationMatcher.new(resolver.servers).matches.join(" ")
106
- elsif options.delete(:view)
107
- node = resolver.get_node
108
- traverser = ConfigTraverser.new(node)
109
- config_printer = ConfigPrinterVisitor.new
110
- traverser.visit_depth_first(config_printer)
111
- puts config_printer.result
112
- elsif options.delete(:generate_ssh_config)
113
- traverser = ConfigTraverser.new(config)
114
- ssh_config_generator = SSHConfigGeneratorVisitor.new
115
- traverser.visit_depth_first(ssh_config_generator)
116
- puts ssh_config_generator.result
117
- else
118
- server = resolver.resolve
119
- server_command = remote_command(server, options)
120
- command_to_execute = Commands::SSHCommand.new(server).render(server_command.render(server, options))
121
- execute(command_to_execute, options)
122
- end
48
+ options = parse_options
49
+ action = Actions[options[:action]].new(options)
50
+ action.run
123
51
  rescue SystemExit
124
52
  # Do nothing
125
53
  rescue Exception => e
@@ -0,0 +1,29 @@
1
+ require 'taketo/config_traverser'
2
+ require 'taketo/config_validator'
3
+
4
+ module Taketo
5
+ module Actions
6
+
7
+ class BaseAction
8
+ attr_reader :options, :destination_path
9
+
10
+ def initialize(options)
11
+ @options = options
12
+ @destination_path = options[:destination_path]
13
+ end
14
+
15
+ def config
16
+ @config ||= begin
17
+ config_file = options[:config]
18
+
19
+ DSL.new.configure(config_file).tap do |config|
20
+ traverser = ConfigTraverser.new(config)
21
+ ConfigValidator.new(traverser).validate!
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ end
28
+ end
29
+
@@ -0,0 +1,22 @@
1
+ require 'taketo/config_traverser'
2
+ require 'taketo/ssh_config_generator_visitor'
3
+ require 'taketo/actions/base_action'
4
+ require 'taketo/actions/server_action'
5
+
6
+ module Taketo
7
+ module Actions
8
+
9
+ class GenerateSshConfig < BaseAction
10
+ include ServerAction
11
+
12
+ def run
13
+ traverser = ConfigTraverser.new(config)
14
+ ssh_config_generator = SSHConfigGeneratorVisitor.new
15
+ traverser.visit_depth_first(ssh_config_generator)
16
+ puts ssh_config_generator.result
17
+ end
18
+ end
19
+
20
+ end
21
+ end
22
+
@@ -0,0 +1,15 @@
1
+ require 'taketo/group_resolver'
2
+
3
+ module Taketo
4
+ module Actions
5
+
6
+ module GroupAction
7
+ def resolver
8
+ @resolver ||= GroupResolver.new(config, destination_path)
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+
15
+
@@ -0,0 +1,22 @@
1
+ require 'taketo/group_list_visitor'
2
+ require 'taketo/actions/base_action'
3
+ require 'taketo/actions/group_action'
4
+
5
+ module Taketo
6
+ module Actions
7
+
8
+ class List < BaseAction
9
+ include GroupAction
10
+
11
+ def run
12
+ node = resolver.resolve
13
+ traverser = ConfigTraverser.new(node)
14
+ lister = GroupListVisitor.new
15
+ traverser.visit_depth_first(lister)
16
+ puts lister.result
17
+ end
18
+ end
19
+
20
+ end
21
+ end
22
+
@@ -0,0 +1,40 @@
1
+ require 'taketo/commands/ssh_command'
2
+ require 'taketo/actions/base_action'
3
+ require 'taketo/actions/server_action'
4
+
5
+ module Taketo
6
+ module Actions
7
+
8
+ class Login < BaseAction
9
+ include ServerAction
10
+
11
+ def run
12
+ server = resolver.resolve
13
+ server_command = remote_command(server)
14
+ command_to_execute = Commands::SSHCommand.new(server).render(server_command.render(server, options))
15
+ execute(command_to_execute)
16
+ end
17
+
18
+ private
19
+
20
+ def remote_command(server)
21
+ command = options[:command]
22
+ if String(command).empty?
23
+ server.default_command
24
+ else
25
+ server.find_command(command.to_sym) || Constructs::Command.explicit_command(command)
26
+ end
27
+ end
28
+
29
+ def execute(shell_command)
30
+ if options[:dry_run]
31
+ puts shell_command
32
+ else
33
+ system shell_command
34
+ end
35
+ end
36
+ end
37
+
38
+ end
39
+ end
40
+
@@ -0,0 +1,28 @@
1
+ require 'taketo/destination_matcher'
2
+ require 'taketo/actions/base_action'
3
+ require 'taketo/actions/server_action'
4
+ require 'taketo/actions/group_action'
5
+ require 'taketo/actions/node_action'
6
+
7
+ module Taketo
8
+ module Actions
9
+
10
+ class Matches < BaseAction
11
+ def initialize(options)
12
+ super
13
+ if options[:list]
14
+ self.extend(GroupAction)
15
+ elsif options[:view]
16
+ self.extend(NodeAction)
17
+ else
18
+ self.extend(ServerAction)
19
+ end
20
+ end
21
+
22
+ def run
23
+ puts DestinationMatcher.new(resolver.nodes).matches.join(" ")
24
+ end
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,15 @@
1
+ require 'taketo/node_resolver'
2
+
3
+ module Taketo
4
+ module Actions
5
+
6
+ module NodeAction
7
+ def resolver
8
+ @resolver ||= NodeResolver.new(config, destination_path)
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+
15
+
@@ -0,0 +1,14 @@
1
+ require 'taketo/server_resolver'
2
+
3
+ module Taketo
4
+ module Actions
5
+
6
+ module ServerAction
7
+ def resolver
8
+ @resolver ||= ServerResolver.new(config, destination_path)
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+
@@ -0,0 +1,24 @@
1
+ require 'taketo/config_traverser'
2
+ require 'taketo/config_printer_visitor'
3
+ require 'taketo/actions/base_action'
4
+ require 'taketo/actions/node_action'
5
+
6
+ module Taketo
7
+ module Actions
8
+
9
+ class View < BaseAction
10
+ include NodeAction
11
+
12
+ def run
13
+ config.default_destination = nil
14
+ node = resolver.resolve
15
+ traverser = ConfigTraverser.new(node)
16
+ config_printer = ConfigPrinterVisitor.new
17
+ traverser.visit_depth_first(config_printer)
18
+ puts config_printer.result
19
+ end
20
+ end
21
+
22
+ end
23
+ end
24
+
@@ -0,0 +1,21 @@
1
+ require 'taketo/actions/login'
2
+ require 'taketo/actions/view'
3
+ require 'taketo/actions/list'
4
+ require 'taketo/actions/matches'
5
+ require 'taketo/actions/generate_ssh_config'
6
+
7
+ module Taketo
8
+ module Actions
9
+ def self.[](name)
10
+ actions_map = {
11
+ :login => Login,
12
+ :view => View,
13
+ :list => List,
14
+ :matches => Matches,
15
+ :generate_ssh_config => GenerateSshConfig
16
+ }
17
+ actions_map.fetch(name) { Login }
18
+ end
19
+ end
20
+ end
21
+
@@ -78,6 +78,10 @@ module Taketo
78
78
  @nodes.fetch(name_plural) { [] }.any?
79
79
  end
80
80
 
81
+ def has_deeply_nested_nodes?(name_plural)
82
+ has_nodes?(name_plural) || self.class.node_types.any? { |n| nodes(n).any? { |node| node.has_deeply_nested_nodes?(name_plural) } }
83
+ end
84
+
81
85
  ##
82
86
  # Ovverride for better error messages
83
87
  def qualified_name
@@ -3,4 +3,5 @@ module Taketo
3
3
  end
4
4
  end
5
5
 
6
- Dir.glob(File.expand_path('../commands/*.rb', __FILE__)).each { |c| require c }
6
+ require 'taketo/commands/ssh_command'
7
+
@@ -21,6 +21,10 @@ module Taketo
21
21
  raise ConfigError, "Environment #{e.path}: no servers" unless e.has_servers?
22
22
  end
23
23
 
24
+ visit Group do |g|
25
+ raise ConfigError, "Group #{g.path}: no servers" unless g.has_servers?
26
+ end
27
+
24
28
  visit Server do |s|
25
29
  if !String(s.global_alias).empty?
26
30
  if @global_server_aliases.key?(s.global_alias)
@@ -1,7 +1,9 @@
1
1
  require 'taketo/constructs'
2
2
 
3
3
  module Taketo
4
- def self.downcased_construct_class_name(klass)
4
+ extend self
5
+
6
+ def downcased_construct_class_name(klass)
5
7
  klass.name.gsub("Taketo::Constructs::", "").gsub(/[A-Z][^A-Z]*/) { |s| s.gsub("::", "").downcase + "_" }.chop
6
8
  end
7
9
 
@@ -4,6 +4,7 @@ require 'taketo/support'
4
4
  module Taketo
5
5
  module Constructs
6
6
  class Config < BaseConstruct
7
+ has_nodes :groups, :group
7
8
  has_nodes :projects, :project
8
9
  has_nodes :servers, :server
9
10
 
@@ -14,7 +15,7 @@ module Taketo
14
15
  end
15
16
 
16
17
  def has_servers?
17
- has_nodes?(:servers) || projects.any?(&:has_servers?)
18
+ has_deeply_nested_nodes?(:servers)
18
19
  end
19
20
  end
20
21
  end
@@ -6,6 +6,7 @@ module Taketo
6
6
  module Constructs
7
7
  class Environment < BaseConstruct
8
8
  has_nodes :servers, :server
9
+ has_nodes :groups, :group
9
10
 
10
11
  def initialize(name)
11
12
  super(name)
@@ -18,6 +19,14 @@ module Taketo
18
19
  ""
19
20
  end
20
21
  end
22
+
23
+ def rails_env
24
+ name.to_s
25
+ end
26
+
27
+ def has_servers?
28
+ has_deeply_nested_nodes?(:servers)
29
+ end
21
30
  end
22
31
  end
23
32
  end
@@ -0,0 +1,20 @@
1
+ require 'taketo/constructs/base_construct'
2
+ require 'taketo/support'
3
+
4
+ module Taketo
5
+ module Constructs
6
+ class Group < BaseConstruct
7
+ has_nodes :servers, :server
8
+
9
+ def rails_env
10
+ parent.rails_env if parent.respond_to?(:rails_env)
11
+ end
12
+
13
+ def has_servers?
14
+ has_deeply_nested_nodes?(:servers)
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+
@@ -6,9 +6,10 @@ module Taketo
6
6
  class Project < BaseConstruct
7
7
  has_nodes :environments, :environment
8
8
  has_nodes :servers, :server
9
+ has_nodes :groups, :group
9
10
 
10
11
  def has_servers?
11
- has_nodes?(:servers) || environments.any?(&:has_servers?)
12
+ has_deeply_nested_nodes?(:servers)
12
13
  end
13
14
  end
14
15
  end
@@ -21,7 +21,7 @@ module Taketo
21
21
 
22
22
  def parent=(parent)
23
23
  super
24
- env(:RAILS_ENV => parent.name.to_s) if parent.is_a?(Environment)
24
+ env(:RAILS_ENV => parent.rails_env) if parent.respond_to?(:rails_env)
25
25
  end
26
26
 
27
27
  def global_alias=(alias_name)
@@ -8,4 +8,5 @@ require 'taketo/constructs/config'
8
8
  require 'taketo/constructs/project'
9
9
  require 'taketo/constructs/environment'
10
10
  require 'taketo/constructs/server'
11
+ require 'taketo/constructs/group'
11
12
  require 'taketo/constructs/command'
@@ -23,6 +23,10 @@ module Taketo
23
23
  Constructs::Server.new(*args)
24
24
  end
25
25
 
26
+ def create_group(*args)
27
+ Constructs::Group.new(*args)
28
+ end
29
+
26
30
  def create_command(*args)
27
31
  Constructs::Command.new(*args)
28
32
  end
@@ -1,7 +1,7 @@
1
1
  module Taketo
2
2
  class DestinationMatcher
3
- def initialize(servers)
4
- @servers = servers
3
+ def initialize(nodes)
4
+ @nodes = nodes
5
5
  end
6
6
 
7
7
  def matches
@@ -11,11 +11,11 @@ module Taketo
11
11
  private
12
12
 
13
13
  def path_matches
14
- @servers.map(&:path)
14
+ @nodes.map(&:path)
15
15
  end
16
16
 
17
17
  def global_alias_matches
18
- @servers.map(&:global_alias).map(&:to_s).reject(&:empty?)
18
+ @nodes.select { |n| n.respond_to?(:global_alias) }.map(&:global_alias).map(&:to_s).reject(&:empty?)
19
19
  end
20
20
  end
21
21
  end