Sha256: 532b91b3bcf8aafcb6d8a0b3b853e07b5a413acbf02ad45af4ec6cafb560010e

Contents?: true

Size: 946 Bytes

Versions: 3

Compression:

Stored size: 946 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_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

3 entries across 3 versions & 1 rubygems

Version Path
gem-release-2.0.0.dev.4 lib/gem/release/context/system.rb
gem-release-2.0.0.dev.3 lib/gem/release/context/system.rb
gem-release-2.0.0.dev.2 lib/gem/release/context/system.rb