Sha256: 7f61a94d8e7072af65807cedc52ce92df809b2a73cf6af0b68d7c9cb04f05a90
Contents?: true
Size: 1.47 KB
Versions: 4
Compression:
Stored size: 1.47 KB
Contents
require 'rubygems/gem_runner' require 'marc/spec/module_info' module MARC::Spec class << self def project_root @project_root ||= File.expand_path('..', __dir__) end def artifacts_dir return project_root unless ENV['CI'] @artifacts_dir ||= File.join(project_root, 'artifacts') end def gemspec_file @gemspec_file ||= begin gemspec_files = Dir.glob(File.expand_path('*.gemspec', project_root)) raise ArgumentError, "Too many .gemspecs: #{gemspec_files.join(', ')}" if gemspec_files.size > 1 raise ArgumentError, 'No .gemspec file found' if gemspec_files.empty? gemspec_files[0] end end def gemspec_basename File.basename(gemspec_file) end def output_file @output_file ||= begin gem_name = File.basename(gemspec_file, '.*') version = MARC::Spec::ModuleInfo::VERSION basename = "#{gem_name}-#{version}.gem" File.join(artifacts_dir, basename) end end def output_file_relative return File.basename(output_file) unless ENV['CI'] @output_file_relative ||= begin artifacts_dir_relative = File.basename(artifacts_dir) File.join(artifacts_dir_relative, File.basename(output_file)) end end end end desc "Build #{MARC::Spec.gemspec_basename} as #{MARC::Spec.output_file_relative}" task :gem do args = ['build', MARC::Spec.gemspec_file, "--output=#{MARC::Spec.output_file}"] Gem::GemRunner.new.run(args) end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ruby-marc-spec-0.1.3 | rakelib/gem.rake |
ruby-marc-spec-0.1.2 | rakelib/gem.rake |
ruby-marc-spec-0.1.1 | rakelib/gem.rake |
ruby-marc-spec-0.1.0 | rakelib/gem.rake |