mattock 0.2.12 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/doc/README +53 -2
- data/lib/mattock/configurable.rb +4 -1
- data/lib/mattock/task.rb +1 -1
- data/lib/mattock/tasklib.rb +9 -8
- metadata +10 -10
data/doc/README
CHANGED
@@ -1,2 +1,53 @@
|
|
1
|
-
==
|
2
|
-
===
|
1
|
+
== Mattock
|
2
|
+
=== A powerful companion to Rake
|
3
|
+
|
4
|
+
The goal for Mattock is to be able to build configurable, composable tasklibs
|
5
|
+
for Rake quickly, and get validation that they're working properly.
|
6
|
+
|
7
|
+
Throughout, the goal has been to lean hard on straight up Ruby, with as little
|
8
|
+
metaprogrammitic DSL nonsense as I could get away with.
|
9
|
+
|
10
|
+
In fact, basically the only DSL stuff in Mattock are settings for Tasklibs.
|
11
|
+
The gory details are in {Mattock::Configurable}. Inheritable, defaultable,
|
12
|
+
verifying, copyable settings. Nothing you haven't seen done before.
|
13
|
+
|
14
|
+
=== Tasklibs
|
15
|
+
|
16
|
+
The upshot of Mattock is being able to build Rake Tasklibs so that you can do
|
17
|
+
things like:
|
18
|
+
|
19
|
+
tk = Toolkit.new do |tk|
|
20
|
+
tk.file_lists.project = [__FILE__]
|
21
|
+
end
|
22
|
+
|
23
|
+
tk.in_namespace do
|
24
|
+
vc = Git.new(tk) do
|
25
|
+
|vc| vc.branch = "master"
|
26
|
+
end
|
27
|
+
task tk.finished_files.build => vc["is_checked_in"]
|
28
|
+
end
|
29
|
+
|
30
|
+
Things of note there: the "Git" tasklib takes the Toolkit tasklib as an
|
31
|
+
argument. Git can pull out settings from Toolkit. (Conversely, that means as
|
32
|
+
these tasklibs are designed, common settings can be pulled up into parent
|
33
|
+
tasklibs.) Libs with related concerns can get hooked together and still remain
|
34
|
+
loosely coupled.
|
35
|
+
|
36
|
+
Also note that Toolkit has a nested setting - settings can be arranged in
|
37
|
+
namespaces, however that makes sense.
|
38
|
+
|
39
|
+
{Mattock::TaskLib} also codifies the typical pattern with Rake tasklibs: setup
|
40
|
+
default configuration, yield self, confirm configs, define tasks.
|
41
|
+
Configuration is held in "settings," which mean defaults are easier to track,
|
42
|
+
complex configs can be resolved after setup, and required values automatically
|
43
|
+
confirmed.
|
44
|
+
|
45
|
+
A nice side effect is that "misconfiguration" - i.e. assigning a
|
46
|
+
value to the wrong name - gets caught really quickly, which you come to
|
47
|
+
appreciate in complex Rakefiles.
|
48
|
+
|
49
|
+
=== Tasks
|
50
|
+
|
51
|
+
{Mattock::Task} defines subclasses of Rake tasks - they can do all the
|
52
|
+
configuration that Mattock::TaskLib can, but they're just tasks. Crucially,
|
53
|
+
details about whether they're needed can be overriden. Occasionally handy.
|
data/lib/mattock/configurable.rb
CHANGED
@@ -5,6 +5,9 @@ module Mattock
|
|
5
5
|
#nil). Settings and their defaults are inherited (and can be overridden) by
|
6
6
|
#subclasses.
|
7
7
|
#
|
8
|
+
#Mattock also includes a yard-extension that will document settings of a
|
9
|
+
#Configurable
|
10
|
+
#
|
8
11
|
#@example (see ClassMethods)
|
9
12
|
module Configurable
|
10
13
|
RequiredField = Object.new
|
@@ -22,7 +25,7 @@ module Mattock
|
|
22
25
|
#Describes class level DSL & machinery for working with configuration
|
23
26
|
#managment.
|
24
27
|
#
|
25
|
-
#@example
|
28
|
+
#@example
|
26
29
|
# class ConfExample
|
27
30
|
# include Configurable
|
28
31
|
#
|
data/lib/mattock/task.rb
CHANGED
data/lib/mattock/tasklib.rb
CHANGED
@@ -3,13 +3,7 @@ require 'mattock/cascading-definition'
|
|
3
3
|
|
4
4
|
module Mattock
|
5
5
|
#Rake::Tasklib provides a common, well known way to generalize tasks and use
|
6
|
-
#them in multiple projects.
|
7
|
-
#like:
|
8
|
-
#
|
9
|
-
# CoolTask.new(:args) do |t|
|
10
|
-
# t.option_one = "cool"
|
11
|
-
# t.option_two = "very"
|
12
|
-
# end
|
6
|
+
#them in multiple projects.
|
13
7
|
#
|
14
8
|
#Typically, the #initialize method for CoolTask yields itself into the block
|
15
9
|
#(so, 't' in the example) and then runs #define which does the heavy lifting
|
@@ -24,8 +18,15 @@ module Mattock
|
|
24
18
|
#
|
25
19
|
#The convention that's added in Mattock is that Tasklibs are passed to each
|
26
20
|
#other as arguments, so that behavior can be composed out of modular
|
27
|
-
#components
|
21
|
+
#components.
|
22
|
+
#
|
23
|
+
#@example
|
24
|
+
# CoolTask.new(:args) do |t|
|
25
|
+
# t.option_one = "cool"
|
26
|
+
# t.option_two = "very"
|
27
|
+
# end
|
28
28
|
#
|
29
|
+
#@example Composition
|
29
30
|
# transport = HTTPTasks.new do |t|
|
30
31
|
# t.server = http://mycoolserver.com
|
31
32
|
# end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mattock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.13
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: corundum
|
16
|
-
requirement: &
|
16
|
+
requirement: &76587950 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.0.1
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *76587950
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: valise
|
27
|
-
requirement: &
|
27
|
+
requirement: &76587340 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0.6'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *76587340
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: tilt
|
38
|
-
requirement: &
|
38
|
+
requirement: &76587100 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>'
|
@@ -45,7 +45,7 @@ dependencies:
|
|
45
45
|
- 0
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *76587100
|
49
49
|
description: ! " If Rake won't do it by itself, you oughtta Mattock.\n\n If you
|
50
50
|
survived the pun, you might enjoy this gem.\n\n Features:\n\n * Extensions to
|
51
51
|
Tasklibs to support powerful deerpaths.\n * A commandline library that supports
|
@@ -98,7 +98,7 @@ rdoc_options:
|
|
98
98
|
- --main
|
99
99
|
- doc/README
|
100
100
|
- --title
|
101
|
-
- mattock-0.2.
|
101
|
+
- mattock-0.2.13 RDoc
|
102
102
|
require_paths:
|
103
103
|
- lib/
|
104
104
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -109,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
109
|
version: '0'
|
110
110
|
segments:
|
111
111
|
- 0
|
112
|
-
hash:
|
112
|
+
hash: 332286803
|
113
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
114
|
none: false
|
115
115
|
requirements:
|