launchy 2.4.3 → 2.5.2

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.
@@ -10,27 +10,18 @@ describe Launchy::Detect::NixDesktopEnvironment do
10
10
  Launchy.reset_global_options
11
11
  end
12
12
 
13
- it "can detect the desktop environment of a KDE machine using ENV['KDE_FULL_SESSION']" do
14
- ENV.delete( "KDE_FULL_SESSION" )
15
- ENV["KDE_FULL_SESSION"] = "launchy-test"
16
- kde = Launchy::Detect::NixDesktopEnvironment::Kde
17
- nix_env = Launchy::Detect::NixDesktopEnvironment.detect
18
- nix_env.must_equal( kde )
19
- nix_env.browser.must_equal( kde.browser )
20
- ENV.delete( 'KDE_FULL_SESSION' )
21
- end
22
-
23
13
  it "returns false for XFCE if xprop is not found" do
24
14
  Launchy.host_os = "linux"
25
- Launchy::Detect::NixDesktopEnvironment::Xfce.is_current_desktop_environment?.must_equal( false )
15
+ _(Launchy::Detect::NixDesktopEnvironment::Xfce.is_current_desktop_environment?).must_equal( false )
26
16
  end
27
17
 
28
18
  it "returns NotFound if it cannot determine the *nix desktop environment" do
29
19
  Launchy.host_os = "linux"
30
20
  ENV.delete( "KDE_FULL_SESSION" )
31
21
  ENV.delete( "GNOME_DESKTOP_SESSION_ID" )
22
+ Launchy.path = %w[ / /tmp ].join(File::PATH_SEPARATOR)
32
23
  not_found = Launchy::Detect::NixDesktopEnvironment.detect
33
- not_found.must_equal( Launchy::Detect::NixDesktopEnvironment::NotFound )
34
- not_found.browser.must_equal( Launchy::Argv.new )
24
+ _(not_found).must_equal( Launchy::Detect::NixDesktopEnvironment::NotFound )
25
+ _(not_found.browser).must_equal( Launchy::Argv.new )
35
26
  end
36
27
  end
@@ -12,18 +12,18 @@ describe Launchy::Detect::RubyEngine do
12
12
 
13
13
  %w[ ruby jruby rbx macruby ].each do |ruby|
14
14
  it "detects the #{ruby} RUBY_ENGINE" do
15
- Launchy::Detect::RubyEngine.detect( ruby ).ancestors.must_include Launchy::Detect::RubyEngine
15
+ _(Launchy::Detect::RubyEngine.detect( ruby ).ancestors).must_include Launchy::Detect::RubyEngine
16
16
  end
17
17
  end
18
18
 
19
19
  it "uses the global ruby_engine overrides" do
20
20
  ENV['LAUNCHY_RUBY_ENGINE'] = "rbx"
21
- Launchy::Detect::RubyEngine.detect.must_equal Launchy::Detect::RubyEngine::Rbx
21
+ _(Launchy::Detect::RubyEngine.detect).must_equal Launchy::Detect::RubyEngine::Rbx
22
22
  ENV.delete('LAUNCHY_RUBY_ENGINE')
23
23
  end
24
24
 
25
25
  it "does not find a ruby engine of 'foo'" do
26
- lambda { Launchy::Detect::RubyEngine.detect( 'foo' ) }.must_raise Launchy::Detect::RubyEngine::NotFoundError
26
+ _(lambda { Launchy::Detect::RubyEngine.detect( 'foo' ) }).must_raise Launchy::Detect::RubyEngine::NotFoundError
27
27
  end
28
28
 
29
29
  { 'rbx' => :rbx?,
@@ -31,7 +31,7 @@ describe Launchy::Detect::RubyEngine do
31
31
  'macruby' => :macruby?,
32
32
  'jruby' => :jruby? }.each_pair do |engine, method|
33
33
  it "#{method} returns true for #{engine} " do
34
- Launchy::Detect::RubyEngine.detect( engine ).send( method ).must_equal true
34
+ _(Launchy::Detect::RubyEngine.detect( engine ).send( method )).must_equal true
35
35
  end
36
36
  end
37
37
  end
@@ -13,17 +13,17 @@ describe Launchy::Detect::Runner do
13
13
 
14
14
  it "raises an error when there is an unknown host os" do
15
15
  Launchy.host_os = "foo"
16
- lambda{ Launchy::Detect::Runner.detect }.must_raise Launchy::Detect::HostOsFamily::NotFoundError
16
+ _(lambda{ Launchy::Detect::Runner.detect }).must_raise Launchy::Detect::HostOsFamily::NotFoundError
17
17
  end
18
18
 
19
19
  it "raises an error when there is an unknown ruby engine" do
20
20
  Launchy.ruby_engine = "wibble"
21
- lambda{ Launchy::Detect::Runner.detect }.must_raise Launchy::Detect::RubyEngine::NotFoundError
21
+ _(lambda{ Launchy::Detect::Runner.detect }).must_raise Launchy::Detect::RubyEngine::NotFoundError
22
22
  end
23
23
 
24
24
  it "raises and error when there is no command found" do
25
25
  runner = Launchy::Detect::Runner.detect
26
- lambda{ runner.run( nil, *%w[ arg1 arg2 arg 3] ) }.must_raise Launchy::CommandNotFoundError
26
+ _(lambda{ runner.run( nil, *%w[ arg1 arg2 arg 3] ) }).must_raise Launchy::CommandNotFoundError
27
27
  end
28
28
 
29
29
  # On anything that has fork, use Forkable
@@ -33,7 +33,7 @@ describe Launchy::Detect::Runner do
33
33
  Launchy.host_os = host_os
34
34
  Launchy.ruby_engine = engine_name
35
35
  engine = Launchy::Detect::Runner.detect
36
- engine.must_be_instance_of Launchy::Detect::Runner::Forkable
36
+ _(engine).must_be_instance_of Launchy::Detect::Runner::Forkable
37
37
  end
38
38
  end
39
39
  end
@@ -48,7 +48,7 @@ describe Launchy::Detect::Runner do
48
48
  Launchy.host_os = host_os
49
49
  Launchy.ruby_engine = 'jruby'
50
50
  engine = Launchy::Detect::Runner.detect
51
- engine.must_be_instance_of runner
51
+ _(engine).must_be_instance_of runner
52
52
  end
53
53
  end
54
54
 
@@ -58,14 +58,14 @@ describe Launchy::Detect::Runner do
58
58
  Launchy.host_os = "mingw"
59
59
  Launchy.ruby_engine = engine_name
60
60
  e = Launchy::Detect::Runner.detect
61
- e.must_be_instance_of Launchy::Detect::Runner::Windows
61
+ _(e).must_be_instance_of Launchy::Detect::Runner::Windows
62
62
  end
63
63
  end
64
64
 
65
65
  it "Windows launches use the 'cmd' command" do
66
66
  win = Launchy::Detect::Runner::Windows.new
67
67
  cmd = win.dry_run( "not-really", [ "http://example.com" ] )
68
- cmd.must_equal 'cmd /c not-really http://example.com'
68
+ _(cmd).must_equal 'cmd /c not-really http://example.com'
69
69
  end
70
70
 
71
71
  %w[ & | ( ) < > ^ ].each do |reserved_char|
@@ -75,29 +75,29 @@ describe Launchy::Detect::Runner do
75
75
  url = parts.join( reserved_char )
76
76
  output_url = parts.join( "^#{reserved_char}" )
77
77
 
78
- win.all_args( "not-really", [ url ] ).must_equal [ 'cmd', '/c', 'not-really', output_url ]
78
+ _(win.all_args( "not-really", [ url ] )).must_equal [ 'cmd', '/c', 'not-really', output_url ]
79
79
 
80
80
  cmd = win.dry_run( "not-really", [ url ] )
81
- cmd.must_equal "cmd /c not-really #{output_url}"
81
+ _(cmd).must_equal "cmd /c not-really #{output_url}"
82
82
  end
83
83
  end
84
84
 
85
85
  it "Jruby doesnot escapes '&' in urls" do
86
86
  jruby = Launchy::Detect::Runner::Jruby.new
87
87
  cmd = jruby.dry_run( "not-really", [ @test_url ])
88
- cmd.must_equal 'not-really http://example.com/?foo=bar&baz=wibble'
88
+ _(cmd).must_equal 'not-really http://example.com/?foo=bar&baz=wibble'
89
89
  end
90
90
 
91
91
  it "does not escape %38 items in urls" do
92
92
  l = Launchy::Detect::Runner::Forkable.new
93
- cmd = l.dry_run( "not-really", [ "http://ja.wikipedia.org/wiki/%E3%81%82" ] )
94
- cmd.must_equal( 'not-really http://ja.wikipedia.org/wiki/%E3%81%82' )
93
+ cmd = l.dry_run( "not-really", [ "https://ja.wikipedia.org/wiki/%E3%81%82" ] )
94
+ _(cmd).must_equal( 'not-really https://ja.wikipedia.org/wiki/%E3%81%82' )
95
95
  end
96
96
 
97
97
  it "can launch a utf8 url" do
98
- url = "http://ja.wikipedia.org/wiki/あ"
98
+ url = "https://ja.wikipedia.org/wiki/あ"
99
99
  l = Launchy::Detect::Runner::Forkable.new
100
100
  cmd = l.dry_run( "not-really", [ url ] )
101
- cmd.must_equal( "not-really #{url}" )
101
+ _(cmd).must_equal( "not-really #{url}" )
102
102
  end
103
103
  end
data/spec/launchy_spec.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'spec_helper'
2
+ require 'pathname'
2
3
 
3
4
  describe Launchy do
4
5
 
@@ -22,7 +23,7 @@ describe Launchy do
22
23
  old_stderr = $stderr
23
24
  $stderr = StringIO.new
24
25
  Launchy.log "This is a test log message"
25
- $stderr.string.strip.must_equal "LAUNCHY_DEBUG: This is a test log message"
26
+ _($stderr.string.strip).must_equal "LAUNCHY_DEBUG: This is a test log message"
26
27
  $stderr = old_stderr
27
28
  ENV["LAUNCHY_DEBUG"] = nil
28
29
  end
@@ -30,81 +31,89 @@ describe Launchy do
30
31
  it "sets the global option :dry_run to true if LAUNCHY_DRY_RUN environment variable is 'true'" do
31
32
  ENV['LAUNCHY_DRY_RUN'] = 'true'
32
33
  Launchy.extract_global_options({})
33
- Launchy.dry_run?.must_equal true
34
+ _(Launchy.dry_run?).must_equal true
34
35
  ENV['LAUNCHY_DRY_RUN'] = nil
35
36
  end
36
37
 
37
38
  it "sets the global option :debug to true if LAUNCHY_DEBUG environment variable is 'true'" do
38
39
  ENV['LAUNCHY_DEBUG'] = 'true'
39
40
  Launchy.extract_global_options({})
40
- Launchy.debug?.must_equal true
41
+ _(Launchy.debug?).must_equal true
41
42
  ENV['LAUNCHY_DEBUG'] = nil
42
43
  end
43
44
 
44
45
  it "has the global option :debug" do
45
46
  Launchy.extract_global_options( { :debug => 'true' } )
46
- Launchy.debug?.must_equal true
47
+ _(Launchy.debug?).must_equal true
47
48
  Launchy.extract_global_options( { :debug => true } )
48
- Launchy.debug?.must_equal true
49
+ _(Launchy.debug?).must_equal true
49
50
  end
50
51
 
51
52
  it "has the global option :dry_run" do
52
53
  Launchy.extract_global_options( { :dry_run => 'true' } )
53
- Launchy.dry_run?.must_equal true
54
+ _(Launchy.dry_run?).must_equal true
54
55
  Launchy.extract_global_options( { :dry_run => true } )
55
- Launchy.dry_run?.must_equal true
56
+ _(Launchy.dry_run?).must_equal true
56
57
  end
57
58
 
58
59
  it "has the global option :application" do
59
60
  Launchy.extract_global_options( { :application => "wibble" } )
60
- Launchy.application.must_equal 'wibble'
61
+ _(Launchy.application).must_equal 'wibble'
61
62
  end
62
63
 
63
64
  it "has the global option :host_os" do
64
65
  Launchy.extract_global_options( { :host_os => "my-special-os-v2" } )
65
- Launchy.host_os.must_equal 'my-special-os-v2'
66
+ _(Launchy.host_os).must_equal 'my-special-os-v2'
66
67
  end
67
68
 
68
69
  it "has the global option :ruby_engine" do
69
70
  Launchy.extract_global_options( { :ruby_engine => "myruby" } )
70
- Launchy.ruby_engine.must_equal 'myruby'
71
+ _(Launchy.ruby_engine).must_equal 'myruby'
71
72
  end
72
73
 
73
74
  it "raises an exception if no scheme is found for the given uri" do
74
- lambda { Launchy.open( @invalid_url ) }.must_raise Launchy::ApplicationNotFoundError
75
+ _(lambda { Launchy.open( @invalid_url ) }).must_raise Launchy::ApplicationNotFoundError
75
76
  end
76
77
 
77
78
  it "asssumes we open a local file if we have an exception if we have an invalid scheme and a valid path" do
78
79
  uri = "blah://example.com/#{__FILE__}"
79
80
  Launchy.open( uri , :dry_run => true )
80
- $stdout.string.strip.must_equal "/usr/bin/open #{uri}"
81
+ parts = $stdout.string.strip.split
82
+ _(parts.size).must_be :>, 1
83
+ _(parts.last).must_equal uri
81
84
  end
82
85
 
83
86
  it "opens a local file if we have a drive letter and a valid path on windows" do
84
87
  uri = "C:#{__FILE__}"
85
88
  Launchy.open( uri, :dry_run => true, :host_os => 'windows' )
86
- $stdout.string.strip.must_equal 'cmd /c start "launchy" /b ' + uri
89
+ _($stdout.string.strip).must_equal 'cmd /c start "launchy" /b ' + uri
87
90
  end
88
91
 
89
92
  it "calls the block if instead of raising an exception if there is an error" do
90
93
  Launchy.open( @invalid_url ) { $stderr.puts "oops had an error opening #{@invalid_url}" }
91
- $stderr.string.strip.must_equal "oops had an error opening #{@invalid_url}"
94
+ _($stderr.string.strip).must_equal "oops had an error opening #{@invalid_url}"
92
95
  end
93
96
 
94
97
  it "calls the block with the values passed to launchy and the error" do
95
98
  options = { :dry_run => true }
96
99
  Launchy.open( @invalid_url, :dry_run => true ) { |e| $stderr.puts "had an error opening #{@invalid_url} with options #{options}: #{e}" }
97
- $stderr.string.strip.must_equal "had an error opening #{@invalid_url} with options #{options}: No application found to handle '#{@invalid_url}'"
100
+ _($stderr.string.strip).must_equal "had an error opening #{@invalid_url} with options #{options}: No application found to handle '#{@invalid_url}'"
98
101
  end
99
102
 
100
103
  it "raises the error in the called block" do
101
- lambda { Launchy.open( @invalid_url ) { raise StandardError, "KABOOM!" } }.must_raise StandardError
104
+ _(lambda { Launchy.open( @invalid_url ) { raise StandardError, "KABOOM!" } }).must_raise StandardError
102
105
  end
103
106
 
104
107
  [ 'www.example.com', 'www.example.com/foo/bar', "C:#{__FILE__}" ].each do |x|
