fusuma 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc1ccc23a12924fc5af5527efd39b3561cad0023
4
- data.tar.gz: 69321805a249c2a3a6fcc6209eccf439d0d1039e
3
+ metadata.gz: ab7c21fda1d6f09e06a8ccc3f18e0fe1d8d34aeb
4
+ data.tar.gz: 44a05a105bc8bf49e48a11b253642b834793d685
5
5
  SHA512:
6
- metadata.gz: 99f14ae299cd0f106df6b5504d7787101f8ac7e399c671726baaf8e750189882d4f99294c965a67ff460d7ed177ee4cfea6b86f69638fe2076f72f9f3f9ee4ed
7
- data.tar.gz: 6d0c33ad2b6e63a838b0985f8f3fbd46926c248c1456ec2bd8de9b9de7ea34f86517f83be262afe484f3661ab6f7d9ade81757f14bd61aa79f9d137931b9f842
6
+ metadata.gz: f4eb4842122e42c0c48ed9db1fac93d8df1dfe12f6eb625a20214d86fe53eda05c4eeddf985995b26009d21ab2543a7f249367542908a619e9ed4677a735ece6
7
+ data.tar.gz: cb740e6023def63f2f8b8a1500f9149848e52ad8d048522be601771364b98a5aa69d9a2a3586ad2d857e428e5e388dee01d52dbac57cf71e668c56202e166e36
data/README.md CHANGED
@@ -80,7 +80,8 @@ if the swipe's threshold change to `0.5`, shorten swipe-length by half
80
80
 
81
81
  ## Options
82
82
 
83
- * `-v` : Enable debug mode.
83
+ * `-v`, `--verbose` : Shows details about the results of running fusuma
84
+ * `-c`, `--config=path/to/file` : Use an alternative config file
84
85
 
85
86
  ## Contributing
86
87
 
data/exe/fusuma CHANGED
@@ -7,9 +7,14 @@ option = {}
7
7
  OptionParser.new do |opt|
8
8
  opt.on('-v',
9
9
  '--verbose',
10
- 'shows details about the results of running fusuma') do |v|
10
+ 'Shows details about the results of running fusuma') do |v|
11
11
  option[:verbose] = v
12
12
  end
13
+ opt.on('-c',
14
+ '--config=path/to/file',
15
+ 'Use an alternative config file') do |v|
16
+ option[:config] = v
17
+ end
13
18
  opt.parse!(ARGV)
14
19
  end
15
20
 
@@ -22,7 +22,12 @@ module Fusuma
22
22
  end
23
23
 
24
24
  def read_options(option)
25
- debug = option.fetch(:verbose, false)
25
+ config_path = option.fetch(:config, nil)
26
+ if config_path
27
+ Config.instance.custom_path = config_path
28
+ Config.reload
29
+ end
30
+ debug = option.fetch(:verbose, nil)
26
31
  MultiLogger.instance.debug_mode = true if debug
27
32
  end
28
33
  end
@@ -19,10 +19,13 @@ module Fusuma
19
19
  end
20
20
  end
21
21
 
22
+ attr_reader :keymap
23
+ attr_accessor :custom_path
24
+
22
25
  def initialize
26
+ @custom_path = nil
23
27
  reload
24
28
  end
25
- attr_accessor :keymap
26
29
 
27
30
  def reload
28
31
  @cache = nil
@@ -56,9 +59,25 @@ module Fusuma
56
59
 
57
60
  def file_path
58
61
  filename = 'fusuma/config.yml'
59
- original_path = File.expand_path "~/.config/#{filename}"
60
- default_path = File.expand_path "../../#{filename}", __FILE__
61
- File.exist?(original_path) ? original_path : default_path
62
+ if custom_path && File.exist?(expand_custom_path)
63
+ expand_custom_path
64
+ elsif File.exist?(expand_config_path(filename))
65
+ expand_config_path(filename)
66
+ else
67
+ expand_default_path(filename)
68
+ end
69
+ end
70
+
71
+ def expand_custom_path
72
+ File.expand_path(custom_path)
73
+ end
74
+
75
+ def expand_config_path(filename)
76
+ File.expand_path "~/.config/#{filename}"
77
+ end
78
+
79
+ def expand_default_path(filename)
80
+ File.expand_path "../../#{filename}", __FILE__
62
81
  end
63
82
 
64
83
  def action_index(gesture_info)
@@ -5,13 +5,15 @@ module Fusuma
5
5
  # logger separate between stdout and strerr
6
6
  class MultiLogger < Logger
7
7
  include Singleton
8
+
9
+ attr_reader :err_logger
10
+ attr_accessor :debug_mode
11
+
8
12
  def initialize
9
13
  super(STDOUT)
10
14
  @err_logger = Logger.new(STDERR)
11
15
  @debug_mode = false
12
16
  end
13
- attr_reader :err_logger
14
- attr_accessor :debug_mode
15
17
 
16
18
  def info(msg)
17
19
  return unless debug_mode?
@@ -1,3 +1,3 @@
1
1
  module Fusuma
2
- VERSION = '0.2.5'.freeze
2
+ VERSION = '0.2.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fusuma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - iberianpig
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-18 00:00:00.000000000 Z
11
+ date: 2017-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler