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 +4 -4
- data/lib/mattock/cascading-definition.rb +3 -1
- data/lib/mattock/configurable/directory-structure.rb +6 -3
- data/lib/mattock/tasklib.rb +36 -25
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 058ff110aa5e5ffd99da0527d769e565d2219fd1
|
4
|
+
data.tar.gz: 56845e99beb502e10826cd0baa17385ec49a66db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
-
|
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
|
data/lib/mattock/tasklib.rb
CHANGED
@@ -2,38 +2,49 @@ require 'rake/tasklib'
|
|
2
2
|
require 'mattock/cascading-definition'
|
3
3
|
|
4
4
|
module Mattock
|
5
|
-
#
|
6
|
-
#
|
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
|
-
#
|
9
|
-
#
|
10
|
-
#
|
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
|
-
#
|
13
|
-
#
|
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
|
-
#
|
17
|
-
#
|
15
|
+
# To use your tasklib, instantiate with a block, optionally passing other
|
16
|
+
# task libs to copy configuration from.
|
18
17
|
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
18
|
+
# @example
|
19
|
+
# class CoolTask < Mattock::TaskLib
|
20
|
+
# settings :option_one, :option_two
|
22
21
|
#
|
23
|
-
|
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
|
-
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
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
|
-
#
|
35
|
-
#
|
36
|
-
#
|
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.
|
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-
|
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.
|
148
|
+
- mattock-0.9.0 RDoc
|
149
149
|
require_paths:
|
150
150
|
- lib/
|
151
151
|
required_ruby_version: !ruby/object:Gem::Requirement
|