105
108
  it "picks a Browser for #{x}" do
106
109
  app = Launchy.app_for_uri_string( x )
107
- app.must_equal( Launchy::Application::Browser )
110
+ _(app).must_equal( Launchy::Application::Browser )
108
111
  end
109
112
  end
113
+
114
+ it "can use a Pathname as the URI" do
115
+ path = Pathname.new( Dir.pwd )
116
+ app = Launchy.app_for_uri_string( path )
117
+ _(app).must_equal( Launchy::Application::Browser )
118
+ end
110
119
  end
data/spec/version_spec.rb CHANGED
@@ -2,10 +2,10 @@ require 'spec_helper'
2
2
 
3
3
  describe 'Launchy::VERSION' do
4
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+/ )
5
+ _(Launchy::VERSION).must_match( /\d+\.\d+\.\d+/ )
6
+ _(Launchy::Version.to_s).must_match( /\d+\.\d+\.\d+/ )
7
7
  Launchy::Version.to_a.each do |n|
8
- n.to_i.must_be :>=, 0
8
+ _(n.to_i).must_be :>=, 0
9
9
  end
10
10
  end
11
11
  end
data/tasks/default.rake CHANGED
@@ -10,41 +10,26 @@ namespace :develop do
10
10
 
11
11
  # Install all the development and runtime dependencies of this gem using the
12
12
  # gemspec.
13
- task :default do
13
+ task :default => 'Gemfile' do
14
14
  require 'rubygems/dependency_installer'
15
15
  installer = ::Gem::DependencyInstaller.new
16
-
17
- This.set_coverage_gem
18
-
19
- puts "Installing gem depedencies needed for development"
20
- This.platform_gemspec.dependencies.each do |dep|
21
- if dep.matching_specs.empty? then
22
- puts "Installing : #{dep}"
23
- installer.install dep
24
- else
25
- puts "Skipping : #{dep} -> already installed #{dep.matching_specs.first.full_name}"
26
- end
27
- end
16
+ puts "Installing bundler..."
17
+ installer.install 'bundler'
18
+ sh 'bundle install'
28
19
  puts "\n\nNow run 'rake test'"
29
20
  end
30
21
 
31
22
  # Create a Gemfile that just references the gemspec
32
23
  file 'Gemfile' => :gemspec do
33
24
  File.open( "Gemfile", "w+" ) do |f|
34
- f.puts 'source "https://rubygems.org/"'
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"'
35
28
  f.puts 'gemspec'
36
29
  end
37
30
  end
38
-
39
- desc "Create a bundler Gemfile"
40
- task :using_bundler => 'Gemfile' do
41
- puts "Now you can 'bundle'"
42
- end
43
-
44
- # Gemfiles are build artifacts
45
- CLOBBER << FileList['Gemfile*']
46
31
  end
47
- desc "Boostrap development"
32
+ desc "Bootstrap development"
48
33
  task :develop => "develop:default"
49
34
 
50
35
  #------------------------------------------------------------------------------
@@ -53,7 +38,7 @@ task :develop => "develop:default"
53
38
  begin
54
39
  require 'rake/testtask'
55
40
  Rake::TestTask.new( :test ) do |t|
56
- t.ruby_opts = %w[ -w -rubygems ]
41
+ t.ruby_opts = %w[ -w ]
57
42
  t.libs = %w[ lib spec test ]
58
43
  t.pattern = "{test,spec}/**/{test_*,*_spec}.rb"
59
44
  end
@@ -88,31 +73,16 @@ end
88
73
  # Coverage - optional code coverage, rcov for 1.8 and simplecov for 1.9, so
89
74
  # for the moment only rcov is listed.
90
75
  #------------------------------------------------------------------------------
