kiel 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/kiel.rb +17 -4
  2. metadata +3 -3
@@ -24,7 +24,7 @@ module Kiel
24
24
  DEFAULT_OPTIONS = {}
25
25
  RECOGNIZED_OPTIONS = [ :scm, :cloud, :setup, :base_image, :root_dir ]
26
26
 
27
- class Implementation
27
+ class Implementation # :nodoc: all
28
28
  def initialize defaults
29
29
  @defaults = defaults.dup
30
30
  end
@@ -51,6 +51,7 @@ module Kiel
51
51
  @defaults[ :setup ] ||= Setup::Capistrano.new
52
52
  end
53
53
 
54
+ # fully expands the given file_name or array of file names
54
55
  def expand_path file_name
55
56
  @defaults[ :root_dir ] ||= Dir.pwd
56
57
 
@@ -78,7 +79,9 @@ module Kiel
78
79
  { :tags => build_tags( step, steps ) }
79
80
  end
80
81
  end
81
-
82
+
83
+ # this function creates the rake task, by first checking if the image already exists and then starting the
84
+ # base image and running the setup step
82
85
  def create_task step, steps
83
86
  task = Rake::Task::define_task( step[ :task ] => steps.collect{ | s | s[ :task ] } ) do | task, arguments |
84
87
  tags = build_tags step, steps
@@ -131,6 +134,10 @@ module Kiel
131
134
  }
132
135
  end
133
136
 
137
+ def self.default_setup_name step
138
+ step[ :scm_name ] == '*' ? "#{step[ :name ]}.rb" : [ step[ :scm_name ] ].flatten.first
139
+ end
140
+
134
141
  def self.expand_steps steps
135
142
  raise ArgumentError, "no steps given" if steps.empty?
136
143
 
@@ -162,7 +169,7 @@ module Kiel
162
169
  }.merge step
163
170
  end.collect do | step |
164
171
  {
165
- :setup_name => step[ :scm_name ] == '*' ? "#{step[ :name ]}.rb" : step[ :scm_name ]
172
+ :setup_name => default_setup_name( step )
166
173
  }.merge step
167
174
  end
168
175
 
@@ -187,9 +194,15 @@ module Kiel
187
194
  # :scm_name:: The name that is passed to the source code management to determine the version of the description
188
195
  # of the step. If not given, +name+ is expanded to +name.rb+ in the current directory. For the first
189
196
  # element this defaults to '*', which is a special notation for the latest version of the repository.
197
+ #
198
+ # It's possible for :scm_name to be an array of file names. This results in an execution of the step,
199
+ # when every any of the listed file changed.
190
200
  #
191
201
  # :setup_name:: The name of the script to be executed. This defaults to :scm_name if given and not '*' or to
192
- # :name + '.rb'
202
+ # :name + '.rb'. If :scm_name is an array, :setup_name defaults to the first element of the array.
203
+ #
204
+ # So :scm_name => [ 'run_bundler.rb', 'Gemfile', 'Gemfile.lock' ] would default to execute
205
+ # 'run_bundler.rb'
193
206
  #
194
207
  # :description:: Optional description for the task to be created.
195
208
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kiel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
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-09-19 00:00:00.000000000 Z
12
+ date: 2012-11-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name:
@@ -65,7 +65,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
65
65
  version: '0'
66
66
  segments:
67
67
  - 0
68
- hash: 3859630591217512451
68
+ hash: -4037234922454547452
69
69
  required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  none: false
71
71
  requirements: