1hdoc 0.2.2 → 0.2.3
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/lib/1hdoc/actions/init.rb +1 -1
- data/lib/1hdoc/cli.rb +16 -14
- data/lib/1hdoc/core/configuration.rb +3 -2
- data/lib/1hdoc/core/progress.rb +0 -4
- data/lib/1hdoc/core/repository.rb +1 -6
- data/lib/1hdoc/version.rb +1 -1
- 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: c359c2620b09de6edbea3f18c745bbc30d53384e
|
4
|
+
data.tar.gz: 79becc34f51c9ea7da05d5a4134ecf8ca7a45477
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcf8f8a8af3cb50a56c5436bc1d586abca6a2d5bc62635e073817cbdc9b216b6d494cf6d47d3c43a724de2c9ae9ddaaeb4e1a6c71852dafb45889d64ac8ec877
|
7
|
+
data.tar.gz: dfdd0c29081238635f9d7e97384c368a5ae9dc0f0746677ce994921344c835c9fc5f481fcbb2489f0430dbf7562a9589a91485bdd77627edda993c033dcc0b3a
|
data/lib/1hdoc/actions/init.rb
CHANGED
@@ -10,7 +10,7 @@ module HDOC
|
|
10
10
|
# and create the configuration file in the user's $HOME path.
|
11
11
|
def init
|
12
12
|
print 'Do you already maintain a log on your PC? [yn] '
|
13
|
-
already_active = gets.chomp.downcase
|
13
|
+
already_active = $stdin.gets.chomp.downcase
|
14
14
|
|
15
15
|
return customize_configuration_file if already_active == 'y'
|
16
16
|
|
data/lib/1hdoc/cli.rb
CHANGED
@@ -2,6 +2,7 @@ module HDOC
|
|
2
2
|
##
|
3
3
|
# Provides the CLI interface for interact with the program.
|
4
4
|
class CLI
|
5
|
+
attr_reader :options
|
5
6
|
include Actions
|
6
7
|
|
7
8
|
AVAILABLE_COMMANDS = [
|
@@ -17,34 +18,35 @@ module HDOC
|
|
17
18
|
end
|
18
19
|
|
19
20
|
def run
|
20
|
-
|
21
|
-
opts.banner = 'Usage: 1hdoc [options]'
|
22
|
-
|
23
|
-
@options = opts
|
24
|
-
initialize_options
|
25
|
-
end.parse!
|
26
|
-
|
21
|
+
start_option_parser
|
27
22
|
rescue @option_parser::ParseError
|
28
|
-
$stderr.puts
|
23
|
+
$stderr.puts options
|
29
24
|
end
|
30
25
|
|
31
26
|
private
|
32
27
|
|
33
28
|
def check_for_configuration
|
34
29
|
unless File.exist? ENVIRONMENT[:configuration_file]
|
35
|
-
$stderr.puts '
|
30
|
+
$stderr.puts 'Seems like it is the first time you use 1hdoc..'
|
36
31
|
init
|
37
32
|
end
|
38
33
|
end
|
39
34
|
|
35
|
+
def start_option_parser
|
36
|
+
@option_parser.new do |opts|
|
37
|
+
opts.banner = 'Usage: 1hdoc [options]'
|
38
|
+
|
39
|
+
@options = opts
|
40
|
+
initialize_options
|
41
|
+
end.parse!
|
42
|
+
end
|
43
|
+
|
40
44
|
def initialize_options
|
41
45
|
AVAILABLE_COMMANDS.each do |command|
|
42
|
-
|
46
|
+
# Retrieve method's name deleting double dashes from command.
|
47
|
+
target_method = command[1].gsub('--', '')
|
48
|
+
options.on(*command) { send(target_method) }
|
43
49
|
end
|
44
50
|
end
|
45
|
-
|
46
|
-
def remove_dashes(command)
|
47
|
-
command.sub('--', '')
|
48
|
-
end
|
49
51
|
end
|
50
52
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module HDOC
|
2
2
|
##
|
3
3
|
# Provides methods for read configuration options by a file.
|
4
|
-
# By default, it uses YAML as configuration file's
|
4
|
+
# By default, it uses YAML as configuration file's parser.
|
5
5
|
class Configuration
|
6
6
|
attr_reader :options, :file_path
|
7
7
|
|
@@ -16,8 +16,9 @@ module HDOC
|
|
16
16
|
def initialize(file_path, file_parser = YAML)
|
17
17
|
@file_path = File.expand_path(file_path)
|
18
18
|
@file_parser = file_parser
|
19
|
+
@options = {}
|
19
20
|
|
20
|
-
raise
|
21
|
+
raise "Unable to find #{@file_path}" unless File.exist? @file_path
|
21
22
|
load_options
|
22
23
|
end
|
23
24
|
|
data/lib/1hdoc/core/progress.rb
CHANGED
@@ -18,15 +18,10 @@ module HDOC
|
|
18
18
|
def commit(message)
|
19
19
|
@repo.add(all: true)
|
20
20
|
@repo.commit(message)
|
21
|
-
|
22
|
-
rescue @adapter::GitExecuteError => error
|
23
|
-
$stderr.puts error
|
24
21
|
end
|
25
22
|
|
26
23
|
def push
|
27
|
-
|
28
|
-
rescue @adapter::GitExecuteError => error
|
29
|
-
$stderr.puts error
|
24
|
+
@repo.push
|
30
25
|
end
|
31
26
|
end
|
32
27
|
end
|
data/lib/1hdoc/version.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.3
|
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-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|