francois-piston 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.yml +2 -2
- data/lib/piston/cli.rb +95 -365
- data/lib/piston/commands/convert.rb +8 -2
- data/lib/piston/commands/diff.rb +11 -0
- data/lib/piston/commands/import.rb +23 -0
- data/lib/piston/commands/info.rb +10 -0
- data/lib/piston/commands/lock_unlock.rb +5 -0
- data/lib/piston/commands/status.rb +10 -0
- data/lib/piston/commands/update.rb +10 -0
- data/lib/piston/commands/upgrade.rb +6 -0
- data/lib/piston/git/working_copy.rb +4 -1
- data/lib/piston/svn/revision.rb +1 -1
- data/lib/piston/svn/working_copy.rb +4 -2
- data/lib/piston/version.rb +8 -4
- data/lib/piston.rb +2 -1
- data/test/integration_helpers.rb +1 -0
- data/test/test_helper.rb +11 -2
- metadata +6 -6
data/VERSION.yml
CHANGED
data/lib/piston/cli.rb
CHANGED
@@ -1,391 +1,121 @@
|
|
1
|
-
require "main"
|
2
1
|
require "log4r"
|
3
2
|
require "activesupport"
|
4
3
|
require "piston/version"
|
5
|
-
require "
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
description "Verbosity level (0 to 5, 0 being the default)"
|
19
|
-
}
|
20
|
-
option("quiet", "q") { default false }
|
21
|
-
option("force") { default false }
|
22
|
-
option("dry-run") { default false }
|
23
|
-
end
|
24
|
-
|
25
|
-
mixin :revision_or_commit do
|
26
|
-
option "revision", "r" do
|
27
|
-
argument_required
|
28
|
-
description "The revision you wish to operate on"
|
29
|
-
end
|
30
|
-
|
31
|
-
option "commit" do
|
32
|
-
argument_required
|
33
|
-
description "The commit you wish to operate on"
|
34
|
-
end
|
35
|
-
|
36
|
-
def target_revision
|
37
|
-
case
|
38
|
-
when params["revision"].given?
|
39
|
-
params["revision"].value
|
40
|
-
when params["commit"].given?
|
41
|
-
params["commit"].value
|
42
|
-
else
|
43
|
-
:head
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
mixin :lock_options do
|
49
|
-
option("lock") do
|
50
|
-
default false
|
51
|
-
description "Automatically lock down the revision/commit to protect against blanket updates"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
mode "import" do
|
56
|
-
mixin :standard_options
|
57
|
-
mixin :revision_or_commit
|
58
|
-
mixin :lock_options
|
59
|
-
|
60
|
-
argument "repository" do
|
61
|
-
required
|
62
|
-
description "The repository you wish to Pistonize"
|
63
|
-
end
|
64
|
-
|
65
|
-
argument "directory" do
|
66
|
-
optional
|
67
|
-
default nil
|
68
|
-
description "Where to put the Pistonized repository"
|
69
|
-
end
|
70
|
-
|
71
|
-
option("repository-type") do
|
72
|
-
argument :required
|
73
|
-
default nil
|
74
|
-
description "Force a specific repository type, for when it's not possible to guess"
|
75
|
-
end
|
76
|
-
|
77
|
-
logger_level Logger::DEBUG
|
78
|
-
def run
|
79
|
-
configure_logging!
|
80
|
-
|
81
|
-
if params["revision"].given? && params["commit"].given? then
|
82
|
-
raise ArgumentError, "Only one of --revision or --commit can be given. Received both."
|
83
|
-
end
|
84
|
-
|
85
|
-
cmd = Piston::Commands::Import.new(:verbose => params["verbose"].value,
|
86
|
-
:quiet => params["quiet"].value,
|
87
|
-
:force => params["force"].value,
|
88
|
-
:dry_run => params["dry-run"].value,
|
89
|
-
:repository_type => params["repository-type"].value)
|
90
|
-
|
91
|
-
begin
|
92
|
-
cmd.run(params[:repository].value, self.target_revision, params[:directory].value)
|
93
|
-
rescue Piston::Repository::UnhandledUrl => e
|
94
|
-
supported_types = Piston::Repository.handlers.collect do |handler|
|
95
|
-
handler.repository_type
|
96
|
-
end
|
97
|
-
puts "Unsure how to handle:"
|
98
|
-
puts "\t#{params[:repository].value.inspect}."
|
99
|
-
puts "You should try using --repository-type. Supported types are:"
|
100
|
-
supported_types.each do |type|
|
101
|
-
puts "\t#{type}"
|
4
|
+
require "optparse"
|
5
|
+
|
6
|
+
module Piston
|
7
|
+
class Cli
|
8
|
+
def self.start(args=ARGV)
|
9
|
+
options = {:lock => false, :force => false, :dry_run => false, :quiet => false, :verbose => 0}
|
10
|
+
opts = OptionParser.new do |opts|
|
11
|
+
opts.banner = "Usage: piston COMMAND [options]"
|
12
|
+
opts.version = Piston::VERSION::STRING
|
13
|
+
|
14
|
+
# Many!!!
|
15
|
+
opts.on("-r", "--revision REVISION", "Revision to operate on") do |r|
|
16
|
+
options[:revision] = r.to_i
|
102
17
|
end
|
103
|
-
exit_failure!
|
104
|
-
end
|
105
|
-
|
106
|
-
# Lock the working copy, if the user asked for it
|
107
|
-
cmd = Piston::Commands::LockUnlock.new(:verbose => params["verbose"].value,
|
108
|
-
:quiet => params["quiet"].value,
|
109
|
-
:force => params["force"].value,
|
110
|
-
:dry_run => params["dry-run"].value)
|
111
|
-
cmd.run(params["directory"].value, params["lock"].value) if params["lock"].value
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
mode "convert" do
|
116
|
-
mixin :standard_options
|
117
|
-
|
118
|
-
argument "directories" do
|
119
|
-
argument_required
|
120
|
-
optional
|
121
|
-
arity -1
|
122
|
-
description "Which directory/directories to convert from svn:externals to Piston. Not specifying this argument recursively converts the whole directory tree starting from the current dir."
|
123
|
-
end
|
124
|
-
|
125
|
-
logger_level Logger::DEBUG
|
126
|
-
def run
|
127
|
-
configure_logging!
|
128
|
-
|
129
|
-
cmd = Piston::Commands::Convert.new(:verbose => params["verbose"].value,
|
130
|
-
:quiet => params["quiet"].value,
|
131
|
-
:force => params["force"].value)
|
132
|
-
dirs = cmd.run(params["directories"].values.map {|dir| Pathname.new(dir)})
|
133
|
-
puts "#{dirs.length} directories converted"
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
mode "upgrade" do
|
138
|
-
mixin :standard_options
|
139
|
-
|
140
|
-
argument "directories" do
|
141
|
-
optional
|
142
|
-
default '.'
|
143
|
-
arity -1
|
144
|
-
description "Which directory/directories to convert from Piston 1.x to Piston 2.x. Not specifying this argument recursively converts the whole directory tree starting from the current dir."
|
145
|
-
end
|
146
|
-
|
147
|
-
logger_level Logger::DEBUG
|
148
|
-
def run
|
149
|
-
configure_logging!
|
150
|
-
|
151
|
-
cmd = Piston::Commands::Upgrade.new(:verbose => params["verbose"].value,
|
152
|
-
:quiet => params["quiet"].value,
|
153
|
-
:force => params["force"].value)
|
154
|
-
dirs = cmd.run(params["directories"].values.map { |dir| Pathname.new(dir).expand_path })
|
155
|
-
puts "#{dirs.length} directories upgraded"
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
mode "lock" do
|
160
|
-
mixin :standard_options
|
161
|
-
|
162
|
-
argument "directory" do
|
163
|
-
argument_required
|
164
|
-
optional
|
165
|
-
description "Which directory to lock"
|
166
|
-
end
|
167
18
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
cmd = Piston::Commands::LockUnlock.new(:wcdir => params["directory"].value,
|
173
|
-
:verbose => params["verbose"].value,
|
174
|
-
:quiet => params["quiet"].value,
|
175
|
-
:force => params["force"].value)
|
176
|
-
begin
|
177
|
-
cmd.run(true)
|
178
|
-
puts "#{params["directory"].value} locked"
|
179
|
-
rescue Piston::WorkingCopy::NotWorkingCopy
|
180
|
-
puts "The #{params["directory"].value} is not Pistonized"
|
181
|
-
end
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
mode "unlock" do
|
186
|
-
mixin :standard_options
|
187
|
-
|
188
|
-
argument "directory" do
|
189
|
-
argument_required
|
190
|
-
optional
|
191
|
-
description "Which directory to lock"
|
192
|
-
end
|
193
|
-
|
194
|
-
logger_level Logger::DEBUG
|
195
|
-
def run
|
196
|
-
configure_logging!
|
197
|
-
|
198
|
-
cmd = Piston::Commands::LockUnlock.new(:wcdir => params["directory"].value,
|
199
|
-
:verbose => params["verbose"].value,
|
200
|
-
:quiet => params["quiet"].value,
|
201
|
-
:force => params["force"].value)
|
202
|
-
begin
|
203
|
-
cmd.run(false)
|
204
|
-
puts "#{params["directory"].value} unlocked"
|
205
|
-
rescue Piston::WorkingCopy::NotWorkingCopy
|
206
|
-
puts "The #{params["directory"].value} is not Pistonized"
|
207
|
-
end
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
mode "status" do
|
212
|
-
mixin :standard_options
|
19
|
+
opts.on("--commit TREEISH", "Commit to operate on") do |c|
|
20
|
+
options[:commit] = c
|
21
|
+
end
|
213
22
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
23
|
+
# Import
|
24
|
+
opts.on("--repository-type TYPE", [:git, :svn], "Force selection of a repository handler (git or svn)") do |type|
|
25
|
+
options[:repository_type] = type
|
26
|
+
end
|
218
27
|
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
description "Which directory/directories to get status. Not specifying this argument recursively gets status from the whole directory tree starting from the current dir."
|
224
|
-
end
|
28
|
+
# Import, Update and Switch
|
29
|
+
opts.on("--lock", "Lock down the revision against mass-updates") do
|
30
|
+
options[:lock] = true
|
31
|
+
end
|
225
32
|
|
226
|
-
|
227
|
-
|
228
|
-
|
33
|
+
opts.on("--show-updates", "Query the remote repository for out-of-dateness information") do
|
34
|
+
options[:show_updates] = true
|
35
|
+
end
|
229
36
|
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
:force => params["force"].value)
|
234
|
-
params["directories"].values.each do |path|
|
235
|
-
begin
|
236
|
-
cmd.run(Pathname.new(path).expand_path)
|
237
|
-
rescue Piston::WorkingCopy::NotWorkingCopy
|
238
|
-
puts "#{path} is not a working copy"
|
37
|
+
# All
|
38
|
+
opts.on("--force", "Force the operation to go ahead") do
|
39
|
+
options[:force] = true
|
239
40
|
end
|
240
|
-
end
|
241
|
-
end
|
242
|
-
end
|
243
|
-
|
244
|
-
mode "diff" do
|
245
|
-
mixin :standard_options
|
246
41
|
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
end
|
42
|
+
opts.on("--dry-run", "Run but do not change anything") do
|
43
|
+
options[:dry_run] = true
|
44
|
+
end
|
251
45
|
|
252
|
-
|
253
|
-
|
254
|
-
|
46
|
+
opts.on("-q", "--quiet", "Operate silently") do
|
47
|
+
options[:quiet] = true
|
48
|
+
end
|
255
49
|
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
:force => params["force"].value)
|
260
|
-
begin
|
261
|
-
cmd.run
|
262
|
-
rescue Piston::WorkingCopy::NotWorkingCopy
|
263
|
-
puts "#{params["directory"].value} is not Pistonized"
|
50
|
+
opts.on("-v", "--verbose [LEVEL]", ("0".."5").to_a, "Increase verbosity (default 0)") do |level|
|
51
|
+
options[:verbose] = level.to_i || 1
|
52
|
+
end
|
264
53
|
end
|
265
|
-
|
266
|
-
end
|
267
|
-
|
268
|
-
mode "info" do
|
269
|
-
mixin :standard_options
|
270
|
-
|
271
|
-
argument "directory" do
|
272
|
-
argument_required
|
273
|
-
optional
|
274
|
-
description "Which directory to get info"
|
275
|
-
end
|
276
|
-
|
277
|
-
logger_level Logger::DEBUG
|
278
|
-
def run
|
279
|
-
configure_logging!
|
54
|
+
opts.parse!(args)
|
280
55
|
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
:force => params["force"].value)
|
285
|
-
begin
|
286
|
-
puts cmd.run(params["directory"].value)
|
287
|
-
rescue Piston::WorkingCopy::NotWorkingCopy
|
288
|
-
puts "#{params["directory"].value} is not Pistonized"
|
56
|
+
if args.empty?
|
57
|
+
puts opts.help
|
58
|
+
exit 0
|
289
59
|
end
|
290
|
-
end
|
291
|
-
end
|
292
|
-
|
293
|
-
mode "update" do
|
294
|
-
mixin :standard_options
|
295
|
-
mixin :revision_or_commit
|
296
|
-
mixin :lock_options
|
297
|
-
|
298
|
-
argument("directory") do
|
299
|
-
optional
|
300
|
-
default '.'
|
301
|
-
end
|
302
|
-
|
303
|
-
logger_level Logger::DEBUG
|
304
|
-
def run
|
305
|
-
configure_logging!
|
306
60
|
|
307
|
-
if
|
61
|
+
if options.has_key?(:revision) && options.has_key?(:commit) then
|
308
62
|
raise ArgumentError, "Only one of --revision or --commit can be given. Received both."
|
309
63
|
end
|
310
64
|
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
65
|
+
configure_logging(options)
|
66
|
+
command = Piston::Commands.const_get(args.shift.classify).new(options)
|
67
|
+
command.start(*args)
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.configure_logging(options)
|
71
|
+
Log4r::Logger.root.level = Log4r::DEBUG
|
72
|
+
|
73
|
+
case options[:verbose]
|
74
|
+
when 0
|
75
|
+
main_level = Log4r::INFO
|
76
|
+
handler_level = Log4r::WARN
|
77
|
+
client_level = Log4r::WARN
|
78
|
+
client_out_level = Log4r::WARN
|
79
|
+
stdout_level = Log4r::INFO
|
80
|
+
when 1
|
81
|
+
main_level = Log4r::DEBUG
|
82
|
+
handler_level = Log4r::INFO
|
83
|
+
client_level = Log4r::WARN
|
84
|
+
client_out_level = Log4r::WARN
|
85
|
+
stdout_level = Log4r::DEBUG
|
86
|
+
when 2
|
87
|
+
main_level = Log4r::DEBUG
|
88
|
+
handler_level = Log4r::DEBUG
|
89
|
+
client_level = Log4r::INFO
|
90
|
+
client_out_level = Log4r::WARN
|
91
|
+
stdout_level = Log4r::DEBUG
|
92
|
+
when 3
|
93
|
+
main_level = Log4r::DEBUG
|
94
|
+
handler_level = Log4r::DEBUG
|
95
|
+
client_level = Log4r::DEBUG
|
96
|
+
client_out_level = Log4r::INFO
|
97
|
+
stdout_level = Log4r::DEBUG
|
98
|
+
when 4, 5
|
99
|
+
main_level = Log4r::DEBUG
|
100
|
+
handler_level = Log4r::DEBUG
|
101
|
+
client_level = Log4r::DEBUG
|
102
|
+
client_out_level = Log4r::DEBUG
|
103
|
+
stdout_level = Log4r::DEBUG
|
104
|
+
else
|
105
|
+
raise ArgumentError, "Did not expect verbosity to be outside 0..5: #{options[:verbose]}"
|
323
106
|
end
|
324
|
-
end
|
325
|
-
end
|
326
107
|
|
327
|
-
|
108
|
+
Log4r::Logger.new("main", main_level)
|
109
|
+
Log4r::Logger.new("handler", handler_level)
|
110
|
+
Log4r::Logger.new("handler::client", client_level)
|
111
|
+
Log4r::Logger.new("handler::client::out", client_out_level)
|
328
112
|
|
329
|
-
|
330
|
-
if params["version"].given? || ARGV.first == "version" then
|
331
|
-
puts Piston.version_message
|
332
|
-
exit_success!
|
333
|
-
elsif ARGV.empty?
|
334
|
-
puts Piston.version_message
|
335
|
-
puts "\nNo mode given. Call with help to find out the available options."
|
336
|
-
exit_failure!
|
337
|
-
else
|
338
|
-
puts "Unrecognized mode: #{ARGV.first.inspect}. Use the help mode to find the available options."
|
339
|
-
exit_warn!
|
340
|
-
end
|
341
|
-
end
|
113
|
+
Log4r::StdoutOutputter.new("stdout", :level => stdout_level)
|
342
114
|
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
case params["verbose"].value
|
347
|
-
when 0
|
348
|
-
main_level = Log4r::INFO
|
349
|
-
handler_level = Log4r::WARN
|
350
|
-
client_level = Log4r::WARN
|
351
|
-
client_out_level = Log4r::WARN
|
352
|
-
stdout_level = Log4r::INFO
|
353
|
-
when 1
|
354
|
-
main_level = Log4r::DEBUG
|
355
|
-
handler_level = Log4r::INFO
|
356
|
-
client_level = Log4r::WARN
|
357
|
-
client_out_level = Log4r::WARN
|
358
|
-
stdout_level = Log4r::DEBUG
|
359
|
-
when 2
|
360
|
-
main_level = Log4r::DEBUG
|
361
|
-
handler_level = Log4r::DEBUG
|
362
|
-
client_level = Log4r::INFO
|
363
|
-
client_out_level = Log4r::WARN
|
364
|
-
stdout_level = Log4r::DEBUG
|
365
|
-
when 3
|
366
|
-
main_level = Log4r::DEBUG
|
367
|
-
handler_level = Log4r::DEBUG
|
368
|
-
client_level = Log4r::DEBUG
|
369
|
-
client_out_level = Log4r::INFO
|
370
|
-
stdout_level = Log4r::DEBUG
|
371
|
-
when 4, 5
|
372
|
-
main_level = Log4r::DEBUG
|
373
|
-
handler_level = Log4r::DEBUG
|
374
|
-
client_level = Log4r::DEBUG
|
375
|
-
client_out_level = Log4r::DEBUG
|
376
|
-
stdout_level = Log4r::DEBUG
|
377
|
-
else
|
378
|
-
raise ArgumentError, "Did not expect verbosity to be outside 0..5: #{params["verbose"].value}"
|
115
|
+
Log4r::Logger["main"].add "stdout"
|
116
|
+
Log4r::Logger["handler"].add "stdout"
|
379
117
|
end
|
380
|
-
|
381
|
-
Log4r::Logger.new("main", main_level)
|
382
|
-
Log4r::Logger.new("handler", handler_level)
|
383
|
-
Log4r::Logger.new("handler::client", client_level)
|
384
|
-
Log4r::Logger.new("handler::client::out", client_out_level)
|
385
|
-
|
386
|
-
Log4r::StdoutOutputter.new("stdout", :level => stdout_level)
|
387
|
-
|
388
|
-
Log4r::Logger["main"].add "stdout"
|
389
|
-
Log4r::Logger["handler"].add "stdout"
|
390
118
|
end
|
391
|
-
|
119
|
+
end
|
120
|
+
|
121
|
+
Piston::Cli.start
|
@@ -21,6 +21,12 @@ module Piston
|
|
21
21
|
wc.remove_external_references(*targets)
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
25
|
-
|
24
|
+
|
25
|
+
def start(*args)
|
26
|
+
targets = args.flatten.map {|d| Pathname.new(d).expand_path}
|
27
|
+
run(targets)
|
28
|
+
puts "#{targets.length} directories converted"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
26
32
|
end
|
data/lib/piston/commands/diff.rb
CHANGED
@@ -7,6 +7,17 @@ module Piston
|
|
7
7
|
working_copy = working_copy!(options[:wcdir])
|
8
8
|
working_copy.diff
|
9
9
|
end
|
10
|
+
|
11
|
+
def start(*args)
|
12
|
+
args.flatten.map {|d| Pathname.new(d).expand_path}.each do |wcdir|
|
13
|
+
begin
|
14
|
+
options[:wcdir] = wcdir
|
15
|
+
run
|
16
|
+
rescue Piston::WorkingCopy::NotWorkingCopy
|
17
|
+
puts "#{wcdir} is not a working copy"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
10
21
|
end
|
11
22
|
end
|
12
23
|
end
|
@@ -38,6 +38,29 @@ module Piston
|
|
38
38
|
working_copy.import(revision, options[:lock])
|
39
39
|
logger.info {"Imported #{revision} from #{repository}"}
|
40
40
|
end
|
41
|
+
|
42
|
+
def start(*args)
|
43
|
+
repository_url = args.shift
|
44
|
+
wcdir = args.shift
|
45
|
+
|
46
|
+
raise ArgumentError, "Required REPOSITORY argument missing" if repository_url.blank?
|
47
|
+
|
48
|
+
begin
|
49
|
+
self.run(repository_url, options[:revision] || options[:commit] || :head, wcdir)
|
50
|
+
rescue Piston::Repository::UnhandledUrl => e
|
51
|
+
supported_types = Piston::Repository.handlers.collect do |handler|
|
52
|
+
handler.repository_type
|
53
|
+
end
|
54
|
+
puts "Unsure how to handle:"
|
55
|
+
puts "\t#{repository_url.inspect}."
|
56
|
+
puts "You should try using --repository-type. Supported types are:"
|
57
|
+
supported_types.each do |type|
|
58
|
+
puts "\t#{type}"
|
59
|
+
end
|
60
|
+
|
61
|
+
exit 1
|
62
|
+
end
|
63
|
+
end
|
41
64
|
end
|
42
65
|
end
|
43
66
|
end
|
data/lib/piston/commands/info.rb
CHANGED
@@ -9,6 +9,16 @@ module Piston
|
|
9
9
|
working_copy = working_copy!(wcdir)
|
10
10
|
working_copy.info.to_yaml
|
11
11
|
end
|
12
|
+
|
13
|
+
def start(*args)
|
14
|
+
args.flatten.map {|d| Pathname.new(d).expand_path}.each do |wcdir|
|
15
|
+
begin
|
16
|
+
run(wcdir)
|
17
|
+
rescue Piston::WorkingCopy::NotWorkingCopy
|
18
|
+
puts "#{wcdir} is not a working copy"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
12
22
|
end
|
13
23
|
end
|
14
24
|
end
|
@@ -35,6 +35,16 @@ module Piston
|
|
35
35
|
def show_updates
|
36
36
|
options[:show_updates]
|
37
37
|
end
|
38
|
+
|
39
|
+
def start(*args)
|
40
|
+
args.flatten.map {|d| Pathname.new(d).expand_path}.each do |wcdir|
|
41
|
+
begin
|
42
|
+
run(wcdir)
|
43
|
+
rescue Piston::WorkingCopy::NotWorkingCopy
|
44
|
+
puts "#{wcdir} is not a working copy"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
38
48
|
end
|
39
49
|
end
|
40
50
|
end
|
@@ -29,6 +29,16 @@ module Piston
|
|
29
29
|
logger.info {"Upstream #{repository} was unchanged from #{from_revision}"}
|
30
30
|
end
|
31
31
|
end
|
32
|
+
|
33
|
+
def start(*args)
|
34
|
+
args.flatten.map {|d| Pathname.new(d).expand_path}.each do |wcdir|
|
35
|
+
begin
|
36
|
+
run(wcdir, options[:revision] || options[:commit] || :head)
|
37
|
+
rescue Piston::WorkingCopy::NotWorkingCopy
|
38
|
+
puts "#{wcdir} is not a working copy"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
32
42
|
end
|
33
43
|
end
|
34
44
|
end
|
data/lib/piston/svn/revision.rb
CHANGED
@@ -64,7 +64,7 @@ module Piston
|
|
64
64
|
def each
|
65
65
|
raise ArgumentError, "Revision #{revision} of #{repository.url} was never checked out -- can't iterate over files" unless @dir
|
66
66
|
|
67
|
-
svn(:ls, "--recursive", @dir).each do |relpath|
|
67
|
+
svn(:ls, "--recursive", @dir).split("\n").each do |relpath|
|
68
68
|
next if relpath =~ %r{/$}
|
69
69
|
yield relpath.chomp
|
70
70
|
end
|
@@ -70,14 +70,16 @@ module Piston
|
|
70
70
|
|
71
71
|
def finalize
|
72
72
|
targets = []
|
73
|
-
Dir[path + "*"].each do |item|
|
73
|
+
Dir[(path + "*").to_s].each do |item|
|
74
74
|
svn(:add, item)
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
78
|
def add(added)
|
79
79
|
added.each do |item|
|
80
|
-
|
80
|
+
target = path + item
|
81
|
+
target.mkdir unless target.exist?
|
82
|
+
svn(:add, target)
|
81
83
|
end
|
82
84
|
end
|
83
85
|
|
data/lib/piston/version.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
module Piston #:nodoc:
|
2
2
|
module VERSION #:nodoc:
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
def self.config
|
4
|
+
@@version ||= YAML.load_file(File.dirname(__FILE__) + "/../../VERSION.yml")
|
5
|
+
end
|
6
6
|
|
7
|
-
|
7
|
+
def self.read_version
|
8
|
+
"%s.%s.%s" % [config[:major], config[:minor], config[:patch]]
|
9
|
+
end
|
10
|
+
|
11
|
+
STRING = read_version
|
8
12
|
end
|
9
13
|
end
|
data/lib/piston.rb
CHANGED
@@ -6,13 +6,14 @@ require "piston/working_copy"
|
|
6
6
|
|
7
7
|
require "piston/git"
|
8
8
|
require "piston/svn"
|
9
|
+
require "piston/commands"
|
9
10
|
|
10
11
|
require "pathname"
|
11
12
|
|
12
13
|
module Piston
|
13
14
|
class << self
|
14
15
|
def version_message
|
15
|
-
"Piston %s\nCopyright 2006-2008,
|
16
|
+
"Piston %s\nCopyright 2006-2008, Francois Beausoleil <francois@teksol.info>\nhttp://piston.rubyforge.org/\nDistributed under an MIT-like license." % Piston::VERSION::STRING
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
data/test/integration_helpers.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -3,6 +3,9 @@ require "rubygems"
|
|
3
3
|
require "mocha"
|
4
4
|
require "log4r"
|
5
5
|
require "fileutils"
|
6
|
+
require "pathname"
|
7
|
+
require "piston"
|
8
|
+
require "active_support"
|
6
9
|
|
7
10
|
begin
|
8
11
|
require "turn"
|
@@ -10,7 +13,6 @@ rescue LoadError
|
|
10
13
|
# NOP: ignore, this is not a real dependency
|
11
14
|
end
|
12
15
|
|
13
|
-
require File.expand_path("#{File.dirname(__FILE__)}/../config/requirements")
|
14
16
|
require File.expand_path("#{File.dirname(__FILE__)}/integration_helpers")
|
15
17
|
require "find"
|
16
18
|
|
@@ -48,7 +50,14 @@ class Piston::TestCase < Test::Unit::TestCase
|
|
48
50
|
end
|
49
51
|
|
50
52
|
def run(*args)
|
51
|
-
|
53
|
+
test_name = if self.respond_to?(:name) then
|
54
|
+
name
|
55
|
+
elsif self.respond_to?(:method_name) then
|
56
|
+
method_name
|
57
|
+
else
|
58
|
+
raise "Don't know how to get the test's name: neither #name or #method_name is available"
|
59
|
+
end
|
60
|
+
return if test_name.to_sym == :default_test && self.class == Piston::TestCase
|
52
61
|
super
|
53
62
|
end
|
54
63
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: francois-piston
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Francois Beausoleil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-04-01 00:00:00 -07:00
|
13
13
|
default_executable: piston
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -58,8 +58,8 @@ executables:
|
|
58
58
|
- piston
|
59
59
|
extensions: []
|
60
60
|
|
61
|
-
extra_rdoc_files:
|
62
|
-
|
61
|
+
extra_rdoc_files:
|
62
|
+
- README.txt
|
63
63
|
files:
|
64
64
|
- History.txt
|
65
65
|
- License.txt
|
@@ -173,6 +173,6 @@ rubyforge_project: piston
|
|
173
173
|
rubygems_version: 1.2.0
|
174
174
|
signing_key:
|
175
175
|
specification_version: 2
|
176
|
-
summary:
|
176
|
+
summary: Ease your vendor branch management worries
|
177
177
|
test_files: []
|
178
178
|
|