1hdoc 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a84109594225740fa2b2a7696c0745d72f68b324
4
- data.tar.gz: 546dddc52b368d64b4221c2407c4a0b394b5c3e0
3
+ metadata.gz: 3fd0f1da24023a430f210ec3429a85f77622c602
4
+ data.tar.gz: d4de4fdf0918e13b63588cbf03168abefc4b03eb
5
5
  SHA512:
6
- metadata.gz: 6ed83b089e997708a403be343b83b0281ec8be37d2e0fc54524688c9459b527bcd09b8295f75e41317cf26490100796861914ed29835652d9b39b48be31cbc78
7
- data.tar.gz: 6e739f455a58e9e010fa532e902ced6a435c7bb0a1a536d2e389057721eb2dcba6613c59abdf0f9bd493bdca43dedbbb91b13f59800e2f25bb98f443f3992f39
6
+ metadata.gz: 566b2f4b8001403ba06841fd99dd7fc71413964987194adb7a7fc85617a89c7c98d252c0b85c41f017b4d1878432fc5bc76d9418d7e73ae60eaf43762a3587e4
7
+ data.tar.gz: a20b87688078417fe69233baace088ec376ee1af98c6e196d3697777e97312fbafa6d515b2cc80c02cae13be2042c8bd778223358eeaa161c69e36ff5a54add7
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # 1hdoc
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/1hdoc.svg)](https://badge.fury.io/rb/1hdoc)
4
+
3
5
  Keep track of your progress during #100DaysOfCode event.
4
6
 
5
7
  ## Installation
@@ -19,7 +19,7 @@ module HDOC
19
19
 
20
20
  def register_daily_progress
21
21
  open_log
22
- progress = Progress.new(@options[:day] + 1)
22
+ progress = Progress.new(@options[:day].to_i + 1)
23
23
 
24
24
  progress.register
25
25
  @log.append(progress.format)
@@ -27,13 +27,13 @@ module HDOC
27
27
 
28
28
  def commit_daily_progress
29
29
  open_repository
30
- @repository.commit("Add Day #{@options[:day] + 1}")
30
+ @repository.commit("Add Day #{@options[:day].to_i + 1}")
31
31
 
32
32
  push if @options[:auto_push]
33
33
  end
34
34
 
35
35
  def update_last_record_day
36
- @configuration.set :day, @configuration.options[:day] + 1
36
+ @configuration.set :day, @configuration.options[:day].to_i + 1
37
37
  @configuration.set :last_commit_on, Time.now.strftime('%Y-%m-%d')
38
38
 
39
39
  @configuration.update
@@ -1,9 +1,19 @@
1
1
  module HDOC
2
2
  module Actions
3
+ QUESTIONS = {
4
+ day: 'Great! On what day you are: ',
5
+ workspace: 'Ok! Where I could find your workspace (ex. ~/work/100doc): '
6
+ }.freeze
7
+
3
8
  ##
4
9
  # Initialize the necessary files cloning the #100DaysOfCode's repo
5
10
  # and create the configuration file in the user's $HOME path.
6
11
  def init
12
+ print 'Do you already maintain a log on your PC? [yn] '
13
+ already_active = gets.chomp.downcase
14
+
15
+ return customize_configuration_file if already_active == 'y'
16
+
7
17
  puts 'Where I should locate the #100DaysOfCode repo (ex. ~/my_repo): '
8
18
  @workspace = File.expand_path $stdin.gets.chomp
9
19
 
@@ -15,13 +25,30 @@ module HDOC
15
25
 
16
26
  private
17
27
 
28
+ def customize_configuration_file
29
+ configuration_options = {}
30
+
31
+ QUESTIONS.each do |option, question|
32
+ configuration_options[option] = Readline.readline(question, false)
33
+ end
34
+
35
+ initialize_configuration_file(configuration_options)
36
+ $stderr.puts 'Here we are! You are ready to go.'
37
+ end
38
+
18
39
  def initialize_workspace
19
40
  Repository.clone(ENVIRONMENT[:repository_url], @workspace)
20
41
  Log.reset(File.join(@workspace, ENVIRONMENT[:log_file]))
21
42
  end
22
43
 
23
- def initialize_configuration_file
24
- defaults = { auto_push: false, day: 0, workspace: @workspace }
44
+ def initialize_configuration_file(options = {})
45
+ defaults = {
46
+ auto_push: false,
47
+ day: 0,
48
+ workspace: @workspace
49
+ }.merge(options)
50
+
51
+ defaults[:workspace] = File.expand_path defaults[:workspace]
25
52
  Configuration.init(ENVIRONMENT[:configuration_file], defaults)
26
53
  end
27
54
  end
@@ -19,8 +19,7 @@ module HDOC
19
19
 
20
20
  def register
21
21
  QUESTIONS.each do |field, question|
22
- puts question
23
- @record[field] = gets.chomp
22
+ @record[field] = Readline.readline(question, false)
24
23
  end
25
24
  end
26
25
 
data/lib/1hdoc/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  ##
2
2
  # Provides all necessary features implemented by 1hdoc.
3
3
  module HDOC
4
- VERSION = '0.2.0'.freeze
4
+ VERSION = '0.2.2'.freeze
5
5
  CODENAME = 'Phoenix'.freeze
6
6
 
7
7
  def self.version
data/lib/1hdoc.rb CHANGED
@@ -4,6 +4,7 @@
4
4
  require 'yaml'
5
5
  require 'git'
6
6
  require 'optparse'
7
+ require 'readline'
7
8
 
8
9
  # 1hdoc
9
10
  require_relative '1hdoc/core/configuration'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 1hdoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dom Corvasce
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-08 00:00:00.000000000 Z
11
+ date: 2017-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake