build-tool 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +15 -0
- data/db/migrations/002_module_events.rb +1 -1
- data/lib/build-tool.rb +1 -1
- data/lib/build-tool/application.rb +1 -0
- data/lib/build-tool/build-system/base.rb +11 -10
- data/lib/build-tool/cfg/lexer.rb +1 -41
- data/lib/build-tool/cfg/lexer.rex +1 -17
- data/lib/build-tool/cfg/node.rb +0 -3
- data/lib/build-tool/cfg/parser.rb +262 -299
- data/lib/build-tool/cfg/parser.y +1 -11
- data/lib/build-tool/cfg/visitor.rb +4 -42
- data/lib/build-tool/commands.rb +24 -7
- data/lib/build-tool/commands/modules/list.rb +0 -1
- data/lib/build-tool/vcs/git.rb +1 -29
- data/lib/mj/logging.rb +44 -3
- metadata +4 -4
- metadata.gz.sig +0 -0
data/lib/build-tool/cfg/parser.y
CHANGED
@@ -187,17 +187,7 @@ rule
|
|
187
187
|
;
|
188
188
|
|
189
189
|
git_statement
|
190
|
-
: REMOTE STRING
|
191
|
-
;
|
192
|
-
|
193
|
-
git_remote_values
|
194
|
-
: /* empty */
|
195
|
-
| git_remote_value git_remote_values { result = val.flatten; }
|
196
|
-
;
|
197
|
-
|
198
|
-
git_remote_value
|
199
|
-
: server_declaration { result = val[0]; }
|
200
|
-
| USE SERVER identifier { result = UseServerNode.new( val[2] ); }
|
190
|
+
: REMOTE STRING repository_statements END { result = RepositoryDeclarationNode.new( val[1..-1]); }
|
201
191
|
;
|
202
192
|
|
203
193
|
#
|
@@ -288,10 +288,10 @@ module BuildTool; module Cfg;
|
|
288
288
|
return @vcs
|
289
289
|
end
|
290
290
|
|
291
|
-
def
|
292
|
-
visitor =
|
293
|
-
|
294
|
-
@vcs.remote[
|
291
|
+
def visit_RepositoryDeclarationNode( node )
|
292
|
+
visitor = RepositoryDeclarationNodeVisitor.new( configuration )
|
293
|
+
repo = node.accept(visitor)
|
294
|
+
@vcs.remote[repo.name] = repo
|
295
295
|
end
|
296
296
|
|
297
297
|
end # class GitDeclarationNodeVisitor
|
@@ -316,44 +316,6 @@ module BuildTool; module Cfg;
|
|
316
316
|
end # class GitSvnDeclarationNodeVisitor
|
317
317
|
|
318
318
|
|
319
|
-
class GitRemoteNodeVisitor < ListVisitor
|
320
|
-
|
321
|
-
def initialize( configuration )
|
322
|
-
super( configuration )
|
323
|
-
@remote = nil
|
324
|
-
end
|
325
|
-
|
326
|
-
def visit_GitRemoteNode( node )
|
327
|
-
name = node.values[0]
|
328
|
-
@remote = BuildTool::VCS::GitRemote.new( name ) if @remote.nil?
|
329
|
-
node = node.values[1]
|
330
|
-
self.visit_nodes(node.values)
|
331
|
-
return @remote
|
332
|
-
end
|
333
|
-
|
334
|
-
def visit_GitRemotePathNode( node )
|
335
|
-
@remote.path = node.value
|
336
|
-
end
|
337
|
-
|
338
|
-
def visit_GitRemoteValueList( node )
|
339
|
-
self.visit(node)
|
340
|
-
end
|
341
|
-
|
342
|
-
def visit_ServerDeclarationNode( node )
|
343
|
-
visitor = ServerDeclarationNodeVisitor.new( configuration )
|
344
|
-
@remote.server = node.accept(visitor)
|
345
|
-
end
|
346
|
-
|
347
|
-
def visit_UseServerNode( node )
|
348
|
-
@remote.server = configuration.server( node.value )
|
349
|
-
if @remote.server.nil?
|
350
|
-
raise ConfigurationError, "Unknown server #{node.value} configured for remote #{@remote.name}!"
|
351
|
-
end
|
352
|
-
end
|
353
|
-
|
354
|
-
end # class GitRemoteNodeVisitor
|
355
|
-
|
356
|
-
|
357
319
|
class IncludeNodeVisitor < ListVisitor
|
358
320
|
|
359
321
|
def visit_IncludeNode( node )
|
data/lib/build-tool/commands.rb
CHANGED
@@ -313,11 +313,19 @@ module BuildTool; module Commands;
|
|
313
313
|
|
314
314
|
class Standard < Base
|
315
315
|
|
316
|
+
def initialize( *args )
|
317
|
+
# Only used by child classes but needed for complete_modules
|
318
|
+
@all = false
|
319
|
+
super( *args )
|
320
|
+
end
|
321
|
+
|
316
322
|
def initialize_options
|
317
323
|
options.separator "Common options"
|
318
324
|
|
319
325
|
options.on( "-v", "--verbose", "Enable verbose output" ) do
|
320
326
|
Logging.appenders['stdout'].level = [ Logging.appenders['stdout'].level-1, 0 ].max
|
327
|
+
Logging.logger['MJ::Logging::LoggerAdapter'].level =
|
328
|
+
[ Logging.logger['MJ::Logging::LoggerAdapter'].level - 1, 0 ].max
|
321
329
|
end
|
322
330
|
|
323
331
|
options.on( nil, "--dry-run", "Enable dry run." ) do
|
@@ -329,25 +337,37 @@ module BuildTool; module Commands;
|
|
329
337
|
end
|
330
338
|
end
|
331
339
|
|
332
|
-
|
340
|
+
# Gathers all modules currently known.
|
341
|
+
#
|
342
|
+
# @param all Return template modules too.
|
343
|
+
def complete_modules( name, include_templates = false )
|
333
344
|
res = []
|
334
345
|
found = false
|
335
346
|
configuration.modules.each do |mod|
|
336
|
-
next if ( !
|
347
|
+
next if ( !include_templates and mod.is_template? )
|
337
348
|
# We match on the following conditions:
|
338
349
|
# 1. name = mod.name
|
339
350
|
# 2. name/ matches beginning of mod.name
|
340
351
|
# 3. name starts with ":". Look for package instead of
|
341
352
|
# module
|
342
353
|
if name.end_with?('/') and mod.name.start_with? name
|
343
|
-
res << mod
|
344
354
|
found = true
|
345
|
-
|
355
|
+
# Now check if it is active.
|
356
|
+
next if !( mod.active? || @all )
|
346
357
|
res << mod
|
358
|
+
elsif mod.name == name
|
347
359
|
found = true
|
360
|
+
# Now check if it is active.
|
361
|
+
if mod.active? || @all
|
362
|
+
res << mod
|
363
|
+
end
|
364
|
+
break
|
348
365
|
end
|
349
366
|
end
|
367
|
+
# Raise an error if the module was not found
|
350
368
|
raise UsageError, "Unknown module/package #{name}" if !found
|
369
|
+
# Give a warning if all modules where
|
370
|
+
logger.warn "All modules for #{name} are inactive! Will ignore it." if res.empty?
|
351
371
|
return res
|
352
372
|
end
|
353
373
|
|
@@ -415,7 +435,6 @@ module BuildTool; module Commands;
|
|
415
435
|
class ModuleBasedCommand < Standard
|
416
436
|
|
417
437
|
def initialize( *args )
|
418
|
-
@all = false
|
419
438
|
super( *args )
|
420
439
|
end
|
421
440
|
|
@@ -455,8 +474,6 @@ module BuildTool; module Commands;
|
|
455
474
|
|
456
475
|
modules.each do |mod|
|
457
476
|
|
458
|
-
next if !( mod.active? || @all )
|
459
|
-
|
460
477
|
begin
|
461
478
|
logger.info ""
|
462
479
|
logger.info "#### Module #{mod.name}"
|
data/lib/build-tool/vcs/git.rb
CHANGED
@@ -105,7 +105,7 @@ module BuildTool; module VCS
|
|
105
105
|
logger.info <<-EOS
|
106
106
|
The following command sometimes fails when issued from this script. Reason unknown. The
|
107
107
|
best chance you have is issuing the command manually!
|
108
|
-
#{local_path}: #{
|
108
|
+
#{local_path}: git fetch #{config.track_remote}
|
109
109
|
#{local_path}: git checkout -b #{config.track_branch} #{config.track_remote}/#{config.track_branch}
|
110
110
|
EOS
|
111
111
|
|
@@ -159,33 +159,5 @@ best chance you have is issuing the command manually!
|
|
159
159
|
|
160
160
|
end # class Git
|
161
161
|
|
162
|
-
class GitRemote
|
163
|
-
|
164
|
-
attr_accessor :server
|
165
|
-
attr_accessor :path
|
166
|
-
attr_reader :name
|
167
|
-
|
168
|
-
def initialize( name )
|
169
|
-
@name = name
|
170
|
-
@path = nil
|
171
|
-
end
|
172
|
-
|
173
|
-
def url
|
174
|
-
url = ""
|
175
|
-
if @server
|
176
|
-
url = @server.url
|
177
|
-
end
|
178
|
-
if @path
|
179
|
-
url = "#{url}/#{path}"
|
180
|
-
end
|
181
|
-
url
|
182
|
-
end
|
183
|
-
|
184
|
-
def to_s
|
185
|
-
"REMOTE: #{name} #{url}"
|
186
|
-
end
|
187
|
-
|
188
|
-
end # class Remote
|
189
|
-
|
190
162
|
end; end # module BuildTool::VCS
|
191
163
|
|
data/lib/mj/logging.rb
CHANGED
@@ -15,10 +15,10 @@ module MJ; module Logging;
|
|
15
15
|
|
16
16
|
return case event.level
|
17
17
|
|
18
|
-
when ::Logging::level_num(:ERROR)
|
18
|
+
when ::Logging::level_num((:ERROR))
|
19
19
|
sprintf("error: %s\n", obj)
|
20
20
|
|
21
|
-
when ::Logging::level_num(:WARN)
|
21
|
+
when ::Logging::level_num((:WARN))
|
22
22
|
sprintf("warning: %s\n", obj)
|
23
23
|
|
24
24
|
else
|
@@ -28,14 +28,55 @@ module MJ; module Logging;
|
|
28
28
|
|
29
29
|
end # class BasicLayout
|
30
30
|
|
31
|
+
# :TODO: Map the Logging Levels to Logger Levels instead of hardcoding them here.
|
31
32
|
class LoggerAdapter
|
32
33
|
|
33
34
|
def initialize( prefix )
|
34
35
|
@prefix = prefix.upcase
|
35
36
|
end
|
36
37
|
|
38
|
+
def debug( string )
|
39
|
+
logger.debug( "<#{@prefix}> #{string}" )
|
40
|
+
end
|
41
|
+
|
42
|
+
def debug?
|
43
|
+
return logger.level > ::Logging.level_num(:debug)
|
44
|
+
end
|
45
|
+
|
37
46
|
def info( string )
|
38
|
-
logger.
|
47
|
+
logger.info( "<#{@prefix}> info #{string}" )
|
48
|
+
end
|
49
|
+
|
50
|
+
def info?
|
51
|
+
return logger.level > ::Logging.level_num(:info)
|
52
|
+
end
|
53
|
+
|
54
|
+
def warn( string )
|
55
|
+
logger.arn( "<#{@prefix}> #{string}" )
|
56
|
+
end
|
57
|
+
|
58
|
+
def warn?
|
59
|
+
return logger.level > ::Logging.level_num(:warn)
|
60
|
+
end
|
61
|
+
|
62
|
+
def error( string )
|
63
|
+
logger.error( "<#{@prefix}> #{string}" )
|
64
|
+
end
|
65
|
+
|
66
|
+
def error?
|
67
|
+
return logger.level > ::Logging.level_num(:error)
|
68
|
+
end
|
69
|
+
|
70
|
+
def fatal( string )
|
71
|
+
logger.error( "<#{@prefix}> #{string}" )
|
72
|
+
end
|
73
|
+
|
74
|
+
def fatal?
|
75
|
+
return logger.level > ::Logging.level_num(:error)
|
76
|
+
end
|
77
|
+
|
78
|
+
def unknown( string )
|
79
|
+
logger.error( "<#{@prefix}> UNKNOWN: #{string}" )
|
39
80
|
end
|
40
81
|
end
|
41
82
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: build-tool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Jansen
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
M3zOaQdtTmiQPBqNIsE=
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
|
-
date: 2010-07-
|
39
|
+
date: 2010-07-19 00:00:00 +02:00
|
40
40
|
default_executable:
|
41
41
|
dependencies:
|
42
42
|
- !ruby/object:Gem::Dependency
|
metadata.gz.sig
CHANGED
Binary file
|