cmd_tools 4.0.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cmd_tools/commands/emacs_launch.rb +1 -1
- data/lib/cmd_tools/config.rb +16 -6
- data/lib/cmd_tools/version.rb +1 -1
- metadata +3 -3
data/lib/cmd_tools/config.rb
CHANGED
@@ -8,14 +8,18 @@ module ::CmdTools::Config
|
|
8
8
|
CONFIG_FILE = File.join(CONFIG_DIR, 'config.yaml')
|
9
9
|
CONFIG_DEFAULT = {
|
10
10
|
'emacs' => ENV['ALTERNATE_EDITOR'] || 'emacs',
|
11
|
+
'emacs_window_systems' => %w[x ns mac],
|
11
12
|
}
|
12
13
|
|
14
|
+
@config = nil
|
15
|
+
|
13
16
|
# (Re)load config file.
|
14
17
|
def self.load
|
15
18
|
need_dump = false
|
16
19
|
@config = if File.readable?(CONFIG_FILE)
|
17
|
-
|
18
|
-
|
20
|
+
config_from_file = YAML.load_file(CONFIG_FILE)
|
21
|
+
config = CONFIG_DEFAULT.merge(config_from_file)
|
22
|
+
need_dump = config_from_file.size != CONFIG_DEFAULT.size
|
19
23
|
|
20
24
|
config
|
21
25
|
else
|
@@ -29,11 +33,17 @@ module ::CmdTools::Config
|
|
29
33
|
open(CONFIG_FILE, 'w').write(@config.to_yaml)
|
30
34
|
end
|
31
35
|
|
32
|
-
|
33
|
-
|
36
|
+
@config.each{|name, val|
|
37
|
+
var = "@#{name}"
|
38
|
+
instance_variable_set(var, val)
|
39
|
+
eval <<-EOS
|
40
|
+
def self.#{name}
|
41
|
+
#{var}
|
42
|
+
end
|
43
|
+
EOS
|
44
|
+
}
|
34
45
|
|
35
|
-
|
36
|
-
@config['emacs']
|
46
|
+
self
|
37
47
|
end
|
38
48
|
|
39
49
|
self.load
|
data/lib/cmd_tools/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmd_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-10-08 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ruby_patch
|
16
|
-
requirement: &
|
16
|
+
requirement: &83228330 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0.3'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *83228330
|
25
25
|
description: ! 'Command line tools. Please type
|
26
26
|
|
27
27
|
|