hfam 0.1.2 → 0.1.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: 8f717e2e3ed53363cc3edf32ede40df3e0a36ab0
4
- data.tar.gz: df8e9ce5b49b07946d9b486d16accf4697c2a1cc
3
+ metadata.gz: 4d3ffd83a328aba96d4a03d4b808cffb89612716
4
+ data.tar.gz: d52457b084e33bd97c3889e0971b6f19f448850f
5
5
  SHA512:
6
- metadata.gz: b3b6d91a15895f9aaf232b7bb0611e85bc236e5b5aa3efc597cd30138ad922cb633283e838f9a559ecc2a8b8567d555879a1a5f5b7d698592d2df5bf47277fb8
7
- data.tar.gz: 25768a7db70201cd1952a6872e4d4b2574b32c0b3ff9e0910a3430668bcbe5a2edc17fe47d8bb7cd72f4e3384fa39dcbf5b59a2fb7d38392ba8f20c055e83708
6
+ metadata.gz: e049eca4edd219c53d90ab73e9391a40051d71c7814cccc546f64598d0deb7e8776bcca87d9812ea1f065617891a34ffb85b5b2b3ae9dfbfdf75acc54fde1b61
7
+ data.tar.gz: dcd228a55b3475aea7ea1796952cf5d772ab50007f1eeb0ae2abbf08a804a7162cb1ee9b8ee4b613041233104fbe1efbef77b6826e5f5b0d2710ae0b7dac0d65
@@ -1,3 +1,7 @@
1
+ # Modules
2
+ require "hfam/option_filter.rb"
3
+
4
+ # lib
1
5
  require "hfam/application.rb"
2
6
  require "hfam/argument_parser.rb"
3
7
  require "hfam/command.rb"
@@ -5,11 +9,12 @@ require "hfam/command/base.rb"
5
9
  require "hfam/commands/symlink.rb"
6
10
  require "hfam/commands/source.rb"
7
11
  require "hfam/command_set.rb"
8
- require "hfam/constants.rb"
9
12
  require "hfam/dsl.rb"
10
13
  require "hfam/logger.rb"
11
14
  require "hfam/payload.rb"
12
15
  require "hfam/version"
16
+ require "hfam/constants.rb"
13
17
 
18
+ # Core Extensions
14
19
  require "core_ext/fileutils.rb"
15
20
  require "core_ext/string.rb"
@@ -1,19 +1,19 @@
1
1
  module HFAM
2
2
  class Application
3
+ include ::HFAM::OptionFilter
4
+
3
5
  def initialize
4
6
  @payload = ::HFAM::Payload.new
5
7
 
6
8
  @payload.metadata = ArgumentParser.new.parse
7
9
 
10
+ # module OptionFilter#filter
11
+ filter
12
+
8
13
  @command_set = CommandSet.new
9
14
  end
10
15
 
11
16
  def run
12
- if @payload.help_option?
13
- puts @payload.help_message
14
- return
15
- end
16
-
17
17
  dsl = ::HFAM::DSL.new(@payload).tokenize
18
18
 
19
19
  @command_set.dispatch_commands(@payload)
@@ -17,6 +17,10 @@ module HFAM
17
17
  options[:path] = p
18
18
  end
19
19
 
20
+ opts.on("-v", "--version") do |v|
21
+ options[:version] = ::HFAM::VERSION_MESSAGE
22
+ end
23
+
20
24
  end
21
25
  begin
22
26
  o.parse!
@@ -2,6 +2,7 @@ module HFAM
2
2
  HOME = "#{ENV['HOME']}"
3
3
  DEFAULT_DOTFILES_PATH = "#{ENV['HOME']}/dotfiles"
4
4
 
5
+ VERSION_MESSAGE = "hfam v#{VERSION}"
5
6
  HELP = <<-SHELL
6
7
  HFAM - Hidden Files Are Manageable
7
8
 
@@ -0,0 +1,16 @@
1
+ module HFAM
2
+ module OptionFilter
3
+ def filter
4
+ blocking_flag = false
5
+
6
+ case true
7
+ when @payload.help_option?
8
+ puts @payload.help_message
9
+ exit(1)
10
+ when @payload.version_option?
11
+ puts @payload.version_message
12
+ exit(1)
13
+ end # case/when
14
+ end
15
+ end
16
+ end
@@ -16,6 +16,14 @@ module HFAM
16
16
  metadata[:help]
17
17
  end
18
18
 
19
+ def version_option?
20
+ !!metadata[:version]
21
+ end
22
+
23
+ def version_message
24
+ metadata[:version]
25
+ end
26
+
19
27
  def metadata
20
28
  self[:metadata]
21
29
  end
@@ -1,3 +1,3 @@
1
1
  module HFAM
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hfam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - mehdi_farsi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-20 00:00:00.000000000 Z
11
+ date: 2015-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -67,6 +67,7 @@ files:
67
67
  - lib/hfam/constants.rb
68
68
  - lib/hfam/dsl.rb
69
69
  - lib/hfam/logger.rb
70
+ - lib/hfam/option_filter.rb
70
71
  - lib/hfam/payload.rb
71
72
  - lib/hfam/version.rb
72
73
  homepage: https://github.com/mehdi-farsi/hfam