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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3fd0f1da24023a430f210ec3429a85f77622c602
4
- data.tar.gz: d4de4fdf0918e13b63588cbf03168abefc4b03eb
3
+ metadata.gz: c359c2620b09de6edbea3f18c745bbc30d53384e
4
+ data.tar.gz: 79becc34f51c9ea7da05d5a4134ecf8ca7a45477
5
5
  SHA512:
6
- metadata.gz: 566b2f4b8001403ba06841fd99dd7fc71413964987194adb7a7fc85617a89c7c98d252c0b85c41f017b4d1878432fc5bc76d9418d7e73ae60eaf43762a3587e4
7
- data.tar.gz: a20b87688078417fe69233baace088ec376ee1af98c6e196d3697777e97312fbafa6d515b2cc80c02cae13be2042c8bd778223358eeaa161c69e36ff5a54add7
6
+ metadata.gz: dcf8f8a8af3cb50a56c5436bc1d586abca6a2d5bc62635e073817cbdc9b216b6d494cf6d47d3c43a724de2c9ae9ddaaeb4e1a6c71852dafb45889d64ac8ec877
7
+ data.tar.gz: dfdd0c29081238635f9d7e97384c368a5ae9dc0f0746677ce994921344c835c9fc5f481fcbb2489f0430dbf7562a9589a91485bdd77627edda993c033dcc0b3a
@@ -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
- @option_parser.new do |opts|
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 @options
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 'Unable to find configuration file..'
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
- @options.on(*command) { send(remove_dashes(command[1])) }
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 parse
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 Errno::ENOENT unless File.exist? @file_path
21
+ raise "Unable to find #{@file_path}" unless File.exist? @file_path
21
22
  load_options
22
23
  end
23
24
 
@@ -33,9 +33,5 @@ module HDOC
33
33
  def format_field(field, value)
34
34
  "**#{field.capitalize}:** #{value}\n\n"
35
35
  end
36
-
37
- def set_record(record)
38
- @record = record
39
- end
40
36
  end
41
37
  end
@@ -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
- puts @repo.push
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
@@ -1,7 +1,7 @@
1
1
  ##
2
2
  # Provides all necessary features implemented by 1hdoc.
3
3
  module HDOC
4
- VERSION = '0.2.2'.freeze
4
+ VERSION = '0.2.3'.freeze
5
5
  CODENAME = 'Phoenix'.freeze
6
6
 
7
7
  def self.version
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.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-17 00:00:00.000000000 Z
11
+ date: 2017-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake