|
1 | 1 | source ENV['GEM_SOURCE'] || "https://rubygems.org"
|
2 | 2 |
|
3 |
| -def location_for(place, fake_version = nil) |
4 |
| - if place =~ /^((?:git|https?)[:@][^#]*)#(.*)/ |
5 |
| - [fake_version, { :git => $1, :branch => $2, :require => false, :submodules => true }].compact |
6 |
| - elsif place =~ /^file:\/\/(.*)/ |
7 |
| - ['>= 0', { :path => File.expand_path($1), :require => false }] |
| 3 | +gemspec |
| 4 | + |
| 5 | +def location_for(place_or_version, fake_version = nil) |
| 6 | + git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?} |
| 7 | + file_url_regex = %r{\Afile:\/\/(?<path>.*)} |
| 8 | + |
| 9 | + if place_or_version && (git_url = place_or_version.match(git_url_regex)) |
| 10 | + [fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact |
| 11 | + elsif place_or_version && (file_url = place_or_version.match(file_url_regex)) |
| 12 | + ['>= 0', { path: File.expand_path(file_url[:path]), require: false }] |
8 | 13 | else
|
9 |
| - [place, { :require => false }] |
| 14 | + [place_or_version, { require: false }] |
10 | 15 | end
|
11 | 16 | end
|
12 | 17 |
|
13 |
| -gemspec |
14 |
| - |
15 |
| -# ffi (specifically the x64-mingw32 variant) requires ruby >= 2.0 after version 1.9.14 |
16 |
| -if RUBY_VERSION =~ /^1\.?9/ |
17 |
| - gem 'ffi', '<= 1.9.14' |
| 18 | +group :development do |
| 19 | + gem 'pry' |
| 20 | + gem 'pry-stack_explorer' |
| 21 | + gem 'fuubar' |
18 | 22 | end
|
19 | 23 |
|
20 |
| -gem 'rspec', *location_for(!ENV['RSPEC_GEM_VERSION']&.empty? ? ENV['RSPEC_GEM_VERSION'] : '~> 3.0') |
21 |
| -gem 'puppet', *location_for(!ENV['PUPPET_GEM_VERSION']&.empty? ? ENV['PUPPET_GEM_VERSION'] : '~> 7.0') |
22 |
| -gem 'facter', *location_for(!ENV['FACTER_GEM_VERSION']&.empty? ? ENV['FACTER_GEM_VERSION'] : '~> 4.0') |
23 |
| -gem 'pry', :group => :development |
| 24 | +group :test do |
24 | 25 |
|
25 |
| -if RUBY_VERSION =~ /^1\.?/ |
26 |
| - gem 'rake', '10.5.0' # still supports 1.8 |
27 |
| -else |
28 |
| - gem 'rake' |
29 |
| -end |
| 26 | + gem 'puppet', *location_for(ENV['PUPPET_LOCATION']) |
| 27 | + gem 'facter', *location_for(ENV['FACTER_LOCATION']) |
30 | 28 |
|
31 |
| -# json_pure 2.0.2 added a requirement on ruby >= 2. We pin to json_pure 2.0.1 |
32 |
| -# if using ruby 1.9; older ruby versions do not support puppets that require |
33 |
| -# these gems. |
34 |
| -if RUBY_VERSION =~ /^1\.?9/ |
35 |
| - gem 'json_pure', '<=2.0.1' |
36 |
| - # rubocop 0.42.0 requires ruby >=2; 1.8 is not supported |
37 |
| - gem 'rubocop', '0.41.2' if RUBY_VERSION =~ /^1\.?9/ |
38 |
| -elsif RUBY_VERSION =~ /^1\.?8/ |
39 |
| - gem 'json_pure', '< 2.0.0' |
40 |
| -else |
41 |
| - gem "rubocop", '= 1.6.1', require: false |
42 |
| - gem "rubocop-performance", '= 1.9.1', require: false |
43 |
| - gem "rubocop-rspec", '= 2.0.1', require: false |
44 |
| - gem 'sync' if (RUBY_VERSION >= '2.7.0') |
45 |
| -end |
| 29 | + gem 'json_pure' |
| 30 | + gem 'sync' |
46 | 31 |
|
47 |
| -if ENV['COVERAGE'] |
48 |
| - gem 'coveralls', :require => false |
49 |
| - gem 'simplecov', :require => false |
50 |
| -end |
| 32 | + gem 'rake', require: false |
51 | 33 |
|
52 |
| -gem 'win32-taskscheduler', :platforms => [:mingw, :x64_mingw, :mswin] |
| 34 | + gem 'codecov', require: false |
| 35 | + gem 'rspec', '~> 3.0', require: false |
| 36 | + gem 'rubocop', '~> 1.48', require: false |
| 37 | + gem 'rubocop-performance', '~> 1.16', require: false |
| 38 | + gem 'rubocop-rspec', '~> 2.19', require: false |
| 39 | + gem 'simplecov', require: false |
| 40 | + gem 'simplecov-console', require: false |
53 | 41 |
|
54 |
| -if File.exist?('Gemfile.local') |
55 |
| - eval_gemfile('Gemfile.local') |
| 42 | + gem 'win32-taskscheduler', :platforms => [:mingw, :x64_mingw, :mswin] |
56 | 43 | end
|
0 commit comments