launchy 2.5.2 → 3.1.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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY.md +22 -0
  3. data/Manifest.txt +4 -21
  4. data/README.md +0 -36
  5. data/exe/launchy +5 -0
  6. data/launchy.gemspec +33 -0
  7. data/lib/launchy/application.rb +38 -20
  8. data/lib/launchy/applications/browser.rb +70 -63
  9. data/lib/launchy/argv.rb +11 -6
  10. data/lib/launchy/cli.rb +29 -34
  11. data/lib/launchy/descendant_tracker.rb +14 -12
  12. data/lib/launchy/detect/host_os.rb +21 -18
  13. data/lib/launchy/detect/host_os_family.rb +94 -53
  14. data/lib/launchy/detect/nix_desktop_environment.rb +74 -69
  15. data/lib/launchy/detect.rb +7 -5
  16. data/lib/launchy/error.rb +2 -0
  17. data/lib/launchy/os_family.rb +2 -0
  18. data/lib/launchy/runner.rb +55 -0
  19. data/lib/launchy/version.rb +7 -5
  20. data/lib/launchy.rb +76 -68
  21. metadata +19 -79
  22. data/Rakefile +0 -27
  23. data/bin/launchy +0 -4
  24. data/lib/launchy/deprecated.rb +0 -52
  25. data/lib/launchy/detect/ruby_engine.rb +0 -78
  26. data/lib/launchy/detect/runner.rb +0 -152
  27. data/spec/application_spec.rb +0 -43
  28. data/spec/applications/browser_spec.rb +0 -73
  29. data/spec/cli_spec.rb +0 -75
  30. data/spec/detect/host_os_family_spec.rb +0 -42
  31. data/spec/detect/host_os_spec.rb +0 -19
  32. data/spec/detect/nix_desktop_environment_spec.rb +0 -27
  33. data/spec/detect/ruby_engine_spec.rb +0 -37
  34. data/spec/detect/runner_spec.rb +0 -103
  35. data/spec/launchy_spec.rb +0 -119
  36. data/spec/mock_application.rb +0 -9
  37. data/spec/spec_helper.rb +0 -11
  38. data/spec/tattle-host-os.yaml +0 -427
  39. data/spec/version_spec.rb +0 -11
  40. data/tasks/default.rake +0 -242
  41. data/tasks/this.rb +0 -208
  42. /data/{LICENSE → LICENSE.txt} +0 -0
@@ -1,9 +0,0 @@
1
- class MockApplication < Launchy::Application
2
- def self.schemes
3
- %w[ mock mockother ]
4
- end
5
-
6
- def self.handles?( uri )
7
- schemes.include?( uri.scheme )
8
- end
9
- end
data/spec/spec_helper.rb DELETED
@@ -1,11 +0,0 @@
1
- if RUBY_VERSION >= '1.9.2' then
2
- require 'simplecov'
3
- puts "Using coverage!"
4
- SimpleCov.start if ENV['COVERAGE']
5
- end
6
-
7
- gem 'minitest'
8
- require 'launchy'
9
- require 'stringio'
10
- require 'minitest/autorun'
11
- require 'minitest/pride'
@@ -1,427 +0,0 @@
1
- # SOURCE: http://tattle.rubygarden.org
2
- ---
3
- ruby_version:
4
- 1.8.4: 506
5
- 1.8.5: 842
6
- 1.8.6: 270
7
- 1.9.0: 1
8
- 1.8.1: 9
9
- 1.8.2: 36
10
- host_vendor:
11
- "": 1
12
- mandrake: 1
13
- sun: 18
14
- apple: 619
15
- mandriva: 1
16
- slackware: 1
17
- portbld: 27
18
- pc: 858
19
- ibm: 1
20
- suse: 5
21
- Apple Computer, Inc.: 13
22
- Sun Microsystems Inc.: 6
23
- unknown: 45
24
- redhat: 70
25
- ruby_install_name:
26
- jruby.bat: 2
27
- ruby185: 1
28
- jruby: 17
29
- ruby18: 175
30
- ruby1.8: 222
31
- ruby1.8.4: 1
32
- ruby: 1248
33
- build:
34
- sparc-sun-solaris2.9: 8
35
- i686-apple-darwin8.6.1: 81
36
- i686-apple-darwin8.5.2: 11
37
- java1.5: 3
38
- i386-unknown-freebsd4.11: 1
39
- powerpc-apple-darwin8.2.0: 3
40
- i386-pc-solaris2.8: 2
41
- x86_64-suse-linux-gnu: 2
42
- x86_64-pc-linux-gnu: 89
43
- i686-apple-darwin8.7.1: 31
44
- i686-apple-darwin8.6.2: 15
45
- java1.6: 6
46
- i686-apple-darwin8.5.3: 4
47
- i686-pc-mswin32: 375
48
- i386-pc-linux-gnu: 2
49
- i386-pc-linux: 3
50
- powerpc-apple-darwin8.3.0: 3
51
- i686-apple-darwin8.8.1: 140
52
- i686-redhat-linux-gnu: 30
53
- i686-apple-darwin8.7.2: 2
54
- powerpc-apple-darwin8.4.0: 6
55
- amd64-portbld-freebsd6: 2
56
- i686-apple-darwin8.8.2: 53
57
- i686-apple-darwin8.9.1: 27
58
- i686-apple-darwin8.7.3: 3
59
- x86_64-unknown-linux-gnu: 29
60
- i686-suse-linux-gnu: 2
61
- powerpc-apple-darwin8.10.0: 2
62
- i686-apple-darwin8.8.3: 15
63
- powerpc-apple-darwin7.9.0: 12
64
- powerpc-apple-darwin8.5.0: 8
65
- i386-mingw32: 1
66
- i686-apple-darwin8.9.3: 1
67
- i686-apple-darwin8.8.4: 5
68
- x86_64-redhat-linux-gnu: 7
69
- powerpc-apple-darwin8.6.0: 25
70
- sparc-sun-solaris2.10: 7
71
- i686-apple-darwin8.9.4: 3
72
- i686-apple-darwin8.8.5: 3
73
- powerpc-apple-darwin8.7.0: 39
74
- powerpc-apple-darwin8.11.0: 1
75
- powerpc-ibm-aix5.3.0.0: 1
76
- powerpc-apple-darwin8.8.0: 53
77
- i386-unknown-netbsdelf3.1.: 1
78
- powerpc-unknown-linux-gnu: 3
79
- powerpc-apple-darwin8.8.1: 1
80
- i486-slackware-linux: 1
81
- i386-pc-solaris2.10: 7
82
- powerpc-apple-darwin8.9.0: 8
83
- i686-pc-cygwin: 14
84
- x86_64-unknown-openbsd4.0: 4
85
- i686-pc-linux-gnu: 343
86
- java: 8
87
- i586-mandrake-linux-gnu: 1
88
- i386-redhat-linux-gnu: 33
89
- i686-apple-darwin9.0: 29
90
- i586-mandriva-linux-gnu: 1
91
- i386-portbld-freebsd5: 3
92
- powerpc-apple-darwin8.0: 10
93
- i386-unknown-freebsd6.0: 2
94
- i486-pc-linux-gnu: 22
95
- i686-suse-linux: 1
96
- i686-apple-darwin: 1
97
- i386-portbld-freebsd6: 20
98
- powerpc-apple-darwin9.0: 5
99
- i386-unknown-freebsd6.1: 1
100
- x86_64-unknown-openbsd3.9: 1
101
- i686-apple-darwin8.10.1: 13
102
- i386-portbld-freebsd7: 2
103
- i686-apple-darwin9.1.0: 1
104
- i686-apple-darwin8.4.1: 1
105
- i686-apple-darwin8.11.1: 2
106
- powerpc64-unknown-linux-gnu: 2
107
- i686-apple-darwin8.5.1: 1
108
- i686-apple-darwin8.10.3: 1
109
- java1.4: 2
110
- sparc-sun-solaris2.8: 3
111
- i386-unknown-openbsd4.0: 2
112
- arch:
113
- x86-java1.5: 1
114
- i686-darwin8.8.1: 140
115
- i686-darwin8.7.2: 2
116
- i386-mswin32: 375
117
- i686-darwin8.8.2: 53
118
- i686-darwin8.9.1: 27
119
- i686-darwin8.7.3: 3
120
- x86-java1.6: 1
121
- i686-darwin8.8.3: 15
122
- i686-darwin8.9.3: 1
123
- i686-darwin8.8.4: 5
124
- amd64-freebsd6: 2
125
- sparc-solaris2.8: 3
126
- x86_64-openbsd4.0: 4
127
- powerpc-aix5.3.0.0: 1
128
- powerpc-darwin8.2.0: 3
129
- sparc-solaris2.9: 8
130
- i386-netbsdelf: 1
131
- i386-mingw32: 1
132
- powerpc-darwin8.3.0: 3
133
- i686-darwin8.9.4: 3
134
- i686-darwin8.8.5: 3
135
- i386-linux-gnu: 8
136
- powerpc-darwin8.10.0: 2
137
- i586-linux-gnu: 2
138
- powerpc-darwin8.4.0: 6
139
- powerpc-darwin8.11.0: 1
140
- powerpc-darwin8.5.0: 8
141
- i386-freebsd5: 3
142
- powerpc-darwin8.6.0: 25
143
- i386-linux: 71
144
- i386-freebsd6: 20
145
- powerpc-darwin8.7.0: 39
146
- i486-linux: 188
147
- x86_64-linux: 127
148
- i386-freebsd7: 2
149
- powerpc-darwin8.8.0: 53
150
- i586-linux: 3
151
- java: 8
152
- i386-freebsd4.11: 1
153
- powerpc-darwin8.9.0: 8
154
- powerpc-darwin8.8.1: 1
155
- x86_64-openbsd3.9: 1
156
- i686-darwin: 1
157
- powerpc-darwin8.0: 7
158
- sparc-solaris2.10: 7
159
- universal-darwin8.0: 5
160
- powerpc-linux: 3
161
- i386-freebsd6.0: 2
162
- powerpc64-linux: 2
163
- universal-darwin9.0: 34
164
- i386-cygwin: 14
165
- powerpc-darwin7.9.0: 12
166
- i386-freebsd6.1: 1
167
- i386-solaris2.10: 7
168
- i386-java1.5: 2
169
- i386-openbsd4.0: 2
170
- i686-darwin8.4.1: 1
171
- i686-darwin8.10.1: 11
172
- i386-solaris2.8: 2
173
- i686-darwin9.1.0: 1
174
- i686-darwin8.5.1: 1
175
- i686-darwin8.11.1: 2
176
- i386-java1.6: 7
177
- i686-darwin8.6.1: 81
178
- i686-darwin8.5.2: 11
179
- i686-darwin8.10.3: 1
180
- i686-linux: 167
181
- i686-darwin8.7.1: 31
182
- i686-darwin8.6.2: 15
183
- i686-darwin8.5.3: 4
184
- target_cpu:
185
- x86: 2
186
- powerpc64: 2
187
- i686: 610
188
- powerpc: 180
189
- amd64: 2
190
- x86_64: 132
191
- i386: 527
192
- i486: 188
193
- i586: 5
194
- sparc: 18
195
- host_os:
196
- freebsd6.1: 1
197
- darwin8.11.1: 2
198
- darwin8.5.3: 4
199
- solaris2.9: 8
200
- darwin7.9.0: 12
201
- darwin8.6.2: 15
202
- darwin8.7.1: 31
203
- darwin8.8.0: 53
204
- darwin8.10.3: 1
205
- freebsd4.11: 1
206
- darwin9.1.0: 1
207
- darwin8.7.2: 2
208
- darwin8.9.0: 8
209
- darwin8.0: 10
210
- darwin8.8.1: 141
211
- darwin8.7.3: 3
212
- linux: 9
213
- darwin8.9.1: 27
214
- darwin9.0: 34
215
- darwin8.8.2: 53
216
- openbsd3.9: 1
217
- Windows XP: 2
218
- cygwin: 14
219
- darwin8.8.3: 15
220
- darwin8.9.3: 1
221
- darwin8.2.0: 3
222
- darwin8.8.4: 5
223
- darwin8.8.5: 3
224
- darwin8.9.4: 3
225
- darwin8.3.0: 3
226
- openbsd4.0: 6
227
- Mac OS X: 13
228
- aix5.3.0.0: 1
229
- darwin: 1
230
- freebsd5: 3
231
- darwin8.4.0: 6
232
- darwin8.4.1: 1
233
- darwin8.10.0: 2
234
- darwin8.5.0: 8
235
- freebsd6: 22
236
- netbsdelf: 1
237
- darwin8.5.1: 1
238
- darwin8.11.0: 1
239
- freebsd7: 2
240
- darwin8.10.1: 13
241
- darwin8.6.0: 25
242
- freebsd6.0: 2
243
- solaris2.8: 5
244
- darwin8.5.2: 11
245
- solaris2.10: 14
246
- darwin8.7.0: 39
247
- darwin8.6.1: 81
248
- mswin32: 376
249
- linux-gnu: 566
250
- rubygems_version:
251
- 1.1.0: 11
252
- 0.9.3: 11
253
- 0.9.0.8: 16
254
- 1.0.1: 71
255
- 0.8.5: 2
256
- 0.8.10: 12
257
- 1.1.1: 16
258
- 0.9.0.9: 21
259
- 0.9.4: 95
260
- 0.9.5: 6
261
- 0.8.11: 235
262
- 0.9.4.7: 1
263
- 0.8.8: 1
264
- 0.9.0.10: 5
265
- 0.9.0: 912
266
- 0.9.1: 78
267
- 0.9.0.6: 5
268
- 0.9.2: 162
269
- 0.9.0.7: 2
270
- 1.0.0: 2
271
- SHELL:
272
- /bin/bash: 75
273
- /bin/sh: 1212
274
- $(COMSPEC): 375
275
- cmd.exe: 2
276
- /usr/local/bin/bash: 2
277
- host_cpu:
278
- powerpc64: 2
279
- x86: 2
280
- i686: 1208
281
- powerpc: 180
282
- amd64: 2
283
- x86_64: 132
284
- i386: 97
285
- i486: 23
286
- i586: 2
287
- sparc: 18
288
- LIBRUBY:
289
- libruby.so.1.8.6: 9
290
- libruby1.8.4.1.8.4.dylib: 1
291
- libruby18.so.1.8.4: 3
292
- libruby185-static.a: 1
293
- libruby1.8.so.1.8.2: 7
294
- libruby18.so.1.8.5: 127
295
- libruby18.so.1.8.6: 17
296
- libruby.1.8.5.dylib: 166
297
- jruby: 8
298
- libruby.1.8.6.dylib: 41
299
- libruby.so.1.9.0: 1
300
- libruby.so.1.8.1: 8
301
- libruby1.8.so.1.8.4: 125
302
- libruby.so.1.8.2: 1
303
- libruby18.so.18.5: 1
304
- libruby.so.1.84: 2
305
- jruby.jar: 11
306
- libruby1.8.so.1.8.5: 62
307
- libmsvcrt-ruby18.dll.a: 1
308
- libruby.so.1.85: 1
309
- libruby1.8-static.a: 1
310
- libruby.so.1: 4
311
- libruby.1.8.2.dylib: 5
312
- libruby1.8.so.1.8.6: 26
313
- libruby.dll.a: 14
314
- libruby.so.1.8.4: 15
315
- libruby.1.dylib: 43
316
- libruby-static.a: 454
317
- libruby.1.8.4.dylib: 50
318
- libruby.so.1.8.5: 59
319
- msvcrt-ruby18.lib: 375
320
- libruby18.so.18: 27
321
- LIBRUBY_SO:
322
- libruby.so.1.8.6: 47
323
- libruby1.8.4.1.8.4.dylib: 1
324
- libruby18.so.1.8.4: 3
325
- libruby1.8.so.1.8.2: 7
326
- libruby18.so.1.8.5: 127
327
- libruby18.so.1.8.6: 17
328
- libruby.1.8.5.dylib: 166
329
- jruby: 8
330
- libruby.1.8.6.dylib: 41
331
- libruby.so.1.9.0: 1
332
- libruby.so.1.8.1: 9
333
- libruby1.8.so.1.8.4: 125
334
- libruby18.so.18.5: 1
335
- libruby.so.1.84: 2
336
- libruby.so.1.8.2: 3
337
- jruby.jar: 11
338
- libruby1.8.so.1.8.5: 63
339
- libruby.so.1.85: 1
340
- libruby.so.1: 4
341
- libruby.1.8.2.dylib: 5
342
- libruby1.8.so.1.8.6: 26
343
- libruby185.so.1.8.5: 1
344
- cygruby18.dll: 14
345
- libruby.1.dylib: 43
346
- libruby.so.1.8.4: 253
347
- msvcrt-ruby18.dll: 376
348
- libruby.1.8.4.dylib: 50
349
- libruby.so.1.8.5: 234
350
- libruby18.so.18: 27
351
- target:
352
- sparc-sun-solaris2.9: 8
353
- i686-apple-darwin8.6.1: 81
354
- i686-apple-darwin8.5.2: 11
355
- i386--netbsdelf: 1
356
- powerpc-apple-darwin8.2.0: 3
357
- i386-unknown-freebsd4.11: 1
358
- i386-pc-solaris2.8: 2
359
- x86_64-pc-linux-gnu: 105
360
- i686-apple-darwin8.7.1: 31
361
- i686-apple-darwin8.6.2: 15
362
- i686-apple-darwin8.5.3: 4
363
- x86_64-suse-linux: 2
364
- i386-pc-linux-gnu: 2
365
- i386-pc-linux: 15
366
- powerpc-apple-darwin8.3.0: 3
367
- i686-apple-darwin8.8.1: 140
368
- i686-apple-darwin8.7.2: 2
369
- powerpc-apple-darwin8.4.0: 6
370
- amd64-portbld-freebsd6: 2
371
- i686-apple-darwin8.8.2: 53
372
- i686-apple-darwin8.9.1: 27
373
- i686-apple-darwin8.7.3: 3
374
- x86_64-unknown-linux-gnu: 13
375
- powerpc-apple-darwin8.10.0: 2
376
- i686-apple-darwin8.8.3: 15
377
- powerpc-apple-darwin7.9.0: 12
378
- powerpc-apple-darwin8.5.0: 8
379
- i386-mingw32: 1
380
- i686-apple-darwin8.9.3: 1
381
- i586-suse-linux: 3
382
- i686-apple-darwin8.8.4: 5
383
- x86_64-redhat-linux-gnu: 7
384
- powerpc-apple-darwin8.6.0: 25
385
- powerpc-apple-darwin8.11.0: 1
386
- sparc-sun-solaris2.10: 7
387
- i686-apple-darwin8.9.4: 3
388
- i686-apple-darwin8.8.5: 3
389
- powerpc-apple-darwin8.7.0: 39
390
- powerpc-ibm-aix5.3.0.0: 1
391
- i386-redhat-linux: 1
392
- powerpc-apple-darwin8.8.0: 53
393
- powerpc-unknown-linux-gnu: 3
394
- i486-slackware-linux: 1
395
- i386-pc-solaris2.10: 7
396
- powerpc-apple-darwin8.9.0: 8
397
- powerpc-apple-darwin8.8.1: 1
398
- i686-pc-cygwin: 14
399
- x86_64-unknown-openbsd4.0: 4
400
- i686-pc-linux-gnu: 166
401
- java: 8
402
- i586-mandrake-linux-gnu: 1
403
- i386-redhat-linux-gnu: 61
404
- i586-mandriva-linux-gnu: 1
405
- i686-apple-darwin9.0: 29
406
- i386-portbld-freebsd5: 3
407
- powerpc-apple-darwin8.0: 10
408
- i386-unknown-freebsd6.0: 2
409
- i486-pc-linux-gnu: 187
410
- i686-apple-darwin: 1
411
- i386-portbld-freebsd6: 20
412
- powerpc-apple-darwin9.0: 5
413
- i386-unknown-freebsd6.1: 1
414
- x86_64-unknown-openbsd3.9: 1
415
- i686-redhat-linux: 1
416
- i686-apple-darwin8.10.1: 13
417
- i386-portbld-freebsd7: 2
418
- i686-apple-darwin9.1.0: 1
419
- i686-apple-darwin8.4.1: 1
420
- i686-apple-darwin8.11.1: 2
421
- powerpc64-unknown-linux-gnu: 2
422
- i386-pc-mswin32: 375
423
- i686-apple-darwin8.5.1: 1
424
- java1.4: 11
425
- sparc-sun-solaris2.8: 3
426
- i386-unknown-openbsd4.0: 2
427
- i686-apple-darwin8.10.3: 1
data/spec/version_spec.rb DELETED
@@ -1,11 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Launchy::VERSION' do
4
- it "should have a #.#.# format" do
5
- _(Launchy::VERSION).must_match( /\d+\.\d+\.\d+/ )
6
- _(Launchy::Version.to_s).must_match( /\d+\.\d+\.\d+/ )
7
- Launchy::Version.to_a.each do |n|
8
- _(n.to_i).must_be :>=, 0
9
- end
10
- end
11
- end
data/tasks/default.rake DELETED
@@ -1,242 +0,0 @@
1
- # vim: syntax=ruby
2
- require 'rake/clean'
3
- require 'digest'
4
- #------------------------------------------------------------------------------
5
- # If you want to Develop on this project just run 'rake develop' and you'll
6
- # have all you need to get going. If you want to use bundler for development,
7
- # then run 'rake develop:using_bundler'
8
- #------------------------------------------------------------------------------
9
- namespace :develop do
10
-
11
- # Install all the development and runtime dependencies of this gem using the
12
- # gemspec.
13
- task :default => 'Gemfile' do
14
- require 'rubygems/dependency_installer'
15
- installer = ::Gem::DependencyInstaller.new
16
- puts "Installing bundler..."
17
- installer.install 'bundler'
18
- sh 'bundle install'
19
- puts "\n\nNow run 'rake test'"
20
- end
21
-
22
- # Create a Gemfile that just references the gemspec
23
- file 'Gemfile' => :gemspec do
24
- File.open( "Gemfile", "w+" ) do |f|
25
- f.puts "# DO NOT EDIT - This file is automatically generated"
26
- f.puts "# Make changes to Manifest.txt and/or Rakefile and regenerate"
27
- f.puts 'source "https://rubygems.org"'
28
- f.puts 'gemspec'
29
- end
30
- end
31
- end
32
- desc "Bootstrap development"
33
- task :develop => "develop:default"
34
-
35
- #------------------------------------------------------------------------------
36
- # Minitest - standard TestTask
37
- #------------------------------------------------------------------------------
38
- begin
39
- require 'rake/testtask'
40
- Rake::TestTask.new( :test ) do |t|
41
- t.ruby_opts = %w[ -w ]
42
- t.libs = %w[ lib spec test ]
43
- t.pattern = "{test,spec}/**/{test_*,*_spec}.rb"
44
- end
45
-
46
- task :test_requirements
47
- task :test => :test_requirements
48
- task :default => :test
49
- rescue LoadError
50
- This.task_warning( 'test' )
51
- end
52
-
53
- #------------------------------------------------------------------------------
54
- # RDoc - standard rdoc rake task, although we must make sure to use a more
55
- # recent version of rdoc since it is the one that has 'tomdoc' markup
56
- #------------------------------------------------------------------------------
57
- begin
58
- gem 'rdoc' # otherwise we get the wrong task from stdlib
59
- require 'rdoc/task'
60
- RDoc::Task.new do |t|
61
- t.markup = 'tomdoc'
62
- t.rdoc_dir = 'doc'
63
- t.main = 'README.md'
64
- t.title = "#{This.name} #{This.version}"
65
- t.rdoc_files.include( FileList['*.{rdoc,md,txt}'], FileList['ext/**/*.c'],
66
- FileList['lib/**/*.rb'] )
67
- end
68
- rescue StandardError, LoadError
69
- This.task_warning( 'rdoc' )
70
- end
71
-
72
- #------------------------------------------------------------------------------
73
- # Coverage - optional code coverage, rcov for 1.8 and simplecov for 1.9, so
74
- # for the moment only rcov is listed.
75
- #------------------------------------------------------------------------------
76
- begin
77
- require 'simplecov'
78
- desc 'Run tests with code coverage'
79
- task :coverage do
80
- ENV['COVERAGE'] = 'true'
81
- Rake::Task[:test].execute
82
- end
83
- CLOBBER << 'coverage' if File.directory?( 'coverage' )
84
- rescue LoadError
85
- This.task_warning( 'simplecov' )
86
- end
87
-
88
- #------------------------------------------------------------------------------
89
- # Manifest - We want an explicit list of thos files that are to be packaged in
90
- # the gem. Most of this is from Hoe.
91
- #------------------------------------------------------------------------------
92
- namespace 'manifest' do
93
- desc "Check the manifest"
94
- task :check => :clean do
95
- files = FileList["**/*", ".*"].exclude( This.exclude_from_manifest ).to_a.sort
96
- files = files.select{ |f| File.file?( f ) }
97
-
98
- tmp = "Manifest.tmp"
99
- File.open( tmp, 'w' ) do |f|
100
- f.puts files.join("\n")
101
- end
102
-
103
- begin
104
- sh "diff -du Manifest.txt #{tmp}"
105
- ensure
106
- rm tmp
107
- end
108
- puts "Manifest looks good"
109
- end
110
-
111
- desc "Generate the manifest"
112
- task :generate => :clean do
113
- files = %x[ git ls-files ].split("\n").sort
114
- files.reject! { |f| f =~ This.exclude_from_manifest }
115
- File.open( "Manifest.txt", "w" ) do |f|
116
- f.puts files.join("\n")
117
- end
118
- end
119
- end
120
-
121
- #------------------------------------------------------------------------------
122
- # Fixme - look for fixmes and report them
123
- #------------------------------------------------------------------------------
124
- namespace :fixme do
125
- task :default => 'manifest:check' do
126
- This.manifest.each do |file|
127
- next if file == __FILE__
128
- next unless file =~ %r/(txt|rb|md|rdoc|css|html|xml|css)\Z/
129
- puts "FIXME: Rename #{file}" if file =~ /fixme/i
130
- IO.readlines( file ).each_with_index do |line, idx|
131
- prefix = "FIXME: #{file}:#{idx+1}".ljust(42)
132
- puts "#{prefix} => #{line.strip}" if line =~ /fixme/i
133
- end
134
- end
135
- end
136
-
137
- def fixme_project_root
138
- This.project_path( '../fixme' )
139
- end
140
-
141
- def fixme_project_path( subtree )
142
- fixme_project_root.join( subtree )
143
- end
144
-
145
- def local_fixme_files
146
- This.manifest.select { |p| p =~ %r|^tasks/| }
147
- end
148
-
149
- def outdated_fixme_files
150
- local_fixme_files.select do |local|
151
- upstream = fixme_project_path( local )
152
- upstream.exist? &&
153
- ( Digest::SHA256.file( local ) != Digest::SHA256.file( upstream ) )
154
- end
155
- end
156
-
157
- def fixme_up_to_date?
158
- outdated_fixme_files.empty?
159
- end
160
-
161
- desc "See if the fixme tools are outdated"
162
- task :outdated => :release_check do
163
- if fixme_up_to_date? then
164
- puts "Fixme files are up to date."
165
- else
166
- outdated_fixme_files.each do |f|
167
- puts "#{f} is outdated"
168
- end
169
- end
170
- end
171
-
172
- desc "Update outdated fixme files"
173
- task :update => :release_check do
174
- if fixme_up_to_date? then
175
- puts "Fixme files are already up to date."
176
- else
177
- puts "Updating fixme files:"
178
- outdated_fixme_files.each do |local|
179
- upstream = fixme_project_path( local )
180
- puts " * #{local}"
181
- FileUtils.cp( upstream, local )
182
- end
183
- puts "Use your git commands as appropriate."
184
- end
185
- end
186
- end
187
- desc "Look for fixmes and report them"
188
- task :fixme => "fixme:default"
189
-
190
- #------------------------------------------------------------------------------
191
- # Gem Specification
192
- #------------------------------------------------------------------------------
193
- # Really this is only here to support those who use bundler
194
- desc "Build the #{This.name}.gemspec file"
195
- task :gemspec do
196
- File.open( This.gemspec_file, "wb+" ) do |f|
197
- f.puts "# DO NOT EDIT - This file is automatically generated"
198
- f.puts "# Make changes to Manifest.txt and/or Rakefile and regenerate"
199
- f.write This.platform_gemspec.to_ruby
200
- end
201
- end
202
-
203
- # .rbc files from ruby 2.0
204
- CLOBBER << FileList["**/*.rbc"]
205
-
206
- # The standard gem packaging task, everyone has it.
207
- require 'rubygems/package_task'
208
- ::Gem::PackageTask.new( This.platform_gemspec ) do
209
- # nothing
210
- end
211
-
212
- #------------------------------------------------------------------------------
213
- # Release - the steps we go through to do a final release, this is pulled from
214
- # a compbination of mojombo's rakegem, hoe and hoe-git
215
- #
216
- # 1) make sure we are on the main branch
217
- # 2) make sure there are no uncommitted items
218
- # 3) check the manifest and make sure all looks good
219
- # 4) build the gem
220
- # 5) do an empty commit to have the commit message of the version
221
- # 6) tag that commit as the version
222
- # 7) push main
223
- # 8) push the tag
224
- # 7) pus the gem
225
- #------------------------------------------------------------------------------
226
- task :release_check do
227
- unless `git branch` =~ /^\* main$/
228
- abort "You must be on the main branch to release!"
229
- end
230
- unless `git status` =~ /^nothing to commit/m
231
- abort "Nope, sorry, you have unfinished business"
232
- end
233
- end
234
-
235
- desc "Create tag v#{This.version}, build and push #{This.platform_gemspec.full_name} to rubygems.org"
236
- task :release => [ :release_check, 'manifest:check', :gem ] do
237
- sh "git commit --allow-empty -a -m 'Release #{This.version}'"
238
- sh "git tag -a -m 'v#{This.version}' v#{This.version}"
239
- sh "git push origin main"
240
- sh "git push origin v#{This.version}"
241
- sh "gem push pkg/#{This.platform_gemspec.full_name}.gem"
242
- end