detroit 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby +36 -38
- data/COPYING.rdoc +15 -11
- data/HISTORY.rdoc +20 -0
- data/QED.rdoc +87 -0
- data/README.rdoc +5 -5
- data/lib/detroit.rb +6 -9
- data/lib/detroit.yml +36 -38
- data/lib/detroit/application.rb +120 -89
- data/lib/detroit/assembly.rb +194 -55
- data/lib/detroit/assembly_system.rb +80 -0
- data/lib/detroit/config.rb +35 -29
- data/lib/detroit/control.rb +17 -12
- data/lib/detroit/core_ext.rb +0 -2
- data/lib/detroit/custom.rb +21 -6
- data/lib/detroit/service.rb +14 -7
- data/lib/detroit/standard_assembly.rb +5 -6
- data/lib/detroit/tool.rb +51 -36
- data/lib/detroit/tool/email_utils.rb +13 -11
- data/lib/detroit/tool/shell_utils.rb +88 -47
- data/qed/{01_schedule → 01_assembly}/02_initialize.md +0 -0
- metadata +62 -63
- data/lib/detroit/schedule.rb +0 -187
data/.ruby
CHANGED
@@ -1,45 +1,43 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
---
|
2
|
+
authors:
|
3
|
+
- name: Trans
|
4
|
+
email: transfire@gmail.com
|
5
|
+
copyrights:
|
6
|
+
- holder: Thomas Sawyer
|
7
|
+
year: '2007'
|
8
|
+
license: GPL3
|
9
|
+
replacements: []
|
10
|
+
conflicts: []
|
11
|
+
requirements:
|
11
12
|
- name: facets
|
12
|
-
version: 0+
|
13
|
-
group: []
|
14
|
-
|
15
13
|
- name: pom
|
16
|
-
version: 0+
|
17
|
-
group: []
|
18
|
-
|
19
14
|
- name: qed
|
20
|
-
|
21
|
-
group:
|
15
|
+
groups:
|
22
16
|
- test
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
contact: Trans <transfire@gmail.com>
|
31
|
-
created: 2007-10-10
|
32
|
-
copyright: Copyright (c) 2007 Thomas Sawyer
|
33
|
-
licenses:
|
34
|
-
- GPL3
|
35
|
-
authors:
|
36
|
-
- Thomas Sawyer
|
37
|
-
maintainers: []
|
38
|
-
|
39
|
-
resources:
|
17
|
+
development: true
|
18
|
+
dependencies: []
|
19
|
+
repositories:
|
20
|
+
- uri: http://github.com/proutils/detroit.git
|
21
|
+
scm: git
|
22
|
+
name: upstream
|
23
|
+
resources:
|
40
24
|
home: http://rubyworks.github.com/detroit
|
41
25
|
code: http://github.com/rubyworks/detroit
|
42
26
|
mail: http://groups.google.com/rubyworks-mailinglist
|
43
|
-
|
44
|
-
|
45
|
-
|
27
|
+
load_path:
|
28
|
+
- lib
|
29
|
+
extra: {}
|
30
|
+
source:
|
31
|
+
- PROFILE
|
32
|
+
alternatives: []
|
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
|
+
created: '2007-10-10'
|
40
|
+
description: Detroit is an advanced lifecycle build system. With Detroit, build tasks
|
41
|
+
are user defined service instances tied to stops along a track. Whenever the detroit
|
42
|
+
console command is run, a track is followed from beginning to designated destination.
|
43
|
+
organization: Detroit
|
data/COPYING.rdoc
CHANGED
@@ -2,18 +2,22 @@
|
|
2
2
|
|
3
3
|
== Detroit
|
4
4
|
|
5
|
-
Copyright (c) 2011 Thomas Sawyer
|
5
|
+
Copyright:: (c) 2011 Thomas Sawyer, Rubyworks
|
6
|
+
License:: GPL3
|
7
|
+
Website:: http://detroit.github.com
|
6
8
|
|
7
|
-
|
8
|
-
it under the terms of the GNU General Public License as published by
|
9
|
-
the Free Software Foundation, either version 3 of the License, or
|
10
|
-
(at your option) any later version.
|
9
|
+
Copyright (c) 2011 Thomas Sawyer
|
11
10
|
|
12
|
-
This program is
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
This program is free software: you can redistribute it and/or modify
|
12
|
+
it under the terms of the GNU General Public License as published by
|
13
|
+
the Free Software Foundation, either version 3 of the License, or
|
14
|
+
(at your option) any later version.
|
16
15
|
|
17
|
-
|
18
|
-
|
16
|
+
This program is distributed in the hope that it will be useful,
|
17
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19
|
+
GNU General Public License for more details.
|
20
|
+
|
21
|
+
You should have received a copy of the GNU General Public License
|
22
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
23
|
|
data/HISTORY.rdoc
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
= RELEASE HISTORY
|
2
2
|
|
3
|
+
== 0.2.0 / 2011-10-19
|
4
|
+
|
5
|
+
The big news here is that Detroit configuration files are now
|
6
|
+
called _assembly_ files, and no longer _schedule_ files. The
|
7
|
+
new term is much more fitting the general design and overall
|
8
|
+
nomenclature of the system. In addition a few general improvements
|
9
|
+
and bug fixes have been applied. In effect, this is probabaly the
|
10
|
+
first really usable public release of Detroit.
|
11
|
+
|
12
|
+
Changes:
|
13
|
+
|
14
|
+
* Schedule was renamed to Assembly.
|
15
|
+
* Add help system using man-pages.
|
16
|
+
* Put install phase before verify.
|
17
|
+
* Add custom method for Ruby-style assemblies.
|
18
|
+
* Rename ServiceWrapper to Service.
|
19
|
+
* Firm up standard IO API for tools.
|
20
|
+
* Fix --config output.
|
21
|
+
|
22
|
+
|
3
23
|
== 0.1.0 / 2011-06-29
|
4
24
|
|
5
25
|
Detroit is a lifecycle build system for Ruby. Detroit was originally
|
data/QED.rdoc
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
## initialize
|
2
|
+
|
3
|
+
Load schedule text written in Ruby DSL.
|
4
|
+
|
5
|
+
check do |ruby|
|
6
|
+
Detroit::Schedule.new(ruby)
|
7
|
+
end
|
8
|
+
|
9
|
+
ok <<-HERE
|
10
|
+
Email :myself do |s|
|
11
|
+
s.mailto = 'transfire@gmail.com'
|
12
|
+
s.active = true
|
13
|
+
end
|
14
|
+
|
15
|
+
Syntax do |s|
|
16
|
+
s.exclude = ['lib/plugins']
|
17
|
+
s.active = false
|
18
|
+
end
|
19
|
+
HERE
|
20
|
+
|
21
|
+
Load schedule from a file written in Ruby DSL.
|
22
|
+
|
23
|
+
check do |file|
|
24
|
+
path = File.join(root_dir, file)
|
25
|
+
Detroit::Schedule.new(File.new(path))
|
26
|
+
end
|
27
|
+
|
28
|
+
ok 'samples/example_schedule.rb'
|
29
|
+
|
30
|
+
Load schedule text written in YAML"
|
31
|
+
|
32
|
+
check do |yaml|
|
33
|
+
Detroit::Schedule.new(yaml)
|
34
|
+
end
|
35
|
+
|
36
|
+
ok <<-HERE
|
37
|
+
---
|
38
|
+
myself:
|
39
|
+
service: email
|
40
|
+
mailto : transfire@gmail.com
|
41
|
+
active : true
|
42
|
+
end
|
43
|
+
|
44
|
+
syntax:
|
45
|
+
exclude: [lib/plugins]
|
46
|
+
active : false
|
47
|
+
HERE
|
48
|
+
|
49
|
+
Load schedule from a file written in YAML.
|
50
|
+
|
51
|
+
check do |file|
|
52
|
+
path = File.join(root_dir, file)
|
53
|
+
Detroit::Schedule.new(File.new(path))
|
54
|
+
end
|
55
|
+
|
56
|
+
ok 'samples/example_schedule.yml'
|
57
|
+
|
58
|
+
|
59
|
+
= RDoc Plugin
|
60
|
+
|
61
|
+
The RDoc plugin should generate rdoc doumentation according
|
62
|
+
to the parameters provided.
|
63
|
+
|
64
|
+
Given a suitable project.
|
65
|
+
|
66
|
+
Dir.chdir 'sample'
|
67
|
+
|
68
|
+
Now if we run 'syckle document' on the sample project.
|
69
|
+
|
70
|
+
`detroit document`
|
71
|
+
|
72
|
+
The documentation should be generated as expected.
|
73
|
+
|
74
|
+
File.assert.directory?('doc/rdoc')
|
75
|
+
|
76
|
+
Lets clean up after ourselves.
|
77
|
+
|
78
|
+
FileUtils.rm_r 'doc'
|
79
|
+
Dir.chdir '..'
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
data/README.rdoc
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
= Detroit
|
2
2
|
|
3
3
|
Author:: Thomas Sawyer
|
4
|
-
|
4
|
+
License:: GPL v.3
|
5
5
|
Copyright:: (c) 2011 Rubyworks, Thomas Sawyer
|
6
6
|
|
7
7
|
|
8
8
|
== DESCRIPTION
|
9
9
|
|
10
10
|
Detroit is a software production management aid for Ruby developers.
|
11
|
-
Detroit utilizes a
|
11
|
+
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
|
|
@@ -124,10 +124,10 @@ and give Detroit a try please let us know of any issues you encounter.
|
|
124
124
|
|
125
125
|
== HISTORY
|
126
126
|
|
127
|
-
Detroit is actaully the offspring of Reap
|
127
|
+
Detroit is actaully the offspring of Reap v10, and was called Syckle for
|
128
128
|
a number of years as it matured. It represents many years of design considerations
|
129
|
-
(and reconsiderations)
|
130
|
-
which pre-dated Hoe, to the
|
129
|
+
(and reconsiderations) that evolved Reap from its simple Rake extension origins,
|
130
|
+
which pre-dated Hoe, to the life-cycle system it is today.
|
131
131
|
|
132
132
|
|
133
133
|
== COPYRIGHT & LICENSE
|
data/lib/detroit.rb
CHANGED
@@ -13,7 +13,7 @@ module Detroit
|
|
13
13
|
end
|
14
14
|
|
15
15
|
# TODO: Only here b/c of bug in Ruby 1.8.x
|
16
|
-
#VERSION = "0.
|
16
|
+
#VERSION = "0.2.0"
|
17
17
|
end
|
18
18
|
|
19
19
|
# Erb is used to to script YAML-based schedule files.
|
@@ -29,7 +29,7 @@ require 'yaml'
|
|
29
29
|
require 'ansi/terminal'
|
30
30
|
require 'ansi/code'
|
31
31
|
|
32
|
-
# The parallel gem is used to (optionally)
|
32
|
+
# The parallel gem is used to (optionally) multitask services.
|
33
33
|
begin
|
34
34
|
require 'parallel'
|
35
35
|
rescue LoadError
|
@@ -38,30 +38,27 @@ end
|
|
38
38
|
# POM is used to access project metadata.
|
39
39
|
require 'pom'
|
40
40
|
|
41
|
-
# Redtools provides the standard services.
|
42
|
-
require 'redtools'
|
43
|
-
|
44
41
|
# And all the rest is Detroit, baby.
|
45
42
|
if RUBY_VERSION > '1.9'
|
46
43
|
require_relative 'detroit/core_ext'
|
47
44
|
require_relative 'detroit/config'
|
48
45
|
require_relative 'detroit/service'
|
49
46
|
require_relative 'detroit/tool'
|
50
|
-
require_relative 'detroit/
|
47
|
+
require_relative 'detroit/assembly_system'
|
51
48
|
require_relative 'detroit/standard_assembly'
|
52
49
|
require_relative 'detroit/control'
|
53
50
|
require_relative 'detroit/application'
|
54
|
-
require_relative 'detroit/
|
51
|
+
require_relative 'detroit/assembly'
|
55
52
|
require_relative 'detroit/custom'
|
56
53
|
else
|
57
54
|
require 'detroit/core_ext'
|
58
55
|
require 'detroit/config'
|
59
56
|
require 'detroit/service'
|
60
57
|
require 'detroit/tool'
|
61
|
-
require 'detroit/
|
58
|
+
require 'detroit/assembly_system'
|
62
59
|
require 'detroit/standard_assembly'
|
63
60
|
require 'detroit/control'
|
64
61
|
require 'detroit/application'
|
65
|
-
require 'detroit/
|
62
|
+
require 'detroit/assembly'
|
66
63
|
require 'detroit/custom'
|
67
64
|
end
|
data/lib/detroit.yml
CHANGED
@@ -1,45 +1,43 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
---
|
2
|
+
authors:
|
3
|
+
- name: Trans
|
4
|
+
email: transfire@gmail.com
|
5
|
+
copyrights:
|
6
|
+
- holder: Thomas Sawyer
|
7
|
+
year: '2007'
|
8
|
+
license: GPL3
|
9
|
+
replacements: []
|
10
|
+
conflicts: []
|
11
|
+
requirements:
|
11
12
|
- name: facets
|
12
|
-
version: 0+
|
13
|
-
group: []
|
14
|
-
|
15
13
|
- name: pom
|
16
|
-
version: 0+
|
17
|
-
group: []
|
18
|
-
|
19
14
|
- name: qed
|
20
|
-
|
21
|
-
group:
|
15
|
+
groups:
|
22
16
|
- test
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
contact: Trans <transfire@gmail.com>
|
31
|
-
created: 2007-10-10
|
32
|
-
copyright: Copyright (c) 2007 Thomas Sawyer
|
33
|
-
licenses:
|
34
|
-
- GPL3
|
35
|
-
authors:
|
36
|
-
- Thomas Sawyer
|
37
|
-
maintainers: []
|
38
|
-
|
39
|
-
resources:
|
17
|
+
development: true
|
18
|
+
dependencies: []
|
19
|
+
repositories:
|
20
|
+
- uri: http://github.com/proutils/detroit.git
|
21
|
+
scm: git
|
22
|
+
name: upstream
|
23
|
+
resources:
|
40
24
|
home: http://rubyworks.github.com/detroit
|
41
25
|
code: http://github.com/rubyworks/detroit
|
42
26
|
mail: http://groups.google.com/rubyworks-mailinglist
|
43
|
-
|
44
|
-
|
45
|
-
|
27
|
+
load_path:
|
28
|
+
- lib
|
29
|
+
extra: {}
|
30
|
+
source:
|
31
|
+
- PROFILE
|
32
|
+
alternatives: []
|
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
|
+
created: '2007-10-10'
|
40
|
+
description: Detroit is an advanced lifecycle build system. With Detroit, build tasks
|
41
|
+
are user defined service instances tied to stops along a track. Whenever the detroit
|
42
|
+
console command is run, a track is followed from beginning to designated destination.
|
43
|
+
organization: Detroit
|
data/lib/detroit/application.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Detroit
|
2
2
|
|
3
|
-
#
|
4
|
-
|
3
|
+
# The default assembly system to use.
|
4
|
+
DEFAULT_ASSEMBLY_SYSTEM = :standard
|
5
5
|
|
6
6
|
# Application class is the main controller class for running
|
7
7
|
# a session of Detroit.
|
@@ -17,48 +17,75 @@ module Detroit
|
|
17
17
|
def initialize(options)
|
18
18
|
@options = options
|
19
19
|
#load_standard_plugins
|
20
|
+
|
21
|
+
self.skip = options[:skip]
|
22
|
+
self.quiet = options[:quiet]
|
23
|
+
self.system = options[:system]
|
24
|
+
self.multitask = options[:multitask]
|
25
|
+
self.assemblies = options[:assemblies]
|
20
26
|
end
|
21
27
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
#
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
#
|
28
|
+
# Quiet mode?
|
29
|
+
def quiet?
|
30
|
+
@quiet
|
31
|
+
end
|
32
|
+
|
33
|
+
# Set quiet mode.
|
34
|
+
def quiet=(boolean)
|
35
|
+
@quiet = !!boolean
|
36
|
+
end
|
37
|
+
|
38
|
+
# List of service names to skip.
|
39
|
+
def skip
|
40
|
+
@skip
|
41
|
+
end
|
42
|
+
|
43
|
+
# Set skip list.
|
44
|
+
def skip=(list)
|
45
|
+
@skip = list.to_list.map{ |s| s.downcase }
|
46
|
+
end
|
33
47
|
|
34
48
|
# The selected assembly system.
|
35
|
-
def
|
36
|
-
|
49
|
+
def system
|
50
|
+
@system
|
37
51
|
end
|
38
52
|
|
39
|
-
#
|
40
|
-
def
|
41
|
-
|
53
|
+
# Set assembly system to use.
|
54
|
+
def system=(name)
|
55
|
+
@system = (name || DEFAULT_ASSEMBLY_SYSTEM)
|
42
56
|
end
|
43
57
|
|
58
|
+
# Alias for #system.
|
59
|
+
alias :assembly_system :system
|
60
|
+
|
44
61
|
# Multitask mode?
|
45
62
|
def multitask?
|
46
|
-
|
63
|
+
@multitask
|
47
64
|
end
|
48
65
|
|
49
|
-
#
|
50
|
-
def
|
51
|
-
|
66
|
+
# Set multi-task mode.
|
67
|
+
def multitask=(boolean)
|
68
|
+
if boolean && !defined?(Parallel)
|
69
|
+
puts "Parallel gem must be installed to multitask."
|
70
|
+
@multitask = false
|
71
|
+
else
|
72
|
+
@multitask = boolean
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# List of assembly files to use.
|
77
|
+
def assemblies
|
78
|
+
@assemblies
|
52
79
|
end
|
53
80
|
|
54
81
|
#
|
55
|
-
def
|
56
|
-
@
|
82
|
+
def assemblies=(files)
|
83
|
+
@assemblies = files
|
57
84
|
end
|
58
85
|
|
59
86
|
# Detroit configuration.
|
60
87
|
def config
|
61
|
-
@config ||= Detroit::Config.new(
|
88
|
+
@config ||= Detroit::Config.new(assemblies)
|
62
89
|
end
|
63
90
|
|
64
91
|
# Provides access to the Project instance via `Detroit.project` class method.
|
@@ -73,14 +100,38 @@ module Detroit
|
|
73
100
|
config.defaults
|
74
101
|
end
|
75
102
|
|
76
|
-
#
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
103
|
+
# # Load standard plugins.
|
104
|
+
# def load_standard_plugins
|
105
|
+
# #::Plugin.find("detroit/*.rb").each do |file|
|
106
|
+
# Detroit.standard_plugins.each do |file|
|
107
|
+
# begin
|
108
|
+
# require(file)
|
109
|
+
# rescue => err
|
110
|
+
# $stderr.puts err if $DEBUG
|
111
|
+
# end
|
112
|
+
# end
|
113
|
+
# end
|
114
|
+
|
115
|
+
# Display detailed help for a given tool.
|
116
|
+
def display_help(name)
|
117
|
+
if not Detroit.tools.key?(name)
|
118
|
+
config.load_plugin(name)
|
119
|
+
end
|
120
|
+
tool = Detroit.tools[name]
|
121
|
+
if tool.respond_to?(:man_page)
|
122
|
+
Kernel.system "man #{tool.man_page}"
|
81
123
|
else
|
82
|
-
|
124
|
+
puts "Sorry, no detailed help available for `#{name}'."
|
83
125
|
end
|
126
|
+
end
|
127
|
+
|
128
|
+
# Generates a configuration template for particular tool.
|
129
|
+
# This is only used for reference purposes.
|
130
|
+
def config_template(name)
|
131
|
+
if not Detroit.tools.key?(name)
|
132
|
+
config.load_plugin(name)
|
133
|
+
end
|
134
|
+
list = {name => Detroit.tools[name]}
|
84
135
|
cfg = {}
|
85
136
|
list.each do |srv_name, srv_class|
|
86
137
|
attrs = srv_class.options #instance_methods.select{ |m| m.to_s =~ /\w+=$/ && !%w{taguri=}.include?(m.to_s) }
|
@@ -92,21 +143,28 @@ module Detroit
|
|
92
143
|
cfg
|
93
144
|
end
|
94
145
|
|
95
|
-
#
|
146
|
+
# TODO: Setup all services, then ween out inactive ones?
|
147
|
+
#def services
|
148
|
+
#end
|
149
|
+
|
150
|
+
# Active services are services defined in assembly files and do not
|
96
151
|
# have their active setting turned off.
|
97
152
|
#
|
98
153
|
# Returns Array of active services.
|
99
154
|
def active_services
|
100
155
|
@active_services ||= (
|
101
|
-
|
156
|
+
list = []
|
102
157
|
|
103
158
|
config.each do |key, opts|
|
104
|
-
next unless opts
|
105
|
-
|
106
|
-
# omit any service in the skip list
|
159
|
+
next unless opts
|
160
|
+
next unless opts['active'] != false
|
107
161
|
next if skip.include?(key.to_s)
|
108
162
|
|
109
|
-
tool_name = (
|
163
|
+
tool_name = (
|
164
|
+
opts.delete('tool') ||
|
165
|
+
opts.delete('service') ||
|
166
|
+
key
|
167
|
+
).to_s.downcase
|
110
168
|
|
111
169
|
unless Detroit.tools.key?(tool_name)
|
112
170
|
config.load_plugin(tool_name)
|
@@ -121,39 +179,21 @@ module Detroit
|
|
121
179
|
options = defaults[tool_name.downcase].to_h
|
122
180
|
options = options.merge(common_tool_options)
|
123
181
|
options = options.merge(opts)
|
124
|
-
|
125
|
-
|
126
|
-
activelist << ServiceWrapper.new(key, tool_class, options) #script,
|
182
|
+
|
183
|
+
list << Service.new(key, tool_class, options) #script,
|
127
184
|
#else
|
128
185
|
# warn "Service #{tool_class} is not available."
|
129
186
|
end
|
130
187
|
end
|
131
188
|
|
132
189
|
# sorting here trickles down to processing later
|
133
|
-
|
190
|
+
#list = list.sort_by{ |s| s.priority || 0 }
|
134
191
|
|
135
|
-
|
192
|
+
list
|
136
193
|
)
|
137
194
|
end
|
138
195
|
|
139
|
-
#
|
140
|
-
|
141
|
-
# Service configuration, from project's schedule file(s).
|
142
|
-
#
|
143
|
-
# Returns Hash of service name and settings.
|
144
|
-
#def service_configs
|
145
|
-
# config.services
|
146
|
-
#end
|
147
|
-
|
148
|
-
# Run individual detroit scripts.
|
149
|
-
#def runscript(script, stop)
|
150
|
-
# @config.services.clear
|
151
|
-
# @config.load_schedule_file(script)
|
152
|
-
# #@service_configs = load_service_configs(script)
|
153
|
-
# run(stop)
|
154
|
-
#end
|
155
|
-
|
156
|
-
# Start the run.
|
196
|
+
# Change direectory to project root and run.
|
157
197
|
def start(stop)
|
158
198
|
Dir.chdir(project.root) do # change into project directory
|
159
199
|
run(stop)
|
@@ -175,9 +215,9 @@ module Detroit
|
|
175
215
|
name = name.to_sym
|
176
216
|
stop = stop.to_sym if stop
|
177
217
|
|
178
|
-
assm = Detroit.
|
218
|
+
assm = Detroit.assembly_systems[system]
|
179
219
|
|
180
|
-
raise "Unkown assembly `#{
|
220
|
+
raise "Unkown assembly system `#{system}'" unless assm
|
181
221
|
|
182
222
|
track = assm.get_track(name, stop)
|
183
223
|
|
@@ -191,17 +231,14 @@ module Detroit
|
|
191
231
|
exit 0
|
192
232
|
end
|
193
233
|
|
234
|
+
@destination = stop
|
235
|
+
|
194
236
|
# prime the services (so as to fail early)
|
195
237
|
active_services.each do |srv|
|
196
238
|
srv.preconfigure if srv.respond_to?("preconfigure")
|
197
239
|
end
|
198
240
|
|
199
|
-
|
200
|
-
h = ["#{project.metadata.title} v#{project.metadata.version} [M]", "#{project.root}"]
|
201
|
-
else
|
202
|
-
h = ["#{project.metadata.title} v#{project.metadata.version}", "#{project.root}"]
|
203
|
-
end
|
204
|
-
status_header(*h)
|
241
|
+
status_header(*header_message)
|
205
242
|
|
206
243
|
start_time = Time.now
|
207
244
|
|
@@ -239,7 +276,7 @@ module Detroit
|
|
239
276
|
|
240
277
|
# Returns a project's Detroit hooks directory.
|
241
278
|
def hook_directory
|
242
|
-
|
279
|
+
project.root.glob("{.,}detroit/hooks").first
|
243
280
|
end
|
244
281
|
|
245
282
|
#
|
@@ -260,9 +297,12 @@ module Detroit
|
|
260
297
|
end
|
261
298
|
|
262
299
|
# Make service calls.
|
300
|
+
#
|
301
|
+
# This groups services by priority b/c groups of the same priority can be run
|
302
|
+
# in parallel if the multitask option is on.
|
263
303
|
def service_calls(track, stop)
|
264
304
|
prioritized_services = active_services.group_by{ |srv| srv.priority }.sort_by{ |k,v| k }
|
265
|
-
prioritized_services.each do |
|
305
|
+
prioritized_services.each do |priority, services|
|
266
306
|
## remove any services specified by the --skip option on the comamndline
|
267
307
|
#services = services.reject{ |srv| skip.include?(srv.key.to_s) }
|
268
308
|
## only servies that are on the track
|
@@ -286,36 +326,27 @@ module Detroit
|
|
286
326
|
# run if the service supports the track and stop.
|
287
327
|
#if srv.respond_to?("#{track}_#{stop}")
|
288
328
|
if srv.stop?(stop)
|
289
|
-
if options[:verbose]
|
329
|
+
if options[:trace] #options[:verbose]
|
290
330
|
#status_line("#{srv.key.to_s} (#{srv.class}##{track}_#{stop})", stop.to_s.gsub('_', '-').capitalize)
|
291
331
|
status_line("#{srv.key.to_s} (#{srv.class}##{stop})", stop.to_s.gsub('_', '-').capitalize)
|
292
332
|
else
|
293
333
|
status_line("#{srv.key.to_s}", stop.to_s.gsub('_', '-').capitalize)
|
294
334
|
end
|
295
335
|
#srv.__send__("#{track}_#{stop}")
|
296
|
-
srv.invoke(stop)
|
336
|
+
srv.invoke(stop, @destination)
|
297
337
|
end
|
298
338
|
end
|
299
339
|
|
300
|
-
#
|
301
|
-
# FIXME: stop_map is not defined.
|
302
|
-
def end_stops
|
303
|
-
(stop_map.keys - stop_map.values).compact
|
304
|
-
end
|
340
|
+
# --- Print Methods -------------------------------------------------------
|
305
341
|
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
display_action(act)
|
312
|
-
end
|
313
|
-
puts
|
342
|
+
def header_message
|
343
|
+
if multitask?
|
344
|
+
["#{project.metadata.title} v#{project.metadata.version} [M]", "#{project.root}"]
|
345
|
+
else
|
346
|
+
["#{project.metadata.title} v#{project.metadata.version}", "#{project.root}"]
|
314
347
|
end
|
315
348
|
end
|
316
349
|
|
317
|
-
# --- Print Methods ------------------------------------------------------
|
318
|
-
|
319
350
|
# Print a status header, which consists of project name and version on the
|
320
351
|
# left and stop location on the right.
|
321
352
|
#
|
@@ -355,7 +386,7 @@ module Detroit
|
|
355
386
|
|
356
387
|
#
|
357
388
|
def print_header(left, right)
|
358
|
-
if ANSI::SUPPORTED
|
389
|
+
if $ansi #ANSI::SUPPORTED
|
359
390
|
printline('', '', :pad=>1, :sep=>' ', :style=>[:negative, :bold], :left=>[:bold], :right=>[:bold])
|
360
391
|
printline(left, right, :pad=>2, :sep=>' ', :style=>[:negative, :bold], :left=>[:bold], :right=>[:bold])
|
361
392
|
printline('', '', :pad=>1, :sep=>' ', :style=>[:negative, :bold], :left=>[:bold], :right=>[:bold])
|
@@ -366,7 +397,7 @@ module Detroit
|
|
366
397
|
|
367
398
|
#
|
368
399
|
def print_phase(left, right)
|
369
|
-
if ANSI::SUPPORTED
|
400
|
+
if $ansi #ANSI::SUPPORTED
|
370
401
|
printline(left, right, :pad=>2, :sep=>' ', :style=>[:on_white, :black, :bold], :left=>[:bold], :right=>[:bold])
|
371
402
|
else
|
372
403
|
printline(left, right, :pad=>2, :sep=>'-')
|