do 0.2.0.e → 0.2.0.f

Sign up to get free protection for your applications and to get access to all the features.
data/lib/do/commands.rb CHANGED
@@ -11,17 +11,13 @@ module DO
11
11
  def servers
12
12
  @_servers ||= []
13
13
  end
14
-
15
- def all_remotes
16
- servers.map(&:name)
17
- end
14
+ alias :all_remotes :servers
18
15
 
19
16
  def remotes
20
17
  @_remotes ||= begin
21
18
  name = ARGV[0]
22
19
  servers.select { |s| s.name.to_s == name } + servers.select { |s| s.role.to_s == name }
23
20
  end
24
- @_remotes.map(&:name)
25
21
  end
26
22
  alias :remote :remotes
27
23
 
@@ -78,7 +74,6 @@ module DO
78
74
  def load_recipe(path)
79
75
  instance_eval(File.read(path), __FILE__, __LINE__)
80
76
  end
81
- alias :load :load_recipe
82
77
 
83
78
  def role(name)
84
79
  servers_was = servers.dup
@@ -86,7 +81,7 @@ module DO
86
81
  (servers-servers_was).each do |s|
87
82
  s.instance_variable_set(:'@role', name)
88
83
  end
89
- set name, servers.select { |s| s.role == name }.map(&:name)
84
+ set name, servers.select { |s| s.role == name }
90
85
  end
91
86
 
92
87
  def roles
@@ -107,7 +102,7 @@ module DO
107
102
  servers.push(DO::Server.new(name, host, user, options))
108
103
  current = servers[-1]
109
104
  set current.name, current
110
- set current.role, servers.select { |s| s.role == current.role }.map(&:name) if current.role
105
+ set current.role, servers.select { |s| s.role == current.role } if current.role
111
106
  task name do |opts, b|
112
107
  @_current_server = servers.find { |s| s.name == current.name }
113
108
  begin
data/lib/do/parser.rb CHANGED
@@ -31,7 +31,7 @@ module DO
31
31
  when /^false$/i then options[k] = false
32
32
  when /^\d+$/ then options[k] = v.to_i
33
33
  when /^[\d\.]+$/ then options[k] = v.to_f
34
- when /,/ then options[k] = v.split(",")
34
+ when /,/ then options[k] = v.split(",").map(&:strip)
35
35
  end
36
36
  end
37
37
 
data/lib/do/server.rb CHANGED
@@ -113,15 +113,17 @@ module DO
113
113
  ##
114
114
  # Returns true if a given file exist on the remote server
115
115
  #
116
- def exist?(file)
117
- run("test -e #{file} && echo True", :hidden => true) == "True"
116
+ def exist?(file, options={})
117
+ options = { :hidden => true }.merge(options)
118
+ run("test -e #{file} && echo True", options) == "True"
118
119
  end
119
120
 
120
121
  ##
121
122
  # Return the content of a given file
122
123
  #
123
- def cat(file)
124
- run("cat #{file}", :silent => true)
124
+ def cat(file, options={})
125
+ options = { :hidden => true }.merge(options)
126
+ run("cat #{file}", options)
125
127
  end
126
128
 
127
129
  ##
data/lib/do/tasks.rb CHANGED
@@ -53,8 +53,8 @@ module DO
53
53
  task[:block].arity == 1 ? task[:block].call(opts) : task[:block].call if task[:block]
54
54
  else
55
55
  task[:in] = send(task[:in][0]) if task[:in].size == 1 && (class << self; self; end).method_defined?(task[:in][0])
56
- task[:in] = task[:in].name if task[:in].is_a?(DO::Server)
57
56
  Array(task[:in]).each do |d|
57
+ d = d.is_a?(DO::Server) ? d.name : d
58
58
  parent = task_find(d)
59
59
  case parent[:block].arity
60
60
  when 1 then parent[:block].call(task[:block])
data/lib/do/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module DO
2
- VERSION = '0.2.0.e' unless defined?(DO::VERSION)
2
+ VERSION = '0.2.0.f' unless defined?(DO::VERSION)
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: do
3
3
  version: !ruby/object:Gem::Version
4
- hash: 54
4
+ hash: 55
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
9
  - 0
10
- - e
11
- version: 0.2.0.e
10
+ - f
11
+ version: 0.2.0.f
12
12
  platform: ruby
13
13
  authors:
14
14
  - Davide D'Agostino
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-12-03 00:00:00 +01:00
19
+ date: 2011-12-27 00:00:00 +01:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency