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
data/Manifest.txt DELETED
@@ -1,80 +0,0 @@
1
- .gitattributes
2
- .gitignore
3
- History.txt
4
- KNOWN_PROBLEMS
5
- Manifest.txt
6
- README.txt
7
- Rakefile
8
- bin/build-tool
9
- db/migrations/001_command_histories.rb
10
- db/migrations/002_module_events.rb
11
- db/migrations/003_command_histories_add_logfile.rb
12
- lib/build-tool.rb
13
- lib/build-tool/GUI.rb
14
- lib/build-tool/application.rb
15
- lib/build-tool/build-system/autoconf.rb
16
- lib/build-tool/build-system/base.rb
17
- lib/build-tool/build-system/cmake.rb
18
- lib/build-tool/build-system/custom.rb
19
- lib/build-tool/build-system/kdel10n.rb
20
- lib/build-tool/build-system/make.rb
21
- lib/build-tool/build-system/none.rb
22
- lib/build-tool/build-system/qmake.rb
23
- lib/build-tool/build-system/qt.rb
24
- lib/build-tool/cfg/lexer.rex
25
- lib/build-tool/cfg/lexer_base.rb
26
- lib/build-tool/cfg/node.rb
27
- lib/build-tool/cfg/parser.y
28
- lib/build-tool/cfg/visitor.rb
29
- lib/build-tool/cfg/parser.rb
30
- lib/build-tool/cfg/lexer.rb
31
- lib/build-tool/command_actions.rb
32
- lib/build-tool/commands.rb
33
- lib/build-tool/commands/build.rb
34
- lib/build-tool/commands/configure.rb
35
- lib/build-tool/commands/ctags.rb
36
- lib/build-tool/commands/environments.rb
37
- lib/build-tool/commands/environments/list.rb
38
- lib/build-tool/commands/environments/set.rb
39
- lib/build-tool/commands/fetch.rb
40
- lib/build-tool/commands/files.rb
41
- lib/build-tool/commands/gc.rb
42
- lib/build-tool/commands/help.rb
43
- lib/build-tool/commands/history.rb
44
- lib/build-tool/commands/info.rb
45
- lib/build-tool/commands/install.rb
46
- lib/build-tool/commands/lsfeatures.rb
47
- lib/build-tool/commands/modules.rb
48
- lib/build-tool/commands/modules/info.rb
49
- lib/build-tool/commands/modules/list.rb
50
- lib/build-tool/commands/modules/shell.rb
51
- lib/build-tool/commands/rebase.rb
52
- lib/build-tool/commands/recipes.rb
53
- lib/build-tool/commands/recipes/add.rb
54
- lib/build-tool/commands/recipes/incoming.rb
55
- lib/build-tool/commands/recipes/info.rb
56
- lib/build-tool/commands/recipes/install.rb
57
- lib/build-tool/commands/recipes/list.rb
58
- lib/build-tool/configuration.rb
59
- lib/build-tool/environment.rb
60
- lib/build-tool/errors.rb
61
- lib/build-tool/feature.rb
62
- lib/build-tool/history.rb
63
- lib/build-tool/module.rb
64
- lib/build-tool/recipe.rb
65
- lib/build-tool/repository.rb
66
- lib/build-tool/server.rb
67
- lib/build-tool/singleton.rb
68
- lib/build-tool/sshkey.rb
69
- lib/build-tool/vcs/archive.rb
70
- lib/build-tool/vcs/base.rb
71
- lib/build-tool/vcs/git-svn.rb
72
- lib/build-tool/vcs/git.rb
73
- lib/build-tool/vcs/mercurial.rb
74
- lib/build-tool/vcs/svn.rb
75
- lib/mj/error.rb
76
- lib/mj/logging.rb
77
- lib/mj/tools/ssh.rb
78
- lib/mj/tools/subprocess.rb
79
- lib/mj/vcs/git.rb
80
- lib/mj/visitor.rb
@@ -1,20 +0,0 @@
1
- require 'rubygems'
2
- require 'sequel/extensions/migration'
3
-
4
- Class.new( Sequel::Migration ) do
5
-
6
- def up
7
- create_table :command_logs do
8
- primary_key :id, :null => false
9
- String :command, :null => false
10
- DateTime :started_at
11
- DateTime :finished_at
12
- Integer :state, :default => 0, :null => false
13
- end
14
- end
15
-
16
- def down
17
- drop_table :command_logs
18
- end
19
-
20
- end
@@ -1,24 +0,0 @@
1
- require 'rubygems'
2
- require 'sequel/extensions/migration'
3
-
4
- Class.new( Sequel::Migration ) do
5
-
6
- def up
7
- create_table :module_logs do
8
- primary_key :id
9
- foreign_key :command_log_id, :command_logs, :null => false
10
- String :module, :null => false
11
- String :event, :size => 20, :null => false
12
- String :logfile
13
- DateTime :started_at
14
- DateTime :finished_at
15
- Integer :state, :default => 0, :null => false
16
- end
17
- end
18
-
19
- def down
20
- drop_table :module_events
21
- end
22
-
23
- end
24
-
@@ -1,19 +0,0 @@
1
- require 'rubygems'
2
- require 'sequel/extensions/migration'
3
-
4
- Class.new( Sequel::Migration ) do
5
-
6
- def up
7
- alter_table :command_logs do
8
- add_column :logdir, String
9
- end
10
- end
11
-
12
- def down
13
- alter_table :command_logs do
14
- remove_column :logdir
15
- end
16
- end
17
-
18
- end
19
-
@@ -1,360 +0,0 @@
1
- #--
2
- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
3
- # All rights reserved.
4
- # See LICENSE.txt for permissions.
5
- #++
6
-
7
- module Gem
8
-
9
- ##
10
- # Module that defines the default UserInteraction. Any class including this
11
- # module will have access to the +ui+ method that returns the default UI.
12
-
13
- module DefaultUserInteraction
14
-
15
- ##
16
- # The default UI is a class variable of the singleton class for this
17
- # module.
18
-
19
- @ui = nil
20
-
21
- ##
22
- # Return the default UI.
23
-
24
- def self.ui
25
- @ui ||= Gem::ConsoleUI.new
26
- end
27
-
28
- ##
29
- # Set the default UI. If the default UI is never explicitly set, a simple
30
- # console based UserInteraction will be used automatically.
31
-
32
- def self.ui=(new_ui)
33
- @ui = new_ui
34
- end
35
-
36
- ##
37
- # Use +new_ui+ for the duration of +block+.
38
-
39
- def self.use_ui(new_ui)
40
- old_ui = @ui
41
- @ui = new_ui
42
- yield
43
- ensure
44
- @ui = old_ui
45
- end
46
-
47
- ##
48
- # See DefaultUserInteraction::ui
49
-
50
- def ui
51
- DefaultUserInteraction.ui
52
- end
53
-
54
- ##
55
- # See DefaultUserInteraction::ui=
56
-
57
- def ui=(new_ui)
58
- DefaultUserInteraction.ui = new_ui
59
- end
60
-
61
- ##
62
- # See DefaultUserInteraction::use_ui
63
-
64
- def use_ui(new_ui, &block)
65
- DefaultUserInteraction.use_ui(new_ui, &block)
66
- end
67
-
68
- end
69
-
70
- ##
71
- # Make the default UI accessable without the "ui." prefix. Classes
72
- # including this module may use the interaction methods on the default UI
73
- # directly. Classes may also reference the ui and ui= methods.
74
- #
75
- # Example:
76
- #
77
- # class X
78
- # include Gem::UserInteraction
79
- #
80
- # def get_answer
81
- # n = ask("What is the meaning of life?")
82
- # end
83
- # end
84
-
85
- module UserInteraction
86
-
87
- include DefaultUserInteraction
88
-
89
- [:alert,
90
- :alert_error,
91
- :alert_warning,
92
- :ask,
93
- :ask_yes_no,
94
- :choose_from_list,
95
- :say,
96
- :terminate_interaction ].each do |methname|
97
- class_eval %{
98
- def #{methname}(*args)
99
- ui.#{methname}(*args)
100
- end
101
- }, __FILE__, __LINE__
102
- end
103
- end
104
-
105
- ##
106
- # StreamUI implements a simple stream based user interface.
107
-
108
- class StreamUI
109
-
110
- attr_reader :ins, :outs, :errs
111
-
112
- def initialize(in_stream, out_stream, err_stream=STDERR)
113
- @ins = in_stream
114
- @outs = out_stream
115
- @errs = err_stream
116
- end
117
-
118
- ##
119
- # Choose from a list of options. +question+ is a prompt displayed above
120
- # the list. +list+ is a list of option strings. Returns the pair
121
- # [option_name, option_index].
122
-
123
- def choose_from_list(question, list)
124
- @outs.puts question
125
-
126
- list.each_with_index do |item, index|
127
- @outs.puts " #{index+1}. #{item}"
128
- end
129
-
130
- @outs.print "> "
131
- @outs.flush
132
-
133
- result = @ins.gets
134
-
135
- return nil, nil unless result
136
-
137
- result = result.strip.to_i - 1
138
- return list[result], result
139
- end
140
-
141
- ##
142
- # Ask a question. Returns a true for yes, false for no. If not connected
143
- # to a tty, raises an exception if default is nil, otherwise returns
144
- # default.
145
-
146
- def ask_yes_no(question, default=nil)
147
- unless @ins.tty? then
148
- if default.nil? then
149
- raise Gem::OperationNotSupportedError,
150
- "Not connected to a tty and no default specified"
151
- else
152
- return default
153
- end
154
- end
155
-
156
- qstr = case default
157
- when nil
158
- 'yn'
159
- when true
160
- 'Yn'
161
- else
162
- 'yN'
163
- end
164
-
165
- result = nil
166
-
167
- while result.nil?
168
- result = ask("#{question} [#{qstr}]")
169
- result = case result
170
- when /^[Yy].*/
171
- true
172
- when /^[Nn].*/
173
- false
174
- when /^$/
175
- default
176
- else
177
- nil
178
- end
179
- end
180
-
181
- return result
182
- end
183
-
184
- ##
185
- # Ask a question. Returns an answer if connected to a tty, nil otherwise.
186
-
187
- def ask(question)
188
- return nil if not @ins.tty?
189
-
190
- @outs.print(question + " ")
191
- @outs.flush
192
-
193
- result = @ins.gets
194
- result.chomp! if result
195
- result
196
- end
197
-
198
- ##
199
- # Display a statement.
200
-
201
- def say(statement="")
202
- @outs.puts statement
203
- end
204
-
205
- ##
206
- # Display an informational alert. Will ask +question+ if it is not nil.
207
-
208
- def alert(statement, question=nil)
209
- @outs.puts "INFO: #{statement}"
210
- ask(question) if question
211
- end
212
-
213
- ##
214
- # Display a warning in a location expected to get error messages. Will
215
- # ask +question+ if it is not nil.
216
-
217
- def alert_warning(statement, question=nil)
218
- @errs.puts "WARNING: #{statement}"
219
- ask(question) if question
220
- end
221
-
222
- ##
223
- # Display an error message in a location expected to get error messages.
224
- # Will ask +question+ if it is not nil.
225
-
226
- def alert_error(statement, question=nil)
227
- @errs.puts "ERROR: #{statement}"
228
- ask(question) if question
229
- end
230
-
231
- ##
232
- # Terminate the application with exit code +status+, running any exit
233
- # handlers that might have been defined.
234
-
235
- def terminate_interaction(status = 0)
236
- raise Gem::SystemExitException, status
237
- end
238
-
239
- ##
240
- # Return a progress reporter object chosen from the current verbosity.
241
-
242
- def progress_reporter(*args)
243
- case Gem.configuration.verbose
244
- when nil, false
245
- SilentProgressReporter.new(@outs, *args)
246
- when true
247
- SimpleProgressReporter.new(@outs, *args)
248
- else
249
- VerboseProgressReporter.new(@outs, *args)
250
- end
251
- end
252
-
253
- ##
254
- # An absolutely silent progress reporter.
255
-
256
- class SilentProgressReporter
257
- attr_reader :count
258
-
259
- def initialize(out_stream, size, initial_message, terminal_message = nil)
260
- end
261
-
262
- def updated(message)
263
- end
264
-
265
- def done
266
- end
267
- end
268
-
269
- ##
270
- # A basic dotted progress reporter.
271
-
272
- class SimpleProgressReporter
273
- include DefaultUserInteraction
274
-
275
- attr_reader :count
276
-
277
- def initialize(out_stream, size, initial_message,
278
- terminal_message = "complete")
279
- @out = out_stream
280
- @total = size
281
- @count = 0
282
- @terminal_message = terminal_message
283
-
284
- @out.puts initial_message
285
- end
286
-
287
- ##
288
- # Prints out a dot and ignores +message+.
289
-
290
- def updated(message)
291
- @count += 1
292
- @out.print "."
293
- @out.flush
294
- end
295
-
296
- ##
297
- # Prints out the terminal message.
298
-
299
- def done
300
- @out.puts "\n#{@terminal_message}"
301
- end
302
-
303
- end
304
-
305
- ##
306
- # A progress reporter that prints out messages about the current progress.
307
-
308
- class VerboseProgressReporter
309
- include DefaultUserInteraction
310
-
311
- attr_reader :count
312
-
313
- def initialize(out_stream, size, initial_message,
314
- terminal_message = 'complete')
315
- @out = out_stream
316
- @total = size
317
- @count = 0
318
- @terminal_message = terminal_message
319
-
320
- @out.puts initial_message
321
- end
322
-
323
- ##
324
- # Prints out the position relative to the total and the +message+.
325
-
326
- def updated(message)
327
- @count += 1
328
- @out.puts "#{@count}/#{@total}: #{message}"
329
- end
330
-
331
- ##
332
- # Prints out the terminal message.
333
-
334
- def done
335
- @out.puts @terminal_message
336
- end
337
- end
338
- end
339
-
340
- ##
341
- # Subclass of StreamUI that instantiates the user interaction using STDIN,
342
- # STDOUT, and STDERR.
343
-
344
- class ConsoleUI < StreamUI
345
- def initialize
346
- super(STDIN, STDOUT, STDERR)
347
- end
348
- end
349
-
350
- ##
351
- # SilentUI is a UI choice that is absolutely silent.
352
-
353
- class SilentUI
354
- def method_missing(sym, *args, &block)
355
- self
356
- end
357
- end
358
-
359
- end
360
-