91
- if RUBY_VERSION < "1.9.0"
92
- begin
93
- require 'rcov/rcovtask'
94
- Rcov::RcovTask.new( 'coverage' ) do |t|
95
- t.libs << 'spec'
96
- t.pattern = 'spec/**/*_spec.rb'
97
- t.verbose = true
98
- t.rcov_opts << "-x ^/" # remove all the global files
99
- t.rcov_opts << "--sort coverage" # so we see the worst files at the top
100
- end
101
- rescue LoadError
102
- This.task_warning( 'rcov' )
103
- end
104
- else
105
- begin
106
- require 'simplecov'
107
- desc 'Run tests with code coverage'
108
- task :coverage do
109
- ENV['COVERAGE'] = 'true'
110
- Rake::Task[:test].execute
111
- end
112
- CLOBBER << FileList["coverage"]
113
- rescue LoadError
114
- This.task_warning( 'simplecov' )
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
115
82
  end
83
+ CLOBBER << 'coverage' if File.directory?( 'coverage' )
84
+ rescue LoadError
85
+ This.task_warning( 'simplecov' )
116
86
  end
117
87
 
118
88
  #------------------------------------------------------------------------------
@@ -177,9 +147,10 @@ namespace :fixme do
177
147
  end
178
148
 
179
149
  def outdated_fixme_files
180
- local_fixme_files.reject do |local|
150
+ local_fixme_files.select do |local|
181
151
  upstream = fixme_project_path( local )
182
- Digest::SHA256.file( local ) == Digest::SHA256.file( upstream )
152
+ upstream.exist? &&
153
+ ( Digest::SHA256.file( local ) != Digest::SHA256.file( upstream ) )
183
154
  end
184
155
  end
185
156
 
@@ -223,13 +194,12 @@ task :fixme => "fixme:default"
223
194
  desc "Build the #{This.name}.gemspec file"
224
195
  task :gemspec do
225
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"
226
199
  f.write This.platform_gemspec.to_ruby
227
200
  end
228
201
  end
229
202
 
230
- # the gemspec is also a dev artifact and should not be kept around.
231
- CLOBBER << This.gemspec_file.to_s
232
-
233
203
  # .rbc files from ruby 2.0
234
204
  CLOBBER << FileList["**/*.rbc"]
235
205
 
@@ -243,19 +213,19 @@ end
243
213
  # Release - the steps we go through to do a final release, this is pulled from
244
214
  # a compbination of mojombo's rakegem, hoe and hoe-git
245
215
  #
246
- # 1) make sure we are on the master branch
216
+ # 1) make sure we are on the main branch
247
217
  # 2) make sure there are no uncommitted items
248
218
  # 3) check the manifest and make sure all looks good
249
219
  # 4) build the gem
250
220
  # 5) do an empty commit to have the commit message of the version
251
221
  # 6) tag that commit as the version
252
- # 7) push master
222
+ # 7) push main
253
223
  # 8) push the tag
254
224
  # 7) pus the gem
255
225
  #------------------------------------------------------------------------------
256
226
  task :release_check do
257
- unless `git branch` =~ /^\* master$/
258
- abort "You must be on the master branch to release!"
227
+ unless `git branch` =~ /^\* main$/
228
+ abort "You must be on the main branch to release!"
259
229
  end
260
230
  unless `git status` =~ /^nothing to commit/m
261
231
  abort "Nope, sorry, you have unfinished business"
@@ -266,7 +236,7 @@ desc "Create tag v#{This.version}, build and push #{This.platform_gemspec.full_n
266
236
  task :release => [ :release_check, 'manifest:check', :gem ] do
267
237
  sh "git commit --allow-empty -a -m 'Release #{This.version}'"
268
238
  sh "git tag -a -m 'v#{This.version}' v#{This.version}"
269
- sh "git push origin master"
239
+ sh "git push origin main"
270
240
  sh "git push origin v#{This.version}"
271
241
  sh "gem push pkg/#{This.platform_gemspec.full_name}.gem"
272
242
  end
data/tasks/this.rb CHANGED
@@ -13,7 +13,7 @@ class ThisProject
13
13
  attr_accessor :email
14
14
 
15
15
  # The homepage of this project
16
- attr_accessor :homepage
16
+ attr_accessor :homepage
17
17
 
18
18
  # The regex of files to exclude from the manifest
19
19
  attr_accessor :exclude_from_manifest
@@ -25,7 +25,11 @@ class ThisProject
25
25
  #
26
26
  # Yields self
27
27
  def initialize(&block)
28
- @exclude_from_manifest = %r/\.(git|DS_Store)|^(doc|coverage|pkg|tmp|Gemfile(\.lock)?)|^[^\/]+\.gemspec|\.(swp|jar|bundle|so|rvmrc)$|~$/
28
+ @exclude_from_manifest = Regexp.union(/\.(git|DS_Store)/,
29
+ /^(doc|coverage|pkg|tmp|Gemfile(\.lock)?)/,
30
+ /^[^\/]+\.gemspec/,
31
+ /\.(swp|jar|bundle|so|rvmrc|travis.yml|byebug_history)$/,
32
+ /~$/)
29
33
  @gemspecs = Hash.new
30
34
  yield self if block_given?
31
35
  end
@@ -119,7 +123,7 @@ class ThisProject
119
123
 
120
124
  # Internal: Returns the gemspace associated with the current ruby platform
121
125
  def platform_gemspec
122
- gemspecs[platform]
126
+ gemspecs.fetch(platform) { This.ruby_gemspec }
123
127
  end
124
128
 
125
129
  def core_gemspec
@@ -132,6 +136,7 @@ class ThisProject
132
136
 
133
137
  spec.summary = summary
134
138
  spec.description = description
139
+ spec.license = license
135
140
 
136
141
  spec.files = manifest
137
142
  spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
@@ -140,6 +145,8 @@ class ThisProject
140
145
  spec.extra_rdoc_files += spec.files.grep(/(txt|rdoc|md)$/)
141
146
  spec.rdoc_options = [ "--main" , 'README.md',
142
147
  "--markup", "tomdoc" ]
148
+
149
+ spec.required_ruby_version = '>= 2.3.0'
143
150
  end
144
151
  end
145
152
 
@@ -166,20 +173,6 @@ class ThisProject
166
173
  return spec
167
174
  end
168
175
 
169
- # Internal: Set the recovery gem development dependency
170
- #
171
- # These are dynamically set since they cannot be hard coded as there is
172
- # no way to ship them correctly in the gemspec
173
- #
174
- # Returns nothing.
175
- def set_coverage_gem
176
- if RUBY_VERSION < "1.9.0"
177
- platform_gemspec.add_development_dependency( 'rcov', '~> 1.0.0' )
178
- else
179
- platform_gemspec.add_development_dependency( 'simplecov', '~> 0.8' )
180
- end
181
- end
182
-
183
176
  # Internal: Return the platform of ThisProject at the current moment in time.
184
177
  def platform
185
178
  (RUBY_PLATFORM == "java") ? 'java' : Gem::Platform::RUBY
@@ -189,17 +182,23 @@ class ThisProject
189
182
  def description_section
190
183
  section_of( 'README.md', 'DESCRIPTION')
191
184
  end
192
-
193
- # Internal: Return the summary text from the README
185
+
186
+ # Internal: Return the summary text from the README
194
187
  def summary
195
188
  description_section.first
196
189
  end
197
190
 
198
- # Internal: Return the full description text from the READEM
191
+ # Internal: Return the full description text from the README
199
192
  def description
200
193
  description_section.join(" ").tr("\n", ' ').gsub(/[{}]/,'').gsub(/\[[^\]]+\]/,'') # strip rdoc
201
194
  end
202
195
 
196
+ def license
197
+ license_file = project_path("LICENSE")
198
+ line = license_file.readlines.first
199
+ line.split(/\s+/).first
200
+ end
201
+
203
202
  # Internal: The path to the gemspec file
204
203
  def gemspec_file
205
204
  project_path( "#{ name }.gemspec" )