Class: FirstCommit::Cli::Main
- Inherits:
-
Base
- Object
- Thor
- Base
- FirstCommit::Cli::Main
show all
- Defined in:
- lib/first_commit/cli/main.rb
Instance Attribute Summary
Attributes inherited from Base
#client
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#get(project_name) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/first_commit/cli/main.rb', line 8
def get(project_name)
puts "Please run first-commit init to set your access token" unless ENV['GITHUB_TOKEN']
unless valid_project?(project_name)
return puts "This is not a valid project"
end
begin
last_commit(project_name)
rescue Octokit::Unauthorized
puts "Your auth credentials are wrong"
end
end
|
#init(token) ⇒ Object
3
4
5
|
# File 'lib/first_commit/cli/main.rb', line 3
def init(token)
File.write(File.expand_path('.env'), "GITHUB_TOKEN=#{token}")
end
|