class EacRubyGemsUtils::Gem
Constants
- GEMSPEC_EXTNAME
Public Instance Methods
bundle(*args)
click to toggle source
# File lib/eac_ruby_gems_utils/gem.rb, line 23 def bundle(*args) ::EacRubyGemsUtils::Gem::Command.new(self, %w[bundle] + args).envvar_gemfile end
files()
click to toggle source
@return A [Pathname] array with relative paths from root listed in gemspec's .file directive.
# File lib/eac_ruby_gems_utils/gem.rb, line 28 def files gemspec.files.map(&:to_pathname) end
gemfile_lock_content()
click to toggle source
# File lib/eac_ruby_gems_utils/gem.rb, line 36 def gemfile_lock_content ::Bundler::LockfileParser.new(::Bundler.read_file(gemfile_lock_path)) end
gemfile_lock_gem_version(gem_name)
click to toggle source
# File lib/eac_ruby_gems_utils/gem.rb, line 32 def gemfile_lock_gem_version(gem_name) gemfile_lock_content.specs.find { |gem| gem.name == gem_name }.if_present(&:version) end
name()
click to toggle source
# File lib/eac_ruby_gems_utils/gem.rb, line 40 def name name_by_gemspec || name_by_path end
name_by_gemspec()
click to toggle source
# File lib/eac_ruby_gems_utils/gem.rb, line 44 def name_by_gemspec gemspec_path.if_present { |v| v.basename(GEMSPEC_EXTNAME).to_path } end
name_by_path()
click to toggle source
# File lib/eac_ruby_gems_utils/gem.rb, line 48 def name_by_path fullname = root.basename.to_s /\A(.+)(?:-\d+(?:\.\d+)*)\z/.if_match(fullname, false) { |m| m[1] }.if_present(fullname) end
namespace_parts()
click to toggle source
# File lib/eac_ruby_gems_utils/gem.rb, line 53 def namespace_parts name.split('-') end
rake(*args)
click to toggle source
# File lib/eac_ruby_gems_utils/gem.rb, line 57 def rake(*args) raise "File \"#{rakefile_path}\" does not exist" unless rakefile_path.exist? bundle('exec', 'rake', '--rakefile', rakefile_path, *args) end
to_s()
click to toggle source
# File lib/eac_ruby_gems_utils/gem.rb, line 19 def to_s name end
version()
click to toggle source
# File lib/eac_ruby_gems_utils/gem.rb, line 63 def version version_file.value end
Private Instance Methods
gemfile_lock_path_uncached()
click to toggle source
# File lib/eac_ruby_gems_utils/gem.rb, line 73 def gemfile_lock_path_uncached gemfile_path.basename_sub { |b| "#{b}.lock" } end
gemfile_path_uncached()
click to toggle source
# File lib/eac_ruby_gems_utils/gem.rb, line 69 def gemfile_path_uncached root.join('Gemfile') end
gemspec_path_uncached()
click to toggle source
# File lib/eac_ruby_gems_utils/gem.rb, line 81 def gemspec_path_uncached ::Pathname.glob("#{root.to_path}/*#{GEMSPEC_EXTNAME}").first end
gemspec_uncached()
click to toggle source
# File lib/eac_ruby_gems_utils/gem.rb, line 77 def gemspec_uncached ::Gem::Specification.load(gemspec_path.to_path) end
rakefile_path_uncached()
click to toggle source
# File lib/eac_ruby_gems_utils/gem.rb, line 85 def rakefile_path_uncached root.join('Rakefile') end
version_file_path_uncached()
click to toggle source
# File lib/eac_ruby_gems_utils/gem.rb, line 93 def version_file_path_uncached root.join('lib', *namespace_parts, 'version.rb') end
version_file_uncached()
click to toggle source
# File lib/eac_ruby_gems_utils/gem.rb, line 89 def version_file_uncached ::EacRubyGemsUtils::Gem::VersionFile.new(version_file_path) end