mattock 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c1151f03e2d5b1b2beae2dbe83fc913acc5781d
4
- data.tar.gz: 76e9f884109d43f50acfdf12683f8f8922492410
3
+ metadata.gz: 058ff110aa5e5ffd99da0527d769e565d2219fd1
4
+ data.tar.gz: 56845e99beb502e10826cd0baa17385ec49a66db
5
5
  SHA512:
6
- metadata.gz: 64dd7f1524c69be09ec730ef8d12493d0f0db779a08bac00b1acbf1e17eb9d5c69040cae92e5897faf25b4fb5845d850c3d6207ca11c51ceb145adf1dd5b218f
7
- data.tar.gz: 7bdd7d4d2c1010ea3fefad1fd0cf0641398207ff339dbc943bd0d2edadc6655baea1ed80f55ff1c074b40ee19f269acd958af36fd49f89d19d51fd59e34296c5
6
+ metadata.gz: 8c9ae840327f2fdf631b8505221b416fba46e2d635c928cfa9875225bb41ac0ace63261ad71c30891cc8f4a411a5466331da3ca325fdc107a8e3574b41392419
7
+ data.tar.gz: f31d1b3427076cf6fd81ec8dc4d7361bd4e4e7e949e2e0dd0b4810c6964a50654f19ffe65fa7cdcfc03ac9021aca8b58e396b594e4519a619bab9755dc055f13
@@ -15,6 +15,8 @@ module Mattock
15
15
  #
16
16
  # define
17
17
  #
18
+ #(see #setup_cascade)
19
+ #
18
20
  #Override those methods to adjust how a TaskLib processes its options
19
21
  #
20
22
  #The only method not defined here is {Configurable#setup_defaults}
@@ -63,7 +65,7 @@ module Mattock
63
65
  #Called after the configuration block has been called, so secondary
64
66
  #configurations can be set up. For instance, consider:
65
67
  #
66
- # self.command ||= bin_dir + command_name
68
+ # self.command = bin_dir + command_name if is_unset?(:command)
67
69
  #
68
70
  #The full path to the command could be set in the configuration block in
69
71
  #the Rakefile, or if bin_dir and command_name are set, we can put those
@@ -37,7 +37,11 @@ module Mattock
37
37
  end
38
38
  alias path_name pathname
39
39
 
40
- if (false)
40
+ def to_s
41
+ fail_unless_set(:absolute_path)
42
+ absolute_path
43
+ end
44
+
41
45
  def inspect
42
46
  "<path: #{
43
47
  if field_unset?(:absolute_path)
@@ -51,7 +55,6 @@ module Mattock
51
55
  end
52
56
  }>"
53
57
  end
54
- end
55
58
  end
56
59
 
57
60
  module ClassMethods
@@ -77,7 +80,6 @@ module Mattock
77
80
  end
78
81
  parent_field = path(field_name, rel_path)
79
82
 
80
- root_paths << parent_field
81
83
  self.path_heirarchy += args.map do |child_field|
82
84
  [parent_field, child_field]
83
85
  end
@@ -117,6 +119,7 @@ module Mattock
117
119
  end
118
120
 
119
121
  path_heirarchy.reverse.each do |parent_field, child_field|
122
+ next if missing_relatives.include?(parent_field)
120
123
  parent = parent_field.value_on(instance)
121
124
  resolve_path_on(instance, parent, child_field, missing_relatives)
122
125
  end
@@ -2,38 +2,49 @@ require 'rake/tasklib'
2
2
  require 'mattock/cascading-definition'
3
3
 
4
4
  module Mattock
5
- #Rake::Tasklib provides a common, well known way to generalize tasks and use
6
- #them in multiple projects.
5
+ # {Mattock::TaskLib} provides a base class to build tasklibs on so that you
6
+ # can get to what you care about, and get option validation as well.
7
7
  #
8
- #Typically, the #initialize method for CoolTask yields itself into the block
9
- #(so, 't' in the example) and then runs #define which does the heavy lifting
10
- #to actually create tasks and set them up with dependencies and whatnot.
8
+ # The convention that's added in Mattock is that Tasklibs are passed to each
9
+ # other as arguments, so that behavior can be composed out of modular
10
+ # components.
11
11
  #
12
- #Rake::Tasklib doesn't really provide much in the way of help or guidance
13
- #about how to do this, though, and everyone winds up having to do a lot of
14
- #the same work.
12
+ # To define a new task lib: subclass {TaskLib}, add some ::setting calls, and
13
+ # override #define to add some tasks.
15
14
  #
16
- #Mattock::TaskLib provides a base class to build tasklibs on so that you can
17
- #get to what you care about, and get option validation as well.
15
+ # To use your tasklib, instantiate with a block, optionally passing other
16
+ # task libs to copy configuration from.
18
17
  #
19
- #The convention that's added in Mattock is that Tasklibs are passed to each
20
- #other as arguments, so that behavior can be composed out of modular
21
- #components.
18
+ # @example
19
+ # class CoolTask < Mattock::TaskLib
20
+ # settings :option_one, :option_two
22
21
  #
23
- #@example
24
- # CoolTask.new(:args) do |t|
25
- # t.option_one = "cool"
26
- # t.option_two = "very"
27
- # end
22
+ # default_namespace :be
28
23
  #
29
- #@example Composition
30
- # transport = HTTPTasks.new do |t|
31
- # t.server = http://mycoolserver.com
32
- # end
24
+ # def define
25
+ # task :cool do
26
+ # puts "I am so #{option_one} #{option_two}"
27
+ # end
28
+ # end
29
+ # end
33
30
  #
34
- # UploadTasks.new(transport) do |t|
35
- # t.dir = "./source_dir"
36
- # end
31
+ # CoolTask.new(:args) do |t|
32
+ # t.option_one = "cool"
33
+ # t.option_two = "very"
34
+ # end
35
+ #
36
+ # @example
37
+ # > rake be:cool
38
+ # I am so very cool
39
+ #
40
+ # @example Composition
41
+ # transport = HTTPTasks.new do |t|
42
+ # t.server = http://mycoolserver.com
43
+ # end
44
+ #
45
+ # UploadTasks.new(transport) do |t|
46
+ # t.dir = "./source_dir"
47
+ # end
37
48
  #
38
49
  #The configuration handling is provided by {CascadingDefinition}, and
39
50
  #configuration options are built using {Configurable}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mattock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Judson Lester
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-22 00:00:00.000000000 Z
11
+ date: 2014-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: corundum
@@ -145,7 +145,7 @@ rdoc_options:
145
145
  - --main
146
146
  - doc/README
147
147
  - --title
148
- - mattock-0.8.0 RDoc
148
+ - mattock-0.9.0 RDoc
149
149
  require_paths:
150
150
  - lib/
151
151
  required_ruby_version: !ruby/object:Gem::Requirement