detroit 0.2.0 → 0.3.0
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/.ruby +13 -12
- data/COPYING.rdoc +686 -5
- data/EXAMPLE.md +24 -24
- data/HISTORY.rdoc +16 -0
- data/README.rdoc +3 -10
- data/lib/detroit.rb +1 -1
- data/lib/detroit.yml +13 -12
- data/lib/detroit/application.rb +11 -6
- data/lib/detroit/custom.rb +33 -11
- data/lib/detroit/service.rb +21 -138
- data/lib/detroit/tool.rb +78 -14
- metadata +11 -32
- data/GPL3.txt +0 -675
- data/QED.rdoc +0 -87
- data/qed/01_assembly/02_initialize.md +0 -57
- data/qed/99_plugins/rdoc/rdoc-plugin.rdoc +0 -22
- data/qed/99_plugins/rdoc/sample/Syckfile +0 -6
- data/qed/99_plugins/rdoc/sample/lib/sandbox/.xxx +0 -1
- data/qed/99_plugins/rdoc/sample/lib/sandbox/hello.rb +0 -5
- data/qed/99_plugins/rdoc/sample/lib/sandbox/xxx.rb +0 -6
- data/qed/99_plugins/rdoc/sample/lib/xxx/bye.rb +0 -4
- data/qed/99_plugins/rdoc/sample/meta/name +0 -1
- data/qed/99_plugins/rdoc/sample/meta/version +0 -1
- data/qed/samples/example_project/.ruby +0 -0
- data/qed/samples/example_project/Schedule +0 -9
- data/qed/samples/example_project/lib/foo/.xxx +0 -1
- data/qed/samples/example_project/lib/foo/hello.rb +0 -7
- data/qed/samples/example_project/lib/foo/xxx.rb +0 -6
- data/qed/samples/example_project/lib/foo/xxx/bye.rb +0 -4
- data/qed/samples/example_project/meta/name +0 -1
- data/qed/samples/example_project/meta/version +0 -1
- data/qed/samples/example_schedule.rb +0 -57
data/EXAMPLE.md
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
# Detroit
|
2
2
|
|
3
|
-
Detroit's main configuration file is called
|
3
|
+
Detroit's main configuration file is called an *assembly*. Assemblies define the
|
4
4
|
<i>service instances</i> that a project will utilize.
|
5
5
|
|
6
|
-
|
6
|
+
Assemblies can be written in a few different formats thanks to the flexibility
|
7
7
|
of Ruby. All formats are equivalent. Which format you use is strictly a regard
|
8
8
|
of your personal preference.
|
9
9
|
|
10
10
|
## Ruby-based Detroit
|
11
11
|
|
12
|
-
###
|
12
|
+
### Service Method Notation
|
13
13
|
|
14
|
-
Traditionally a Ruby-based
|
15
|
-
with an optional service instance name and a setter block.
|
14
|
+
Traditionally a Ruby-based assembly file is dominated by calls to the `service`
|
15
|
+
method with an optional service instance name and a setter block.
|
16
16
|
|
17
17
|
```ruby
|
18
18
|
service :myself do |s|
|
@@ -31,8 +31,9 @@ If no `service` setting is given, it is assumed to be same as the service instan
|
|
31
31
|
In the above example `rdoc` is taken to be both the service desired and the name of
|
32
32
|
this particular instance.
|
33
33
|
|
34
|
-
A few years ago, Sinatra came along and popularized the use of the `#set` method.
|
35
|
-
|
34
|
+
A few years ago, Sinatra came along and popularized the use of the `#set` method.
|
35
|
+
A simple addition to Detroit's assembly file parser now allows for the slightly
|
36
|
+
cleaner notation:
|
36
37
|
|
37
38
|
```ruby
|
38
39
|
service :myself do
|
@@ -71,12 +72,12 @@ definition to be written as simply as:
|
|
71
72
|
service :rdoc
|
72
73
|
```
|
73
74
|
|
74
|
-
###
|
75
|
+
### Service Name Notation
|
75
76
|
|
76
|
-
Thanks to some straight-forward meta-programming, a Ruby-based
|
77
|
-
be written in a more
|
77
|
+
Thanks to some straight-forward meta-programming, a Ruby-based assembly file can
|
78
|
+
be written in a more concise notation by using the name of the service class as a
|
78
79
|
method. This can be followed by a settings block, as with the above examples,
|
79
|
-
or passed a <i>settings hash</i>. In which case
|
80
|
+
or passed a <i>settings hash</i>. In which case an assembly file can look like this:
|
80
81
|
|
81
82
|
```ruby
|
82
83
|
Announce :mailto => "ruby-talk@ruby-lang.org",
|
@@ -113,16 +114,16 @@ need to define service instances. With Ruby 1.9 it can be even more conisce
|
|
113
114
|
using the new Hash syntax.
|
114
115
|
|
115
116
|
```ruby
|
116
|
-
Announce
|
117
|
-
|
118
|
-
|
119
|
-
|
117
|
+
Announce :myself,
|
118
|
+
mailto: "transfire@gmail.com",
|
119
|
+
priority: -1
|
120
|
+
active: true
|
120
121
|
```
|
121
122
|
|
122
|
-
But you might want to hold off on that a couple of years until Ruby 1.8 is pretty
|
123
|
-
shot and buried ;)
|
123
|
+
But you might want to hold off on that a couple of years until Ruby 1.8 is pretty
|
124
|
+
much shot and buried ;)
|
124
125
|
|
125
|
-
## YAML-based
|
126
|
+
## YAML-based Assembly Files
|
126
127
|
|
127
128
|
We have saved the most concise notation for last. The YAML format is
|
128
129
|
essentially the same as the traditional Ruby format except that
|
@@ -132,7 +133,7 @@ setting which defaults to the name. Also, notice the start document indicator
|
|
132
133
|
recognized as YAML, rather than Ruby.
|
133
134
|
|
134
135
|
```yaml
|
135
|
-
---
|
136
|
+
---
|
136
137
|
|
137
138
|
announce:
|
138
139
|
mailto: "transfire@gmail.com"
|
@@ -172,17 +173,16 @@ recognized as YAML, rather than Ruby.
|
|
172
173
|
sitemap:
|
173
174
|
site: <% name %>
|
174
175
|
active: false
|
175
|
-
```
|
176
176
|
|
177
177
|
As we can see in the last entry, the YAML format also supports ERB and provides
|
178
178
|
access to project metadata via the ERB's binding.
|
179
179
|
|
180
|
-
With the Ruby format it is easy enough to load external
|
180
|
+
With the Ruby format it is easy enough to load external library using
|
181
181
|
standard `require` and `load` methods. Since the YAML format supports ERB
|
182
182
|
it can be used to achieve the same effect.
|
183
183
|
|
184
|
-
```
|
185
|
-
---
|
186
|
-
<% require 'some/
|
184
|
+
```yaml
|
185
|
+
---
|
186
|
+
<% require 'some/external/library' %>
|
187
187
|
```
|
188
188
|
|
data/HISTORY.rdoc
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
= RELEASE HISTORY
|
2
2
|
|
3
|
+
== 0.3.0 / 2012-04-02
|
4
|
+
|
5
|
+
This significant release changes the interface for tools to tap
|
6
|
+
into the assembly line. Where as before specially named methods
|
7
|
+
in the form of `station_{stop}` were used, now two special methods
|
8
|
+
are expected `#assemble?` and `#assemble`. The first checks to see
|
9
|
+
if a particular stop is supported and the later is used to execute
|
10
|
+
it if it does.
|
11
|
+
|
12
|
+
Changes:
|
13
|
+
|
14
|
+
* Simplify the assembly interface for tools.
|
15
|
+
* Tool classes ending in Base are abstract base class.
|
16
|
+
* Add #on as alias from #track.
|
17
|
+
|
18
|
+
|
3
19
|
== 0.2.0 / 2011-10-19
|
4
20
|
|
5
21
|
The big news here is that Detroit configuration files are now
|
data/README.rdoc
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
= Detroit
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
{Homepage}[http://rubyworks.github.com/detroit] /
|
4
|
+
{Development}[http://github.com/rubyworks/detroit] /
|
5
|
+
{Mailing List}[http://googlegroups.com/group/rubyworks-mailinglist]
|
6
6
|
|
7
7
|
|
8
8
|
== DESCRIPTION
|
@@ -12,13 +12,6 @@ Detroit utilizes a life-cycle methodology to help developers prepare and
|
|
12
12
|
release Ruby software in a clear, repeatable, linear fashion.
|
13
13
|
|
14
14
|
|
15
|
-
== RESOURCES
|
16
|
-
|
17
|
-
* {Homepage}[http://rubyworks.github.com/detroit]
|
18
|
-
* {Development}[http://github.com/rubyworks/detroit]
|
19
|
-
* {Mailing List}[http://googlegroups.com/group/rubyworks-mailinglist]
|
20
|
-
|
21
|
-
|
22
15
|
== HOW IT WORKS
|
23
16
|
|
24
17
|
Detroit defines development processions which consist of a set of named
|
data/lib/detroit.rb
CHANGED
data/lib/detroit.yml
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
---
|
2
|
+
source:
|
3
|
+
- PROFILE
|
4
|
+
- meta
|
2
5
|
authors:
|
3
6
|
- name: Trans
|
4
7
|
email: transfire@gmail.com
|
@@ -6,8 +9,6 @@ copyrights:
|
|
6
9
|
- holder: Thomas Sawyer
|
7
10
|
year: '2007'
|
8
11
|
license: GPL3
|
9
|
-
replacements: []
|
10
|
-
conflicts: []
|
11
12
|
requirements:
|
12
13
|
- name: facets
|
13
14
|
- name: pom
|
@@ -16,6 +17,8 @@ requirements:
|
|
16
17
|
- test
|
17
18
|
development: true
|
18
19
|
dependencies: []
|
20
|
+
alternatives: []
|
21
|
+
conflicts: []
|
19
22
|
repositories:
|
20
23
|
- uri: http://github.com/proutils/detroit.git
|
21
24
|
scm: git
|
@@ -24,20 +27,18 @@ resources:
|
|
24
27
|
home: http://rubyworks.github.com/detroit
|
25
28
|
code: http://github.com/rubyworks/detroit
|
26
29
|
mail: http://groups.google.com/rubyworks-mailinglist
|
30
|
+
extra: {}
|
27
31
|
load_path:
|
28
32
|
- lib
|
29
|
-
extra: {}
|
30
|
-
source:
|
31
|
-
- PROFILE
|
32
|
-
alternatives: []
|
33
33
|
revision: 0
|
34
|
-
version: 0.2.0
|
35
|
-
date: '2011-10-18'
|
36
|
-
name: detroit
|
37
|
-
title: Detroit
|
38
|
-
summary: Software Production Mangement
|
39
34
|
created: '2007-10-10'
|
35
|
+
summary: Software Production Mangement
|
36
|
+
title: Detroit
|
37
|
+
version: 0.3.0
|
38
|
+
name: detroit
|
39
|
+
suite: detroit
|
40
40
|
description: Detroit is an advanced lifecycle build system. With Detroit, build tasks
|
41
41
|
are user defined service instances tied to stops along a track. Whenever the detroit
|
42
42
|
console command is run, a track is followed from beginning to designated destination.
|
43
|
-
organization:
|
43
|
+
organization: rubyworks
|
44
|
+
date: '2012-04-01'
|
data/lib/detroit/application.rb
CHANGED
@@ -233,6 +233,8 @@ module Detroit
|
|
233
233
|
|
234
234
|
@destination = stop
|
235
235
|
|
236
|
+
# TODO: Using #preconfigure as part of the protocol should probably change.
|
237
|
+
|
236
238
|
# prime the services (so as to fail early)
|
237
239
|
active_services.each do |srv|
|
238
240
|
srv.preconfigure if srv.respond_to?("preconfigure")
|
@@ -256,12 +258,13 @@ module Detroit
|
|
256
258
|
puts "\nFinished in #{stop_time - start_time} seconds." unless quiet?
|
257
259
|
end
|
258
260
|
|
259
|
-
# Execute service hook for given track and destination.
|
260
|
-
#--
|
261
261
|
# TODO: Deprecate service hooks?
|
262
|
+
|
263
|
+
#
|
264
|
+
# Execute service hook for given track and destination.
|
265
|
+
#
|
266
|
+
# @todo Currently only stop counts, maybe add track subdirs.
|
262
267
|
#
|
263
|
-
# TODO: Currently only stop counts, maybe add track subdirs.
|
264
|
-
#++
|
265
268
|
def service_hooks(track, stop)
|
266
269
|
#hook = dir + ("#{track}/#{stop}.rb".gsub('_', '-'))
|
267
270
|
dir = hook_directory
|
@@ -321,11 +324,13 @@ module Detroit
|
|
321
324
|
end
|
322
325
|
end
|
323
326
|
|
324
|
-
#
|
327
|
+
#
|
328
|
+
# Run a service given the service, track and stop name.
|
329
|
+
#
|
325
330
|
def run_a_service(srv, track, stop)
|
326
331
|
# run if the service supports the track and stop.
|
327
332
|
#if srv.respond_to?("#{track}_#{stop}")
|
328
|
-
if srv.stop?(stop)
|
333
|
+
if srv.stop?(stop, @destination)
|
329
334
|
if options[:trace] #options[:verbose]
|
330
335
|
#status_line("#{srv.key.to_s} (#{srv.class}##{track}_#{stop})", stop.to_s.gsub('_', '-').capitalize)
|
331
336
|
status_line("#{srv.key.to_s} (#{srv.class}##{stop})", stop.to_s.gsub('_', '-').capitalize)
|
data/lib/detroit/custom.rb
CHANGED
@@ -21,10 +21,12 @@ module Detroit
|
|
21
21
|
# Plural alias for #track.
|
22
22
|
alias_accessor :tracks, :track
|
23
23
|
|
24
|
+
alias_accessor :on, :track
|
25
|
+
|
24
26
|
private
|
25
27
|
|
26
28
|
SPECIAL_OPTIONS = %w{
|
27
|
-
service track tracks active priority project
|
29
|
+
service track tracks on active priority project
|
28
30
|
trial trace verbose force quiet
|
29
31
|
}
|
30
32
|
|
@@ -59,22 +61,42 @@ module Detroit
|
|
59
61
|
|
60
62
|
#
|
61
63
|
def method_missing(s, *a, &b)
|
62
|
-
if
|
63
|
-
|
64
|
+
if s.to_s.end_with?('=')
|
65
|
+
# stop = s.to_s.chomp('=')
|
66
|
+
# if !SPECIAL_OPTIONS.include?(stop)
|
67
|
+
# (class << self; self; end).module_eval %{
|
68
|
+
# def station_#{stop}
|
69
|
+
# #{a.first}
|
70
|
+
# end
|
71
|
+
# }
|
72
|
+
# end
|
64
73
|
else
|
65
|
-
|
74
|
+
if @context.respond_to?(s)
|
75
|
+
@context.__send__(s,*a,&b)
|
76
|
+
else
|
77
|
+
super(s, *a, &b)
|
78
|
+
end
|
66
79
|
end
|
67
80
|
end
|
68
81
|
|
69
|
-
|
70
|
-
|
71
|
-
#
|
72
|
-
#
|
73
|
-
# r = super(name)
|
74
|
-
# return r if r
|
75
|
-
# @context.respond_to?(s)
|
82
|
+
# @todo should only respond to stop names and special options.
|
83
|
+
#def respond_to?(s)
|
84
|
+
# return true if SPECIAL_OPTIONS.include?(s.to_s)
|
85
|
+
# return true
|
76
86
|
#end
|
77
87
|
|
88
|
+
# RUBY 1.9
|
89
|
+
def respond_to_missing?(name, privy)
|
90
|
+
#return true if name.to_s.start_with?('station_')
|
91
|
+
return true if name.to_s.end_with?('=')
|
92
|
+
return true if @context.respond_to?(name)
|
93
|
+
false
|
94
|
+
end
|
95
|
+
|
96
|
+
def inspect
|
97
|
+
"#<Custom @on=#{track.join(',')}>"
|
98
|
+
end
|
99
|
+
|
78
100
|
end
|
79
101
|
|
80
102
|
end
|
data/lib/detroit/service.rb
CHANGED
@@ -1,14 +1,9 @@
|
|
1
1
|
module Detroit
|
2
2
|
|
3
|
-
#
|
4
|
-
#def self.services
|
5
|
-
# @registry ||= {}
|
6
|
-
#end
|
7
|
-
|
8
|
-
# Service class wraps a Tool instance when it is made
|
9
|
-
# part of an assembly.
|
10
|
-
#
|
11
3
|
# TODO: Need to work on how to limit a service's tracks per-assembly.
|
4
|
+
|
5
|
+
# Service class wraps a Tool instance when it is made part of an assembly.
|
6
|
+
#
|
12
7
|
class Service
|
13
8
|
attr :key
|
14
9
|
attr :tracks
|
@@ -17,23 +12,31 @@ module Detroit
|
|
17
12
|
attr :service
|
18
13
|
#attr :options
|
19
14
|
|
15
|
+
#
|
20
16
|
# Set the priority. Priority determines the order which
|
21
17
|
# services on the same stop are run.
|
18
|
+
#
|
22
19
|
def priority=(integer)
|
23
20
|
@priority = integer.to_i
|
24
21
|
end
|
25
22
|
|
23
|
+
#
|
26
24
|
# Set the tracks a service will be available on.
|
25
|
+
#
|
27
26
|
def tracks=(list)
|
28
27
|
@tracks = list.to_list
|
29
28
|
end
|
30
29
|
|
30
|
+
#
|
31
|
+
#
|
31
32
|
#
|
32
33
|
def active=(boolean)
|
33
34
|
@active = !!boolean
|
34
35
|
end
|
35
36
|
|
37
|
+
#
|
36
38
|
# Create new ServiceWrapper.
|
39
|
+
#
|
37
40
|
def initialize(key, service_class, options)
|
38
41
|
@key = key
|
39
42
|
|
@@ -49,147 +52,27 @@ module Detroit
|
|
49
52
|
@service = service_class.new(options)
|
50
53
|
end
|
51
54
|
|
52
|
-
# Does the service support the given stop.
|
53
|
-
def stop?(name)
|
54
|
-
@service.respond_to?("station_#{name}")
|
55
|
-
end
|
56
|
-
|
57
|
-
# Run the service stop procedure.
|
58
|
-
def invoke(name, stop=nil)
|
59
|
-
sm = @service.method("station_#{name}") # public_send
|
60
|
-
sm.arity == 0 ? sm.call : sm.call(stop)
|
61
|
-
end
|
62
|
-
|
63
55
|
#
|
64
|
-
|
65
|
-
|
56
|
+
# Does the service support the given assembly station?
|
57
|
+
#
|
58
|
+
def stop?(station, stop=nil)
|
59
|
+
@service.assemble?(station.to_sym, :destination=>stop.to_sym)
|
66
60
|
end
|
67
61
|
|
68
62
|
#
|
69
|
-
#
|
70
|
-
# define_method("assembly_#{name}") do
|
71
|
-
# __send__(method || name) # public_send
|
72
|
-
# end
|
73
|
-
#end
|
74
|
-
end
|
75
|
-
|
76
|
-
end
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
=begin
|
81
|
-
# Mixin module is added to Service and Tool.
|
82
|
-
module Serviceable
|
83
|
-
|
63
|
+
# Run the service assembly station procedure.
|
84
64
|
#
|
85
|
-
def
|
86
|
-
|
87
|
-
base.extend DomainLanguage
|
88
|
-
end
|
89
|
-
|
90
|
-
# Register new instance of the Service class.
|
91
|
-
module ClassRegistry
|
92
|
-
|
93
|
-
# Class-level attribute of registered Service subclasses.
|
94
|
-
#
|
95
|
-
# Returns a Hash.
|
96
|
-
def registry
|
97
|
-
Detroit.services
|
98
|
-
end
|
99
|
-
|
100
|
-
# TODO: Probably should make a named registry instead.
|
101
|
-
def inherited(base)
|
102
|
-
return if base.name.to_s.empty?
|
103
|
-
if base.name !~ /Service$/
|
104
|
-
registry[base.basename.downcase] = base
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
# Returns a Class which is a new subclass of the current class.
|
109
|
-
def factory(&block)
|
110
|
-
Class.new(self, &block)
|
111
|
-
end
|
112
|
-
|
113
|
-
#
|
114
|
-
def options(service_class=self)
|
115
|
-
service_class.instance_methods.
|
116
|
-
select{ |m| m.to_s =~ /\w+=$/ && !%w{taguri=}.include?(m.to_s) }.
|
117
|
-
map{ |m| m.to_s.chomp('=') }
|
118
|
-
end
|
119
|
-
|
120
|
-
end
|
121
|
-
|
122
|
-
# Service Domain language. This module extends the Service class,
|
123
|
-
# to provide a convenience interface for defining stops.
|
124
|
-
module DomainLanguage
|
125
|
-
## TODO: Err.. Is this being used?
|
126
|
-
#def init(&block)
|
127
|
-
# define_method(:init, &block)
|
128
|
-
#end
|
129
|
-
|
130
|
-
# Override the `tracks` method to limit the lines a service
|
131
|
-
# will work with by default. Generally this is not used,
|
132
|
-
# and a return value of +nil+ means all lines apply.
|
133
|
-
def tracks
|
134
|
-
end
|
135
|
-
|
136
|
-
# TODO: Perhaps deprecate this in favor of just defining an `availabe?`
|
137
|
-
# class method.
|
138
|
-
def available(&block)
|
139
|
-
@available = block if block
|
140
|
-
@available ||= nil
|
141
|
-
end
|
142
|
-
|
143
|
-
#
|
144
|
-
def available?(project)
|
145
|
-
return true unless available
|
146
|
-
@available.call(project)
|
147
|
-
end
|
65
|
+
def invoke(station, stop=nil)
|
66
|
+
@service.assemble(station.to_sym, :destination=>stop.to_sym)
|
148
67
|
end
|
149
68
|
|
150
|
-
#attr_reader :service_name
|
151
|
-
|
152
69
|
#
|
153
|
-
def service_title
|
154
|
-
self.class.name
|
155
|
-
end
|
156
|
-
|
157
|
-
# TODO: Is this being used?
|
158
|
-
#def service_actions
|
159
|
-
# self.class.service_actions
|
160
|
-
#end
|
161
|
-
|
162
70
|
#
|
163
|
-
#def inspect
|
164
|
-
# "<#{self.class}:#{object_id}>"
|
165
|
-
#end
|
166
|
-
end
|
167
|
-
|
168
|
-
# The Service class is the base class for defining basic or delgated services.
|
169
|
-
class Service
|
170
|
-
include Serviceable
|
171
|
-
|
172
71
|
#
|
173
|
-
|
174
|
-
|
175
|
-
def initialize(options={})
|
176
|
-
@options = options
|
72
|
+
def inspect
|
73
|
+
"<#{self.class}:#{object_id} @key='#{key}'>"
|
177
74
|
end
|
178
|
-
end
|
179
|
-
|
180
75
|
|
181
|
-
end
|
76
|
+
end
|
182
77
|
|
183
|
-
# Provides a clean namespace for creating services.
|
184
|
-
module Detroit::Plugins
|
185
|
-
Service = Detroit::Service
|
186
|
-
Tool = Detroit::Tool
|
187
78
|
end
|
188
|
-
|
189
|
-
=end
|
190
|
-
|
191
|
-
# TOPLEVEL DSL?
|
192
|
-
#def service(name, &block)
|
193
|
-
# #Detroit.services[name] = Service.factory(&block)
|
194
|
-
# Detroit::Service.registry[name.to_s] = Detroit::Service.factory(&block)
|
195
|
-
#end
|