diff --git a/fastlane.gemspec b/fastlane.gemspec index 3f34a909c19..6a59913cd93 100644 --- a/fastlane.gemspec +++ b/fastlane.gemspec @@ -15,10 +15,6 @@ config['require'] = [ config.delete('inherit_from') config.delete('CrossPlatform/ForkUsage') config.delete('Lint/IsStringUsage') -# We declare development dependencies in the Gemspec file because we use dynamic values in its template -config['Gemspec/DevelopmentDependencies'] = { - 'Enabled' => false -} File.write("#{lib}/fastlane/plugins/template/.rubocop.yml", YAML.dump(config)) diff --git a/fastlane/lib/fastlane/plugins/template/%gem_name%.gemspec.erb b/fastlane/lib/fastlane/plugins/template/%gem_name%.gemspec.erb index cba0b4aedc4..33e754dc98a 100644 --- a/fastlane/lib/fastlane/plugins/template/%gem_name%.gemspec.erb +++ b/fastlane/lib/fastlane/plugins/template/%gem_name%.gemspec.erb @@ -21,15 +21,4 @@ Gem::Specification.new do |spec| # since this would cause a circular dependency # spec.add_dependency 'your-dependency', '~> 1.0.0' - - spec.add_development_dependency('bundler') - spec.add_development_dependency('fastlane', '>= <%= Fastlane::VERSION %>') - spec.add_development_dependency('pry') - spec.add_development_dependency('rake') - spec.add_development_dependency('rspec') - spec.add_development_dependency('rspec_junit_formatter') - spec.add_development_dependency('rubocop', '<%= Fastlane::RUBOCOP_REQUIREMENT %>') - spec.add_development_dependency('rubocop-performance') - spec.add_development_dependency('rubocop-require_tools') - spec.add_development_dependency('simplecov') end diff --git a/fastlane/lib/fastlane/plugins/template/Gemfile b/fastlane/lib/fastlane/plugins/template/Gemfile deleted file mode 100644 index 7e8dba6b7ec..00000000000 --- a/fastlane/lib/fastlane/plugins/template/Gemfile +++ /dev/null @@ -1,6 +0,0 @@ -source('https://rubygems.org') - -gemspec - -plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') -eval_gemfile(plugins_path) if File.exist?(plugins_path) diff --git a/fastlane/lib/fastlane/plugins/template/Gemfile.erb b/fastlane/lib/fastlane/plugins/template/Gemfile.erb new file mode 100644 index 00000000000..9636fbd8231 --- /dev/null +++ b/fastlane/lib/fastlane/plugins/template/Gemfile.erb @@ -0,0 +1,27 @@ +source('https://rubygems.org') + +# Provides a consistent environment for Ruby projects by tracking and installing exact gem versions. +gem 'bundler' +# Automation tool for mobile developers. +gem 'fastlane', '>= <%= Fastlane::VERSION %>' +# Provides an interactive debugging environment for Ruby. +gem 'pry' +# A simple task automation tool. +gem 'rake' +# Behavior-driven testing tool for Ruby. +gem 'rspec' +# Formatter for RSpec to generate JUnit compatible reports. +gem 'rspec_junit_formatter' +# A Ruby static code analyzer and formatter. +gem 'rubocop', '<%= Fastlane::RUBOCOP_REQUIREMENT %>' +# A collection of RuboCop cops for performance optimizations. +gem 'rubocop-performance' +# A RuboCop extension focused on enforcing tools. +gem 'rubocop-require_tools' +# SimpleCov is a code coverage analysis tool for Ruby. +gem 'simplecov' + +gemspec + +plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') +eval_gemfile(plugins_path) if File.exist?(plugins_path) diff --git a/fastlane/spec/plugins_specs/plugin_generator_spec.rb b/fastlane/spec/plugins_specs/plugin_generator_spec.rb index b7b57dcfab9..69fdc8bebc2 100644 --- a/fastlane/spec/plugins_specs/plugin_generator_spec.rb +++ b/fastlane/spec/plugins_specs/plugin_generator_spec.rb @@ -103,10 +103,21 @@ gemfile_lines = File.read(gemfile).lines [ - "source('https://rubygems.org')\n", - "gemspec\n" + "source('https://rubygems.org')", + "gem 'bundler'", + "gem 'fastlane', '>= #{Fastlane::VERSION}'", + "gem 'pry'", + "gem 'rake'", + "gem 'rspec'", + "gem 'rspec_junit_formatter'", + "gem 'rubocop', '#{Fastlane::RUBOCOP_REQUIREMENT}'", + "gem 'rubocop-performance'", + "gem 'rubocop-require_tools'", + "gem 'simplecov'", + "gemspec" ].each do |line| - expect(gemfile_lines).to include(line) + # Expect them to match approximately, e.g. using regex + expect(gemfile_lines).to include("#{line}\n") end end @@ -224,18 +235,7 @@ expect(gemspec.version).to eq(Gem::Version.new('0.1.0')) expect(gemspec.email).to eq(email) expect(gemspec.summary).to eq(summary) - expect(gemspec.development_dependencies).to contain_exactly( - Gem::Dependency.new("pry", Gem::Requirement.new([">= 0"]), :development), - Gem::Dependency.new("bundler", Gem::Requirement.new([">= 0"]), :development), - Gem::Dependency.new("rspec", Gem::Requirement.new([">= 0"]), :development), - Gem::Dependency.new("rspec_junit_formatter", Gem::Requirement.new([">= 0"]), :development), - Gem::Dependency.new("rake", Gem::Requirement.new([">= 0"]), :development), - Gem::Dependency.new("rubocop", Gem::Requirement.new([Fastlane::RUBOCOP_REQUIREMENT]), :development), - Gem::Dependency.new("rubocop-require_tools", Gem::Requirement.new([">= 0"]), :development), - Gem::Dependency.new("rubocop-performance", Gem::Requirement.new([">= 0"]), :development), - Gem::Dependency.new("simplecov", Gem::Requirement.new([">= 0"]), :development), - Gem::Dependency.new("fastlane", Gem::Requirement.new([">= #{Fastlane::VERSION}"]), :development) - ) + expect(gemspec.development_dependencies).to eq([]) end end