build-tool 0.5.7 → 0.6.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.rvmrc +1 -0
- data/.yardopts +1 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +56 -0
- data/History.txt +64 -0
- data/README.txt +0 -7
- data/Rakefile +8 -56
- data/bin/build-tool +4 -1
- data/build-tool.gemspec +62 -0
- data/db/migrations/20110703074000_add_command_logs.rb +17 -0
- data/db/migrations/20110703075000_add_module_logs.rb +20 -0
- data/db/migrations/20110815170000_add_features.rb +17 -0
- data/db/migrations/20120103204700_add_modules.rb +17 -0
- data/db/migrations/20120106181200_add_settings.rb +18 -0
- data/lib/build-tool.rb +3 -4
- data/lib/build-tool/application.rb +127 -37
- data/lib/build-tool/build-system/autoconf.rb +2 -8
- data/lib/build-tool/build-system/base.rb +12 -4
- data/lib/build-tool/build-system/cmake.rb +2 -0
- data/lib/build-tool/build-system/custom.rb +2 -0
- data/lib/build-tool/build-system/kdel10n.rb +2 -0
- data/lib/build-tool/build-system/make.rb +2 -0
- data/lib/build-tool/build-system/none.rb +2 -0
- data/lib/build-tool/build-system/qmake.rb +2 -0
- data/lib/build-tool/build-system/qt.rb +4 -0
- data/lib/build-tool/cfg/lexer.rex +40 -8
- data/lib/build-tool/cfg/lexer_base.rb +3 -1
- data/lib/build-tool/cfg/node.rb +17 -1
- data/lib/build-tool/cfg/parser.y +92 -10
- data/lib/build-tool/cfg/visitor.rb +202 -78
- data/lib/build-tool/command_actions.rb +26 -10
- data/lib/build-tool/commands.rb +289 -197
- data/lib/build-tool/commands/build.rb +13 -9
- data/lib/build-tool/commands/configuration.rb +25 -0
- data/lib/build-tool/commands/configuration/edit.rb +42 -0
- data/lib/build-tool/commands/configuration/list.rb +48 -0
- data/lib/build-tool/commands/configure.rb +9 -5
- data/lib/build-tool/commands/ctags.rb +8 -3
- data/lib/build-tool/commands/environments.rb +2 -4
- data/lib/build-tool/commands/environments/list.rb +13 -10
- data/lib/build-tool/commands/environments/set.rb +5 -1
- data/lib/build-tool/commands/features.rb +24 -0
- data/lib/build-tool/commands/features/disable.rb +70 -0
- data/lib/build-tool/commands/features/enable.rb +66 -0
- data/lib/build-tool/commands/features/list.rb +92 -0
- data/lib/build-tool/commands/fetch.rb +9 -3
- data/lib/build-tool/commands/files.rb +9 -5
- data/lib/build-tool/commands/gc.rb +48 -15
- data/lib/build-tool/commands/history.rb +21 -16
- data/lib/build-tool/commands/info.rb +16 -13
- data/lib/build-tool/commands/install.rb +8 -4
- data/lib/build-tool/commands/modules.rb +2 -4
- data/lib/build-tool/commands/modules/cleanup.rb +52 -0
- data/lib/build-tool/commands/modules/disable.rb +95 -0
- data/lib/build-tool/commands/modules/enable.rb +52 -0
- data/lib/build-tool/commands/modules/info.rb +44 -35
- data/lib/build-tool/commands/modules/list.rb +67 -15
- data/lib/build-tool/commands/modules/shell.rb +8 -2
- data/lib/build-tool/commands/rebase.rb +15 -7
- data/lib/build-tool/commands/recipes.rb +2 -4
- data/lib/build-tool/commands/recipes/add.rb +16 -2
- data/lib/build-tool/commands/recipes/edit.rb +72 -0
- data/lib/build-tool/commands/recipes/incoming.rb +11 -7
- data/lib/build-tool/commands/recipes/info.rb +12 -8
- data/lib/build-tool/commands/recipes/install.rb +37 -42
- data/lib/build-tool/commands/recipes/list.rb +6 -2
- data/lib/build-tool/configuration.rb +88 -3
- data/lib/build-tool/environment.rb +2 -0
- data/lib/build-tool/errors.rb +5 -0
- data/lib/build-tool/history.rb +3 -181
- data/lib/build-tool/model/command_log.rb +93 -0
- data/lib/build-tool/model/feature.rb +80 -0
- data/lib/build-tool/{module.rb → model/module.rb} +110 -29
- data/lib/build-tool/model/module_log.rb +64 -0
- data/lib/build-tool/model/setting.rb +84 -0
- data/lib/build-tool/recipe.rb +40 -18
- data/lib/build-tool/repository.rb +39 -33
- data/lib/build-tool/server.rb +27 -3
- data/lib/build-tool/singleton.rb +2 -0
- data/lib/build-tool/sshkey.rb +2 -0
- data/lib/build-tool/state_helper.rb +64 -0
- data/lib/build-tool/vcs/archive.rb +3 -1
- data/lib/build-tool/vcs/base.rb +13 -0
- data/lib/build-tool/vcs/git-svn.rb +36 -14
- data/lib/build-tool/vcs/git.rb +180 -44
- data/lib/build-tool/vcs/mercurial.rb +25 -13
- data/lib/build-tool/vcs/svn.rb +20 -15
- data/lib/build-tool/version.rb +30 -0
- data/lib/mj/error.rb +2 -0
- data/lib/mj/logging.rb +2 -0
- data/lib/mj/mixins/inherited_attributes.rb +73 -0
- data/lib/mj/tools/editor.rb +34 -0
- data/lib/mj/tools/ssh.rb +2 -0
- data/lib/mj/tools/subprocess.rb +2 -1
- data/lib/mj/vcs/git.rb +14 -2
- data/lib/mj/visitor.rb +22 -0
- data/tasks/db.rake +36 -0
- data/tasks/racc.rake +14 -0
- data/tasks/rdoc.rake +8 -0
- data/tasks/rexical.rake +14 -0
- data/tasks/test.rake +21 -0
- data/test/integration/history_test.rb +88 -0
- data/test/integration/parser_configuration.rb +36 -0
- data/test/integration/parser_environment_parser.rb +156 -0
- data/test/integration/parser_feature_test.rb +75 -0
- data/test/integration/parser_git-svn_test.rb +92 -0
- data/test/integration/parser_git_test.rb +97 -0
- data/test/integration/parser_mercurial_test.rb +77 -0
- data/test/integration/parser_module_test.rb +103 -0
- data/test/integration/parser_svn_test.rb +92 -0
- data/test/integration/parser_test.rb +73 -0
- data/test/test_helper.rb +61 -0
- data/test/unit/configuration_test.rb +36 -0
- data/test/unit/git_configuration_test.rb +163 -0
- data/test/unit/git_svn_configuration_test.rb +240 -0
- data/test/unit/mercurial_configuration_test.rb +64 -0
- data/test/unit/model/command_log_test.rb +103 -0
- data/test/unit/model/feature_test.rb +29 -0
- data/test/unit/model/module_log_test.rb +70 -0
- data/test/unit/model/module_test.rb +32 -0
- data/test/unit/repository_test.rb +110 -0
- data/test/unit/server_test.rb +66 -0
- data/test/unit/svn_configuration_test.rb +90 -0
- metadata +134 -93
- data/Manifest.txt +0 -80
- data/db/migrations/001_command_histories.rb +0 -20
- data/db/migrations/002_module_events.rb +0 -24
- data/db/migrations/003_command_histories_add_logfile.rb +0 -19
- data/lib/build-tool/GUI.rb +0 -360
- data/lib/build-tool/commands/help.rb +0 -22
- data/lib/build-tool/commands/lsfeatures.rb +0 -76
- data/lib/build-tool/feature.rb +0 -47
@@ -0,0 +1,66 @@
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
2
|
+
|
3
|
+
require 'build-tool/commands'
|
4
|
+
|
5
|
+
module BuildTool; module Commands; module Features
|
6
|
+
|
7
|
+
#
|
8
|
+
# BuildCommand
|
9
|
+
#
|
10
|
+
class Enable < Standard
|
11
|
+
|
12
|
+
name 'enable'
|
13
|
+
description 'Enable the given features.'
|
14
|
+
long_description [ 'Sets the features status.' ]
|
15
|
+
|
16
|
+
def initialize_options
|
17
|
+
options.banner = "Usage: #{self.fullname} [OPTIONS]... FEATURE..."
|
18
|
+
options.separator( "" )
|
19
|
+
options.separator( "Options" )
|
20
|
+
|
21
|
+
@default = false
|
22
|
+
options.on( "--default", "Set to use default state if possible." ) { |t|
|
23
|
+
@default = true
|
24
|
+
}
|
25
|
+
|
26
|
+
super
|
27
|
+
end
|
28
|
+
|
29
|
+
def applicable?
|
30
|
+
BuildTool::Application.instance.has_recipe?
|
31
|
+
end
|
32
|
+
|
33
|
+
def do_execute( args )
|
34
|
+
|
35
|
+
for feat in args
|
36
|
+
enable_feature( feat )
|
37
|
+
end
|
38
|
+
|
39
|
+
configuration.save()
|
40
|
+
|
41
|
+
return 0
|
42
|
+
end
|
43
|
+
|
44
|
+
def enable_feature( name )
|
45
|
+
feature = configuration.features[name]
|
46
|
+
|
47
|
+
if feature.nil?
|
48
|
+
error( "Unknown feature '%s'" % name )
|
49
|
+
return -1
|
50
|
+
end
|
51
|
+
|
52
|
+
if @default and feature.default_active? == true
|
53
|
+
info( '%-35s: using default (enabled).' % feature.name )
|
54
|
+
feature.active = nil
|
55
|
+
else
|
56
|
+
info( '%-35s: enabled explicitely.' % feature.name )
|
57
|
+
feature.active = true
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end # class Activate
|
62
|
+
|
63
|
+
end; end; end # module BuildTool::Commands::Modules
|
64
|
+
|
65
|
+
|
66
|
+
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
2
|
+
|
3
|
+
require 'build-tool/commands'
|
4
|
+
|
5
|
+
module BuildTool; module Commands; module Features
|
6
|
+
|
7
|
+
#
|
8
|
+
# BuildCommand
|
9
|
+
#
|
10
|
+
class List < Standard
|
11
|
+
|
12
|
+
name "list"
|
13
|
+
description "Print a list of features."
|
14
|
+
long_description [
|
15
|
+
"Prints a list of features. Withput a parameter all active features are shown. When given",
|
16
|
+
"parameters lists all features matching them.",
|
17
|
+
"",
|
18
|
+
"The first column of the output is one character wide:",
|
19
|
+
" First column: Is the module active?",
|
20
|
+
" 'A': Active",
|
21
|
+
" 'I': Inactive",
|
22
|
+
" Second column: The feature name.",
|
23
|
+
" Third column: The features short description." ]
|
24
|
+
cmdalias "lsfeatures"
|
25
|
+
|
26
|
+
def initialize_options
|
27
|
+
options.banner = "Usage: #{self.fullname} [OPTIONS]... [FEATURES]..."
|
28
|
+
options.separator( "" )
|
29
|
+
options.separator( "Options" )
|
30
|
+
|
31
|
+
options.on( "--all", "Include inactive modules." ) {
|
32
|
+
@all = true
|
33
|
+
}
|
34
|
+
|
35
|
+
super
|
36
|
+
end
|
37
|
+
|
38
|
+
def applicable?
|
39
|
+
BuildTool::Application.instance.has_recipe?
|
40
|
+
end
|
41
|
+
|
42
|
+
def do_execute( args )
|
43
|
+
if args.length > 1
|
44
|
+
# *TODO* print better message
|
45
|
+
return usage "To many arguments."
|
46
|
+
end
|
47
|
+
|
48
|
+
if args.length == 1
|
49
|
+
return show_feature( args[0] )
|
50
|
+
else
|
51
|
+
return list_features
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def list_features
|
56
|
+
features = configuration.features
|
57
|
+
features.keys.sort.each do |name|
|
58
|
+
feature = features[name]
|
59
|
+
# skip inactive features if --all was not specified.
|
60
|
+
next if not feature.active? and not @all
|
61
|
+
# Skip feature without modules.
|
62
|
+
next if feature.modules.empty?
|
63
|
+
info( "%s %-30s : %s" % [ feature.active_char, name, feature.description ] )
|
64
|
+
end
|
65
|
+
|
66
|
+
return 0
|
67
|
+
end
|
68
|
+
|
69
|
+
def show_feature( name )
|
70
|
+
feature = configuration.features[name]
|
71
|
+
|
72
|
+
if feature.nil?
|
73
|
+
error( "Unknown feature '%s'" % name )
|
74
|
+
return -1
|
75
|
+
end
|
76
|
+
|
77
|
+
info( "Name : %s" % feature.path )
|
78
|
+
info( "Modules" )
|
79
|
+
info( "====================================================" )
|
80
|
+
feature.modules.each do |mod|
|
81
|
+
next if mod.is_template?
|
82
|
+
info( "%s%s %-35s : %s" % [ mod.active_char, mod.state_char, mod.name, mod.description || "No description specified" ] )
|
83
|
+
end
|
84
|
+
return 0
|
85
|
+
end
|
86
|
+
|
87
|
+
end # class
|
88
|
+
|
89
|
+
end; end; end # module BuildTool::Commands::Modules
|
90
|
+
|
91
|
+
|
92
|
+
|
@@ -1,3 +1,7 @@
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
2
|
+
|
3
|
+
require 'mj/tools/subprocess'
|
4
|
+
|
1
5
|
require 'build-tool/application'
|
2
6
|
require 'build-tool/commands'
|
3
7
|
|
@@ -27,7 +31,9 @@ def applicable?
|
|
27
31
|
end
|
28
32
|
|
29
33
|
def initialize_options
|
30
|
-
|
34
|
+
options.banner = "Usage: #{self.fullname} [OPTIONS]... MODULES..."
|
35
|
+
options.separator( "" )
|
36
|
+
options.separator( "Options" )
|
31
37
|
super
|
32
38
|
end
|
33
39
|
|
@@ -35,7 +41,7 @@ def is_module_ready?( mod )
|
|
35
41
|
isready = true
|
36
42
|
isready &= mod.ready_for_fetch
|
37
43
|
if isready && !mod.vcs.fetching_supported?
|
38
|
-
|
44
|
+
warn( "#{mod.name}: fetching not supported by #{mod.vcs.name} -> implicit rebase." )
|
39
45
|
end
|
40
46
|
return isready
|
41
47
|
end
|
@@ -56,7 +62,7 @@ def teardown_command
|
|
56
62
|
|
57
63
|
def prepare_module( mod )
|
58
64
|
isready = true
|
59
|
-
|
65
|
+
isready &= mod.prepare_for_fetch
|
60
66
|
return isready
|
61
67
|
end # prepare_module
|
62
68
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
2
|
+
|
1
3
|
require 'build-tool/application'
|
2
4
|
require 'build-tool/commands'
|
3
5
|
|
@@ -33,7 +35,9 @@ def do_execute( args )
|
|
33
35
|
end
|
34
36
|
|
35
37
|
def initialize_options
|
36
|
-
|
38
|
+
options.banner = "Usage: #{self.fullname} [OPTIONS]... [FILENAME]"
|
39
|
+
options.separator( "" )
|
40
|
+
options.separator( "Options" )
|
37
41
|
super
|
38
42
|
end
|
39
43
|
|
@@ -41,13 +45,13 @@ def print_file_list
|
|
41
45
|
recipe = Application::instance.recipe
|
42
46
|
files_dir = recipe.files_path
|
43
47
|
if !files_dir.exist?
|
44
|
-
|
48
|
+
error( "No files supplied with this recipe" )
|
45
49
|
return 0
|
46
50
|
end
|
47
51
|
Dir.new(files_dir).sort.each do |entry|
|
48
52
|
next if entry == "."
|
49
53
|
next if entry == ".."
|
50
|
-
|
54
|
+
info( entry )
|
51
55
|
end
|
52
56
|
return 0
|
53
57
|
end
|
@@ -56,12 +60,12 @@ def print_file( filename )
|
|
56
60
|
recipe = Application::instance.recipe
|
57
61
|
files_dir = recipe.files_path
|
58
62
|
if !files_dir.exist?
|
59
|
-
|
63
|
+
error( "No files supplied with this recipe" )
|
60
64
|
return 0
|
61
65
|
end
|
62
66
|
file = files_dir.join( filename )
|
63
67
|
if !file.exist?
|
64
|
-
|
68
|
+
error( "File '#{filename}' not found! Found those:" )
|
65
69
|
print_file_list
|
66
70
|
return -1
|
67
71
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
2
|
+
|
1
3
|
require 'build-tool/commands'
|
2
4
|
|
3
5
|
module BuildTool; module Commands;
|
@@ -11,10 +13,12 @@ class Gc < ModuleBasedCommand
|
|
11
13
|
description "Remove old stuff"
|
12
14
|
long_description [ "Invokes maintenance actions. The history db is purged from entries older",
|
13
15
|
"than 10 days. If supplied do garbage collection for the modules too.",
|
14
|
-
"What that means is subject to the modules. See with -
|
16
|
+
"What that means is subject to the modules. See with -vv --dry-run."]
|
15
17
|
|
16
18
|
def initialize_options
|
17
|
-
|
19
|
+
options.banner = "Usage: #{self.fullname} [OPTIONS]... [MODULE|GROUP]..."
|
20
|
+
options.separator( "" )
|
21
|
+
options.separator( "Options" )
|
18
22
|
super
|
19
23
|
end
|
20
24
|
|
@@ -22,26 +26,55 @@ def applicable?
|
|
22
26
|
BuildTool::Application.instance.has_recipe?
|
23
27
|
end
|
24
28
|
|
29
|
+
# Make sure at least the log directories are cleaned up
|
25
30
|
def do_execute( args )
|
26
|
-
|
31
|
+
cleanup_logdirectories()
|
27
32
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
else
|
32
|
-
super
|
33
|
+
# Only call the base class if there we modules specified. We get an error else.
|
34
|
+
if args.length > 0
|
35
|
+
return super
|
33
36
|
end
|
37
|
+
return 0
|
38
|
+
end
|
34
39
|
|
40
|
+
# Clean up the log directories.
|
41
|
+
def cleanup_logdirectories
|
42
|
+
logdir = configuration.log_directory
|
43
|
+
|
44
|
+
info( "Removing outdated log files( older than 10 days )." )
|
45
|
+
# FIRST STEP: Removing old command logs from db and log/ directory.
|
35
46
|
BuildTool::History::CommandLog.older_than.each do |cmd|
|
36
47
|
if cmd.logdir
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
48
|
+
verbose( " - Removing outdated log #{cmd.logdir}");
|
49
|
+
FileUtils.rm_rf( cmd.logdir, :noop => $noop ) if File.exist?( cmd.logdir )
|
50
|
+
end
|
51
|
+
cmd.destroy() if not $noop
|
52
|
+
end
|
53
|
+
|
54
|
+
# SECOND STEP: Remove old command logs from log/ directory that have no associated
|
55
|
+
# entry in the database
|
56
|
+
info( "Removing orphaned log directories" )
|
57
|
+
logdir.children().sort().each do |abspath|
|
58
|
+
next if abspath.basename().to_s == 'latest'
|
59
|
+
# Check if it is in the db
|
60
|
+
cl = BuildTool::History::CommandLog.where( :logdir => abspath.to_s )
|
61
|
+
if cl.count == 0
|
62
|
+
verbose( ' - Removing %s' % abspath.to_s )
|
63
|
+
FileUtils.rm_r( abspath, :noop => $noop )
|
64
|
+
else
|
65
|
+
debug( ' - Keeping %s' % abspath.to_s )
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# THIRD STEP: Remove old command logs from database that have no associated directory
|
70
|
+
# in log/
|
71
|
+
info( "Removing orphaned database entries." )
|
72
|
+
BuildTool::History::CommandLog.all( :order => :id ).each do |cl|
|
73
|
+
abspath = Pathname.new( cl.logdir )
|
74
|
+
if not abspath.exist?
|
75
|
+
verbose( ' - Removing orphaned db entry %d' % cl.id )
|
76
|
+
cl.destroy() if not $noop
|
43
77
|
end
|
44
|
-
cmd.destroy
|
45
78
|
end
|
46
79
|
return 0
|
47
80
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
2
|
+
|
1
3
|
require 'build-tool/commands'
|
2
4
|
|
3
5
|
require 'ansi'
|
@@ -10,8 +12,6 @@ module BuildTool; module Commands;
|
|
10
12
|
#
|
11
13
|
class History < Standard
|
12
14
|
|
13
|
-
include ANSI::Code
|
14
|
-
|
15
15
|
name "history"
|
16
16
|
description "show command history"
|
17
17
|
long_description [ "Query the command history",
|
@@ -21,9 +21,10 @@ class History < Standard
|
|
21
21
|
" MODULE: Show the last three commands on MODULE" ]
|
22
22
|
|
23
23
|
def initialize_options
|
24
|
-
|
24
|
+
options.banner = "Usage: #{self.fullname} [OPTIONS]... [NUMBER|+NUMBER|MODULE]"
|
25
|
+
options.separator( "" )
|
26
|
+
options.separator( "Options" )
|
25
27
|
|
26
|
-
@options.separator "Options:"
|
27
28
|
# Show detailed history. Add start time, duration and success/failure
|
28
29
|
@long = false
|
29
30
|
options.on( "-l", "--long", "Use long list format." ) { |t|
|
@@ -32,8 +33,12 @@ def initialize_options
|
|
32
33
|
super
|
33
34
|
|
34
35
|
@lines = nil
|
35
|
-
options.on( "-n", "--number
|
36
|
-
|
36
|
+
options.on( "-n", "--number COUNT", "Number of lines to show." ) { |n|
|
37
|
+
if not /^[0-9]+$/.match( n )
|
38
|
+
raise OptionParser::ParseError.new( 'value "%s" is not a number' % n )
|
39
|
+
end
|
40
|
+
|
41
|
+
@lines = n.to_i()
|
37
42
|
}
|
38
43
|
super
|
39
44
|
end
|
@@ -62,9 +67,9 @@ def do_execute( args )
|
|
62
67
|
|
63
68
|
def show_command( cmd )
|
64
69
|
if @long
|
65
|
-
|
70
|
+
info( " %04d %s # %s [%s]" % [ cmd.id, cmd.started_at.strftime("%x %X"), cmd.command, cmd.state_str ] )
|
66
71
|
else
|
67
|
-
|
72
|
+
info( " %04d %s [%s]" % [ cmd.id, cmd.command, cmd.state_str ] )
|
68
73
|
end
|
69
74
|
end
|
70
75
|
|
@@ -87,12 +92,12 @@ def show_module_history( modname )
|
|
87
92
|
show_command( cmd )
|
88
93
|
|
89
94
|
last_module=""
|
90
|
-
cmd.
|
95
|
+
cmd.module_logs.where( :module => mod.name ).each do |e|
|
91
96
|
if e.module != last_module
|
92
|
-
|
97
|
+
info( blue { "\t#{e.module}" } )
|
93
98
|
last_module = e.module
|
94
99
|
end
|
95
|
-
|
100
|
+
info( "\t\t %s %s (%s) [%s]" % [ e.duration, e.event, e.logfile, e.state_str ] )
|
96
101
|
end
|
97
102
|
end
|
98
103
|
return 0
|
@@ -100,12 +105,12 @@ def show_module_history( modname )
|
|
100
105
|
|
101
106
|
def show_detailed_command_history( id )
|
102
107
|
if id[0,1] == '+'
|
103
|
-
cmd = BuildTool::History::CommandLog.most_recent( id
|
108
|
+
cmd = BuildTool::History::CommandLog.most_recent( id )
|
104
109
|
return 0 if cmd.nil?
|
105
110
|
else
|
106
|
-
cmd = BuildTool::History::CommandLog
|
111
|
+
cmd = BuildTool::History::CommandLog.find( id )
|
107
112
|
if cmd.nil?
|
108
|
-
|
113
|
+
error( "No entry with id #{id.to_i} found in history!")
|
109
114
|
return -1
|
110
115
|
end
|
111
116
|
end
|
@@ -114,10 +119,10 @@ def show_detailed_command_history( id )
|
|
114
119
|
last_module=""
|
115
120
|
cmd.module_logs.each do |e|
|
116
121
|
if e.module != last_module
|
117
|
-
|
122
|
+
info( blue { "\t#{e.module}" } )
|
118
123
|
last_module = e.module
|
119
124
|
end
|
120
|
-
|
125
|
+
info( "\t\t %s %s (%s) [%s]" % [ e.duration, e.event, e.logfile, e.state_str ] )
|
121
126
|
end
|
122
127
|
|
123
128
|
return 0
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
2
|
+
|
1
3
|
require 'build-tool/commands'
|
2
4
|
|
3
5
|
module BuildTool; module Commands;
|
@@ -12,7 +14,9 @@ class Info < Standard
|
|
12
14
|
long_description [ "Show information about the currently used recipe" ]
|
13
15
|
|
14
16
|
def initialize_options
|
15
|
-
|
17
|
+
options.banner = "Usage: #{self.fullname} [OPTIONS]..."
|
18
|
+
options.separator( "" )
|
19
|
+
options.separator( "Options" )
|
16
20
|
super
|
17
21
|
end
|
18
22
|
|
@@ -23,21 +27,20 @@ def applicable?
|
|
23
27
|
def do_execute( args )
|
24
28
|
if args.length != 0
|
25
29
|
# *TODO* print better message
|
26
|
-
|
30
|
+
warn( "Arguments ignored." )
|
27
31
|
end
|
28
32
|
|
29
33
|
recipe = configuration.recipe
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
say "Overrides: #{ recipe.local_config_file_path( 'recipe' ) }"
|
34
|
+
info( "Recipe" )
|
35
|
+
info( "------" )
|
36
|
+
info( "Name: #{recipe.name}" )
|
37
|
+
info( "Short: #{recipe.short_description}" )
|
38
|
+
info( "Long: #{recipe.long_description}" )
|
39
|
+
info( "Full Path: #{recipe.global_config_file_path('recipe')}" )
|
40
|
+
info( "" )
|
41
|
+
info( "Configuration" )
|
42
|
+
info( "-------------" )
|
43
|
+
info( "Overrides: #{ recipe.local_config_file_path( 'recipe' ) }" )
|
41
44
|
|
42
45
|
return 0
|
43
46
|
end
|