Sha256: 711c21b9f8b950e28ff756cb7c3cdf0aba8869f37b1866b2eb9a35345f1bc229

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require 'core_ext/string/camelize'

module GemRelease
  module Helpers
    def github_user
      @github_user ||= `git config --get github.user`.strip
    end

    def github_token
      @github_token ||= `git config --get github.token`.strip
    end

    def gem_name
      @gem_name ||= gemspec ? gemspec.name : gem_name_from_directory
    end

    def gem_name_from_directory
      File.basename(Dir.pwd)
    end

    def gem_module_path
      @gem_module_path ||= gem_name.gsub('-', '_')
    end

    def gem_module_name
      @gem_module_name ||= gem_module_path.camelize
    end

    def gem_filename
      gemspec.file_name
    end

    def gem_version
      gemspec.version.to_s
    end

    def gemspec
      @gemspec ||= Gem::Specification.load(gemspec_filename)
    rescue LoadError, RuntimeError
      nil
    end

    def gemspec_filename
      @gemspec_filename ||= begin
        name = Array(options[:args]).first rescue nil
        name ||= Dir['*.gemspec'].first
        name || raise("No gemspec found or given.")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gem-release-0.0.14 lib/gem_release/helpers.rb