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 +4 -4
- data/README.md +2 -0
- data/lib/1hdoc/actions/commit.rb +3 -3
- data/lib/1hdoc/actions/init.rb +29 -2
- data/lib/1hdoc/core/progress.rb +1 -2
- data/lib/1hdoc/version.rb +1 -1
- data/lib/1hdoc.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fd0f1da24023a430f210ec3429a85f77622c602
|
4
|
+
data.tar.gz: d4de4fdf0918e13b63588cbf03168abefc4b03eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 566b2f4b8001403ba06841fd99dd7fc71413964987194adb7a7fc85617a89c7c98d252c0b85c41f017b4d1878432fc5bc76d9418d7e73ae60eaf43762a3587e4
|
7
|
+
data.tar.gz: a20b87688078417fe69233baace088ec376ee1af98c6e196d3697777e97312fbafa6d515b2cc80c02cae13be2042c8bd778223358eeaa161c69e36ff5a54add7
|
data/README.md
CHANGED
data/lib/1hdoc/actions/commit.rb
CHANGED
@@ -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
|
data/lib/1hdoc/actions/init.rb
CHANGED
@@ -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 = {
|
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
|
data/lib/1hdoc/core/progress.rb
CHANGED
data/lib/1hdoc/version.rb
CHANGED
data/lib/1hdoc.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2017-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|