Class: MrGithub::App

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/mr_github.rb

Instance Method Summary collapse

Instance Method Details

#generateObject



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/mr_github.rb', line 56

def generate
  github_user = ENV['GITHUB_USER']
  if github_user.nil? || github_user.empty?
    raise Thor::Error, "Missing GITHUB_USER in ~/.mr_github. Add a line like GITHUB_USER=yourusername and try again"
  end

  github_password = ENV['GITHUB_PASSWORD']
  if github_password.nil? || github_password.empty?
    raise Thor::Error, "Missing GITHUB_PASSWORD in ~/.mr_github. Add a line like GITHUB_PASSWORD=yourpassword and try again"
  end

  mr_config = MrConfig.new(github_user, github_password)
  say "Generating .mrconfig with repositories #{github_user} can access"

  create_file "#{ENV['HOME']}/.mrconfig", mr_config.to_s
end