Class: Deka::Cli
- Inherits:
-
Object
- Object
- Deka::Cli
- Defined in:
- lib/deka/cli.rb
Instance Attribute Summary collapse
-
#base_hash ⇒ Object
Returns the value of attribute base_hash.
-
#config ⇒ Object
Returns the value of attribute config.
-
#save_file ⇒ Object
Returns the value of attribute save_file.
-
#yaml ⇒ Object
writeonly
Sets the attribute yaml.
Class Method Summary collapse
Instance Method Summary collapse
- #client ⇒ Object
-
#initialize(options = {}) ⇒ Cli
constructor
A new instance of Cli.
- #run ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Cli
Returns a new instance of Cli.
12 13 14 15 16 17 |
# File 'lib/deka/cli.rb', line 12 def initialize( = {}) @config = [:config] || './deka.yml' @save_file = [:save] || './.tracked_hash' @base_hash = File.read(save_file).chomp @dry_run = [:'dry-run'] end |
Instance Attribute Details
#base_hash ⇒ Object
Returns the value of attribute base_hash.
6 7 8 |
# File 'lib/deka/cli.rb', line 6 def base_hash @base_hash end |
#config ⇒ Object
Returns the value of attribute config.
6 7 8 |
# File 'lib/deka/cli.rb', line 6 def config @config end |
#save_file ⇒ Object
Returns the value of attribute save_file.
6 7 8 |
# File 'lib/deka/cli.rb', line 6 def save_file @save_file end |
#yaml=(value) ⇒ Object
Sets the attribute yaml
6 7 8 |
# File 'lib/deka/cli.rb', line 6 def yaml=(value) @yaml = value end |
Class Method Details
.run(options = {}) ⇒ Object
8 9 10 |
# File 'lib/deka/cli.rb', line 8 def self.run( = {}) new().run end |
Instance Method Details
#client ⇒ Object
34 35 36 |
# File 'lib/deka/cli.rb', line 34 def client @client ||= Octokit::Client.new(access_token: access_token) end |
#run ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/deka/cli.rb', line 19 def run log = fetch_log all_hashes = log.each_line.map { |line| line.strip[0..39] } issue_hashes = all_hashes.take_while { |hash| hash != base_hash }.reverse issue_hashes.each do |issue_hash| create_issue(issuing_repo, issue_hash) end update_lastest_hash(issue_hashes.last) ensure delete_temp_repo end |