Sha256: 28474fe379b7bd0bf7d8c6a3c7fdf93ba894bbc2ea558e3c4432aaee74a66f60

Contents?: true

Size: 1012 Bytes

Versions: 1

Compression:

Stored size: 1012 Bytes

Contents

module Gem
  module Release
    class Context
      class System
        def run(cmd)
          system(cmd)
        end

        def gem_cmd(cmd, *args)
          ::Gem::Commands.const_get("#{cmd.to_s.capitalize}Command").new.invoke(*args.flatten)
          # TODO what's with the return value? maybe add our own abstraction that can check the result?
          true
        end

        def git_clean?
          system 'git diff-index --quiet HEAD'
        end

        def git_remotes
          `git remote`.split("\n")
        end

        def git_tags
          `git tag`.split("\n")
        end

        def git_user_name
          str = `git config --get user.name`.strip
          str unless str.empty?
        end

        def git_user_email
          str = `git config --get user.email`.strip
          str unless str.empty?
        end

        def github_user_name
          str = `git config --get github.user`.strip
          str.empty? ? git_user_name : str
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gem-release-2.0.0.dev.5 lib/gem/release/context/system.rb