do 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 0.1.1 - August 14, 2011
2
+
3
+ * Remove rake dependency
4
+ * Simpler way to manage remote servers
5
+ * Simpler way to manage local machine
6
+ * Argument parser
7
+ * Fixed problem with ordered hash
8
+ * Allow to run dependencies in same contest
9
+
1
10
  ## 0.0.2 - August 9, 2011
2
11
 
3
12
  * Added `doit do:setup` task that generate a template in `~./do/dorc`
data/lib/do/commands.rb CHANGED
@@ -96,7 +96,7 @@ module DO
96
96
  def plugin(name, repo)
97
97
  desc "install #{name} plugin"
98
98
  namespace :plugin do
99
- task(name => :setup) do
99
+ task(name => 'setup') do
100
100
  log "\e[36m## Installing plugin %s\e[0m" % name
101
101
  Dir.mkdir(DO_PATH) unless File.exist?(DO_PATH)
102
102
  path = File.join(DO_PATH, '%s.rake' % name)
data/lib/do/tasks.rb CHANGED
@@ -20,15 +20,22 @@ module DO
20
20
  end
21
21
 
22
22
  def task(name, options={}, &block)
23
- name, deps = name.is_a?(Hash) ? [name.keys[0], Array(name.values[0])] : [name, []]
24
- tasks << options.merge({
23
+ name, deps, options = *case name
24
+ when Hash
25
+ in_was = name.delete(:in)
26
+ name_and_deps = name.shift
27
+ name.merge!(:in => in_was) if in_was
28
+ name_and_deps.push(name)
29
+ else [name, [], options]
30
+ end
31
+ tasks.push(options.merge({
25
32
  :name => name.to_s,
26
33
  :desc => @_desc.to_s,
27
- :deps => deps,
34
+ :deps => Array(deps),
28
35
  :namespace => @_namespace.to_s,
29
36
  :block => block,
30
37
  :in => Array(options[:in])
31
- })
38
+ }))
32
39
  tasks[-1]
33
40
  ensure
34
41
  @_desc = nil
@@ -38,7 +45,10 @@ module DO
38
45
  args_was = args.dup
39
46
  task = task_find(args.shift)
40
47
  opts = DO::Parser.new(*args)
41
- task[:deps].each { |d| task_run(*args.unshift(d).push('--dependency')) }
48
+ task[:deps].each do |dep|
49
+ name = dep.is_a?(Symbol) && task[:namespace] != '' ? '%s:%s' % [task[:namespace], dep] : dep
50
+ task_run(*args.unshift(name).push('--dependency'))
51
+ end
42
52
  if task[:in].empty?
43
53
  task[:block].arity == 1 ? task[:block].call(opts) : task[:block].call if task[:block]
44
54
  else
data/lib/do/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module DO
2
- VERSION = "0.1.0" unless defined?(DO::VERSION)
2
+ VERSION = "0.1.1" unless defined?(DO::VERSION)
3
3
  end
@@ -153,5 +153,18 @@ describe DO::Commands do
153
153
  end
154
154
  cmd.task_run(:hostname, '--srv1')
155
155
  end
156
+
157
+ it 'should handle deps' do
158
+ cmd.server :sho0, 'sho0.lipsiasoft.biz', 'root', :keys => Dir['/Developer/keys/*.pem']
159
+ cmd.task(:dep){ @a=1 }
160
+ cmd.task :hostname => :dep, :in => :remote do |options|
161
+ cmd.run('hostname').should match(/sho0/)
162
+ @a.should == 1
163
+ end
164
+ cmd.tasks[-1][:name].should == 'hostname'
165
+ cmd.tasks[-1][:deps].should == [:dep]
166
+ cmd.tasks[-1][:in].should == [:remote]
167
+ cmd.task_run(:hostname)
168
+ end
156
169
  end # DO::Server
157
170
  end # DO::Commands
data/spec/tasks_spec.rb CHANGED
@@ -150,5 +150,14 @@ describe DO::Tasks do
150
150
  cmd.task(:demo => :demos)
151
151
  expect { cmd.task_run(:demo) }.to_not raise_error
152
152
  end
153
+
154
+ it 'should resolve dependency namespace' do
155
+ cmd.tasks.clear
156
+ cmd.namespace :ns do
157
+ cmd.task(:foo){@a=1}
158
+ cmd.task(:bar => :foo){ @a.should == 1 }
159
+ end
160
+ cmd.run_task('ns:bar')
161
+ end
153
162
  end
154
163
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Davide D'Agostino
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-08-14 00:00:00 +02:00
17
+ date: 2011-08-15 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency