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.
Files changed (133) hide show
  1. data/.gitignore +1 -0
  2. data/.rvmrc +1 -0
  3. data/.yardopts +1 -0
  4. data/Gemfile +5 -0
  5. data/Gemfile.lock +56 -0
  6. data/History.txt +64 -0
  7. data/README.txt +0 -7
  8. data/Rakefile +8 -56
  9. data/bin/build-tool +4 -1
  10. data/build-tool.gemspec +62 -0
  11. data/db/migrations/20110703074000_add_command_logs.rb +17 -0
  12. data/db/migrations/20110703075000_add_module_logs.rb +20 -0
  13. data/db/migrations/20110815170000_add_features.rb +17 -0
  14. data/db/migrations/20120103204700_add_modules.rb +17 -0
  15. data/db/migrations/20120106181200_add_settings.rb +18 -0
  16. data/lib/build-tool.rb +3 -4
  17. data/lib/build-tool/application.rb +127 -37
  18. data/lib/build-tool/build-system/autoconf.rb +2 -8
  19. data/lib/build-tool/build-system/base.rb +12 -4
  20. data/lib/build-tool/build-system/cmake.rb +2 -0
  21. data/lib/build-tool/build-system/custom.rb +2 -0
  22. data/lib/build-tool/build-system/kdel10n.rb +2 -0
  23. data/lib/build-tool/build-system/make.rb +2 -0
  24. data/lib/build-tool/build-system/none.rb +2 -0
  25. data/lib/build-tool/build-system/qmake.rb +2 -0
  26. data/lib/build-tool/build-system/qt.rb +4 -0
  27. data/lib/build-tool/cfg/lexer.rex +40 -8
  28. data/lib/build-tool/cfg/lexer_base.rb +3 -1
  29. data/lib/build-tool/cfg/node.rb +17 -1
  30. data/lib/build-tool/cfg/parser.y +92 -10
  31. data/lib/build-tool/cfg/visitor.rb +202 -78
  32. data/lib/build-tool/command_actions.rb +26 -10
  33. data/lib/build-tool/commands.rb +289 -197
  34. data/lib/build-tool/commands/build.rb +13 -9
  35. data/lib/build-tool/commands/configuration.rb +25 -0
  36. data/lib/build-tool/commands/configuration/edit.rb +42 -0
  37. data/lib/build-tool/commands/configuration/list.rb +48 -0
  38. data/lib/build-tool/commands/configure.rb +9 -5
  39. data/lib/build-tool/commands/ctags.rb +8 -3
  40. data/lib/build-tool/commands/environments.rb +2 -4
  41. data/lib/build-tool/commands/environments/list.rb +13 -10
  42. data/lib/build-tool/commands/environments/set.rb +5 -1
  43. data/lib/build-tool/commands/features.rb +24 -0
  44. data/lib/build-tool/commands/features/disable.rb +70 -0
  45. data/lib/build-tool/commands/features/enable.rb +66 -0
  46. data/lib/build-tool/commands/features/list.rb +92 -0
  47. data/lib/build-tool/commands/fetch.rb +9 -3
  48. data/lib/build-tool/commands/files.rb +9 -5
  49. data/lib/build-tool/commands/gc.rb +48 -15
  50. data/lib/build-tool/commands/history.rb +21 -16
  51. data/lib/build-tool/commands/info.rb +16 -13
  52. data/lib/build-tool/commands/install.rb +8 -4
  53. data/lib/build-tool/commands/modules.rb +2 -4
  54. data/lib/build-tool/commands/modules/cleanup.rb +52 -0
  55. data/lib/build-tool/commands/modules/disable.rb +95 -0
  56. data/lib/build-tool/commands/modules/enable.rb +52 -0
  57. data/lib/build-tool/commands/modules/info.rb +44 -35
  58. data/lib/build-tool/commands/modules/list.rb +67 -15
  59. data/lib/build-tool/commands/modules/shell.rb +8 -2
  60. data/lib/build-tool/commands/rebase.rb +15 -7
  61. data/lib/build-tool/commands/recipes.rb +2 -4
  62. data/lib/build-tool/commands/recipes/add.rb +16 -2
  63. data/lib/build-tool/commands/recipes/edit.rb +72 -0
  64. data/lib/build-tool/commands/recipes/incoming.rb +11 -7
  65. data/lib/build-tool/commands/recipes/info.rb +12 -8
  66. data/lib/build-tool/commands/recipes/install.rb +37 -42
  67. data/lib/build-tool/commands/recipes/list.rb +6 -2
  68. data/lib/build-tool/configuration.rb +88 -3
  69. data/lib/build-tool/environment.rb +2 -0
  70. data/lib/build-tool/errors.rb +5 -0
  71. data/lib/build-tool/history.rb +3 -181
  72. data/lib/build-tool/model/command_log.rb +93 -0
  73. data/lib/build-tool/model/feature.rb +80 -0
  74. data/lib/build-tool/{module.rb → model/module.rb} +110 -29
  75. data/lib/build-tool/model/module_log.rb +64 -0
  76. data/lib/build-tool/model/setting.rb +84 -0
  77. data/lib/build-tool/recipe.rb +40 -18
  78. data/lib/build-tool/repository.rb +39 -33
  79. data/lib/build-tool/server.rb +27 -3
  80. data/lib/build-tool/singleton.rb +2 -0
  81. data/lib/build-tool/sshkey.rb +2 -0
  82. data/lib/build-tool/state_helper.rb +64 -0
  83. data/lib/build-tool/vcs/archive.rb +3 -1
  84. data/lib/build-tool/vcs/base.rb +13 -0
  85. data/lib/build-tool/vcs/git-svn.rb +36 -14
  86. data/lib/build-tool/vcs/git.rb +180 -44
  87. data/lib/build-tool/vcs/mercurial.rb +25 -13
  88. data/lib/build-tool/vcs/svn.rb +20 -15
  89. data/lib/build-tool/version.rb +30 -0
  90. data/lib/mj/error.rb +2 -0
  91. data/lib/mj/logging.rb +2 -0
  92. data/lib/mj/mixins/inherited_attributes.rb +73 -0
  93. data/lib/mj/tools/editor.rb +34 -0
  94. data/lib/mj/tools/ssh.rb +2 -0
  95. data/lib/mj/tools/subprocess.rb +2 -1
  96. data/lib/mj/vcs/git.rb +14 -2
  97. data/lib/mj/visitor.rb +22 -0
  98. data/tasks/db.rake +36 -0
  99. data/tasks/racc.rake +14 -0
  100. data/tasks/rdoc.rake +8 -0
  101. data/tasks/rexical.rake +14 -0
  102. data/tasks/test.rake +21 -0
  103. data/test/integration/history_test.rb +88 -0
  104. data/test/integration/parser_configuration.rb +36 -0
  105. data/test/integration/parser_environment_parser.rb +156 -0
  106. data/test/integration/parser_feature_test.rb +75 -0
  107. data/test/integration/parser_git-svn_test.rb +92 -0
  108. data/test/integration/parser_git_test.rb +97 -0
  109. data/test/integration/parser_mercurial_test.rb +77 -0
  110. data/test/integration/parser_module_test.rb +103 -0
  111. data/test/integration/parser_svn_test.rb +92 -0
  112. data/test/integration/parser_test.rb +73 -0
  113. data/test/test_helper.rb +61 -0
  114. data/test/unit/configuration_test.rb +36 -0
  115. data/test/unit/git_configuration_test.rb +163 -0
  116. data/test/unit/git_svn_configuration_test.rb +240 -0
  117. data/test/unit/mercurial_configuration_test.rb +64 -0
  118. data/test/unit/model/command_log_test.rb +103 -0
  119. data/test/unit/model/feature_test.rb +29 -0
  120. data/test/unit/model/module_log_test.rb +70 -0
  121. data/test/unit/model/module_test.rb +32 -0
  122. data/test/unit/repository_test.rb +110 -0
  123. data/test/unit/server_test.rb +66 -0
  124. data/test/unit/svn_configuration_test.rb +90 -0
  125. metadata +134 -93
  126. data/Manifest.txt +0 -80
  127. data/db/migrations/001_command_histories.rb +0 -20
  128. data/db/migrations/002_module_events.rb +0 -24
  129. data/db/migrations/003_command_histories_add_logfile.rb +0 -19
  130. data/lib/build-tool/GUI.rb +0 -360
  131. data/lib/build-tool/commands/help.rb +0 -22
  132. data/lib/build-tool/commands/lsfeatures.rb +0 -76
  133. data/lib/build-tool/feature.rb +0 -47
@@ -1,3 +1,5 @@
1
+ # -*- coding: UTF-8 -*-
2
+
1
3
  require 'build-tool/application'
2
4
  require 'build-tool/commands'
3
5
 
@@ -18,9 +20,10 @@ def log?
18
20
  end
19
21
 
20
22
  def initialize_options
21
- @options.banner = "Usage: #{Pathname.new($0).basename} #{self.fullname} [MODULES]..."
23
+ options.banner = "Usage: #{fullname} [OPTIONS]... MODULE..."
24
+ options.separator( "" )
25
+ options.separator( "Options" )
22
26
 
23
- @options.separator "Options:"
24
27
  @clean = false
25
28
  @configure = false
26
29
  @from_scratch = false
@@ -53,6 +56,10 @@ def initialize_options
53
56
  @from_scratch = true
54
57
  }
55
58
 
59
+ @verbose_rebase = true
60
+ options.on( nil, "--[no]-verbose-rebase", "Show the changes applied by rebase." ) { |t|
61
+ @verbose_rebase = false
62
+ }
56
63
 
57
64
  super
58
65
  end
@@ -63,14 +70,11 @@ def applicable?
63
70
 
64
71
  def is_module_ready?( mod )
65
72
  isready = true
66
- if @from_scratch and not mod.build_system_required.out_of_source
67
- logger.warn "#{mod.name}: is compiled in source. Skipping --from-scratch!"
68
- end
69
73
  @update && isready &= mod.ready_for_fetch
70
74
  @update && isready &= mod.ready_for_rebase
71
75
  if !@update and (@build or @install or @configure)
72
76
  if !mod.checkedout?
73
- logger.warn "#{mod.name}: is not checked out. Skipping (add -u for checkout)"
77
+ warn( "#{mod.name}: is not checked out. Skipping (add -u for checkout)" )
74
78
  end
75
79
  end
76
80
  @install && isready &= mod.prepare_for_installation
@@ -88,8 +92,8 @@ def do_execute_module( mod )
88
92
 
89
93
  if not ( $noop or mod.checkedout? or @update )
90
94
  # If the module is not checked out or $noop is active skip the module
91
- logger.warn "Module is not checked out! Use -u to check it out."
92
- logger.warn "skipped!"
95
+ warn( "Module is not checked out! Use -u to check it out." )
96
+ warn( "skipped!" )
93
97
  return 0
94
98
  end
95
99
 
@@ -97,7 +101,7 @@ def do_execute_module( mod )
97
101
  if @update
98
102
  if mod.checkedout?
99
103
  fetch( mod )
100
- rebase( mod )
104
+ rebase( mod, @verbose_rebase )
101
105
  else
102
106
  clone( mod )
103
107
  end
@@ -0,0 +1,25 @@
1
+ # -*- coding: UTF-8 -*-
2
+
3
+ require 'build-tool/commands'
4
+
5
+ module BuildTool; module Commands
6
+
7
+ class ConfigurationsCLI < Commands::SubCommands
8
+
9
+ name "configuration"
10
+ description "Configuration related commands."
11
+
12
+ def initialize_options
13
+ super
14
+ end
15
+
16
+ def applicable?
17
+ BuildTool::Application.instance.has_recipe?
18
+ end
19
+
20
+ end # class ConfigurationsCLI
21
+
22
+ end; end # module BuildTool::Commands::ConfigurationsCLI
23
+
24
+
25
+
@@ -0,0 +1,42 @@
1
+ # -*- coding: UTF-8 -*-
2
+
3
+ require 'build-tool/commands'
4
+
5
+ require 'yaml'
6
+
7
+ module BuildTool; module Commands; module Configuration
8
+
9
+ #
10
+ # BuildCommand
11
+ #
12
+ class Edit < Standard
13
+
14
+ name "edit"
15
+ description ""
16
+ long_description [
17
+ "Prints an alphabetically sorted list of configuration options. If no arguments are
18
+ given it lists all, if arguments are specified it prints those matching them." ]
19
+
20
+ def initialize_options
21
+ options.banner = "Usage: #{self.fullname} [OPTIONS]... NAMES..."
22
+ options.separator( "" )
23
+ options.separator( "Options" )
24
+ super
25
+ end
26
+
27
+ def applicable?
28
+ BuildTool::Application.instance.has_recipe?
29
+ end
30
+
31
+ def do_execute( args )
32
+ return edit_config_options( args )
33
+ end
34
+
35
+ def edit_config_options( only )
36
+ return BuildTool::Configuration.edit( only )
37
+ end
38
+
39
+ end # class
40
+
41
+ end; end; end # module BuildTool::Commands::Configuration
42
+
@@ -0,0 +1,48 @@
1
+ # -*- coding: UTF-8 -*-
2
+
3
+ require 'build-tool/commands'
4
+
5
+ module BuildTool; module Commands; module Configuration
6
+
7
+ #
8
+ # BuildCommand
9
+ #
10
+ class List < Standard
11
+
12
+ name "list"
13
+ description "Print a alphabetically sorted list of configuration options."
14
+ long_description [
15
+ "Prints an alphabetically sorted list of configuration options. If no arguments are
16
+ given it lists all, if arguments are specified it prints those matching them." ]
17
+
18
+ def initialize_options
19
+ options.banner = "Usage: #{self.fullname} [OPTIONS]... NAMES..."
20
+ options.separator( "" )
21
+ options.separator( "Options" )
22
+ super
23
+ end
24
+
25
+ def applicable?
26
+ BuildTool::Application.instance.has_recipe?
27
+ end
28
+
29
+ def do_execute( args )
30
+ return show_config_options( args )
31
+ end
32
+
33
+ def show_config_options( only )
34
+ for option in BuildTool::Setting::export(
35
+ BuildTool::Application.instance.configuration.settings,
36
+ only )
37
+ verbose( blue( "# #{option[:description].split( "\n" ).join( "\n# " ) }" ) )
38
+ info( '%-30s: %s' % [ option[:name], option[:value] ] )
39
+ verbose( "" )
40
+ end
41
+
42
+ return 0
43
+ end
44
+
45
+ end # class
46
+
47
+ end; end; end # module BuildTool::Commands::Configuration
48
+
@@ -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
 
@@ -23,13 +27,13 @@ def log?
23
27
 
24
28
  def initialize_options
25
29
 
26
- @options.banner = "Usage: #{Pathname.new($0).basename} #{self.fullname} MODULES..."
30
+ options.banner = "Usage: #{self.fullname} [OPTIONS]... MODULES..."
31
+ options.separator( "" )
32
+ options.separator( "Options" )
27
33
  @rmcache = false
28
34
  @from_scratch = false
29
35
  @clean = false
30
36
 
31
- @options.separator "Options:"
32
-
33
37
  options.on( "--[no-]clean", "Make clean before building." ) { |t|
34
38
  @clean = t
35
39
  }
@@ -52,7 +56,7 @@ def applicable?
52
56
  def is_module_ready?( mod )
53
57
  isready = true
54
58
  if !mod.checkedout?
55
- logger.warn "#{mod.name}: module not checked out -> skipping."
59
+ warn( "#{mod.name}: module not checked out -> skipping." )
56
60
  end
57
61
  return isready
58
62
  end
@@ -74,7 +78,7 @@ def do_execute_module( mod )
74
78
  configure( mod )
75
79
  end
76
80
  else
77
- logger.info "Not checked out. Skipping"
81
+ info( "Not checked out. Skipping" )
78
82
  end
79
83
  end
80
84
 
@@ -1,3 +1,6 @@
1
+ # -*- coding: UTF-8 -*-
2
+
3
+ require 'mj/tools/subprocess'
1
4
  require 'build-tool/application'
2
5
  require 'build-tool/commands'
3
6
 
@@ -16,7 +19,9 @@ class Ctags < ModuleBasedCommand
16
19
  long_description [ "Invoke ctags for the specified MODULES." ]
17
20
 
18
21
  def initialize_options
19
- @options.banner = "Usage: #{Pathname.new($0).basename} #{self.fullname} MODULES..."
22
+ options.banner = "Usage: #{self.fullname} [OPTIONS]... MODULES..."
23
+ options.separator( "" )
24
+ options.separator( "Options" )
20
25
  super
21
26
  end
22
27
 
@@ -33,8 +38,8 @@ def do_execute_module( mod )
33
38
  mod.name.gsub( '/', '-' ) + ".tags" ))
34
39
 
35
40
  else
36
- logger.warn "Module is not checked out! Use -u to check it out."
37
- logger.warn "skipped!"
41
+ warn( "Module is not checked out! Use -u to check it out." )
42
+ warn( "skipped!" )
38
43
  end
39
44
  end
40
45
 
@@ -1,3 +1,5 @@
1
+ # -*- coding: UTF-8 -*-
2
+
1
3
  require 'build-tool/commands'
2
4
 
3
5
  module BuildTool; module Commands
@@ -15,10 +17,6 @@ def applicable?
15
17
  BuildTool::Application.instance.has_recipe?
16
18
  end
17
19
 
18
- def do_execute
19
- raise NotImplementedError
20
- end
21
-
22
20
  end # class EnvironmentsCLI
23
21
 
24
22
  end; end # module BuildTool::Commands::EnvironmentsCLI
@@ -1,3 +1,5 @@
1
+ # -*- coding: UTF-8 -*-
2
+
1
3
  require 'build-tool/commands'
2
4
 
3
5
  module BuildTool; module Commands; module Environments
@@ -13,9 +15,10 @@ class List < Standard
13
15
  cmdalias "lsenv"
14
16
 
15
17
  def initialize_options
16
- @options.banner = "Usage: #{Pathname.new($0).basename} #{self.fullname}"
18
+ options.banner = "Usage: #{self.fullname} [OPTIONS]... [ENVIRONMENT]"
19
+ options.separator( "" )
20
+ options.separator( "Options" )
17
21
 
18
- @options.separator "Options:"
19
22
  @all = false
20
23
  options.on( "--all", "Show inactive environments." ) { |t|
21
24
  @all = true
@@ -26,27 +29,27 @@ def initialize_options
26
29
  def do_execute( args )
27
30
  if args.length == 0
28
31
 
29
- say "%-15s (%s)" % [ "Environment", "Inherits" ]
30
- say "------------------------------------------------------------"
32
+ info( "%-15s (%s)" % [ "Environment", "Inherits" ] )
33
+ info( "------------------------------------------------------------" )
31
34
  configuration.environments.keys.sort.each do |name|
32
35
  env = configuration.environment(name)
33
36
  next if !env.active? && !@all
34
37
  if env.parent
35
- say "%-15s %s" % [ name, env.parent.name ]
38
+ info( "%-15s %s" % [ name, env.parent.name ] )
36
39
  else
37
- say name
40
+ info( name )
38
41
  end
39
42
  end
40
43
 
41
44
  elsif args.length == 1
42
45
 
43
- say "Environment:"
46
+ info( "Environment:" )
44
47
  env = configuration.environment( args[ 0 ] )
45
48
  if env.parent
46
- say "%-15s %s" % [ "Parent", env.parent.name ]
49
+ info( "%-15s %s" % [ "Parent", env.parent.name ] )
47
50
  end
48
51
  env.vars.sort.each do |var|
49
- say " %-20s %s" % [ var + ":", env[var] ]
52
+ info( " %-20s %s" % [ var + ":", env[var] ] )
50
53
  end
51
54
 
52
55
  else
@@ -60,6 +63,6 @@ def do_execute( args )
60
63
 
61
64
  end # class
62
65
 
63
- end; end; end # module BuildTool::Commands::Modules
66
+ end; end; end # module BuildTool::Commands::Environments
64
67
 
65
68
 
@@ -1,3 +1,5 @@
1
+ # -*- coding: UTF-8 -*-
2
+
1
3
  require 'build-tool/commands'
2
4
 
3
5
  module BuildTool; module Commands; module Environments
@@ -27,7 +29,9 @@ def do_execute( args )
27
29
  end
28
30
 
29
31
  def initialize_options
30
- @options.banner = "Usage: #{Pathname.new($0).basename} #{self.fullname} MODULE"
32
+ options.banner = "Usage: #{self.fullname} [OPTIONS]... MODULE"
33
+ options.separator( "" )
34
+ options.separator( "Options" )
31
35
  super
32
36
  end
33
37
 
@@ -0,0 +1,24 @@
1
+ # -*- coding: UTF-8 -*-
2
+
3
+ require 'build-tool/commands'
4
+
5
+ module BuildTool; module Commands
6
+
7
+ class FeaturesCLI < Commands::SubCommands
8
+
9
+ name "features"
10
+ description "Feature related commands."
11
+
12
+ def initialize_options
13
+ super
14
+ end
15
+
16
+ def applicable?
17
+ BuildTool::Application.instance.has_recipe?
18
+ end
19
+
20
+ end # class FeaturesCLI
21
+
22
+ end; end # module BuildTool::Commands::FeaturesCLI
23
+
24
+
@@ -0,0 +1,70 @@
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 Disable < Standard
11
+
12
+ name 'disable'
13
+ description 'Disable 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
+ if args.length > 1
35
+ # *TODO* print better message
36
+ return usage "To many arguments."
37
+ end
38
+
39
+ for feat in args
40
+ disable_feature( feat )
41
+ end
42
+
43
+ configuration.save()
44
+
45
+ return 0
46
+ end
47
+
48
+ def disable_feature( name )
49
+ feature = configuration.features[name]
50
+
51
+ if feature.nil?
52
+ error( "Unknown feature '%s'" % name )
53
+ return -1
54
+ end
55
+
56
+ if @default and feature.default_active? == false
57
+ info( '%s: using default (disabled).' % mod.name )
58
+ feature.active = nil
59
+ else
60
+ info( '%s: disabled explicitely.' % mod.name )
61
+ feature.active = false
62
+ end
63
+ end
64
+
65
+ end # class Activate
66
+
67
+ end; end; end # module BuildTool::Commands::Modules
68
+
69
+
70
+