Class: Tagrity::ConfigFile
- Inherits:
-
Object
- Object
- Tagrity::ConfigFile
show all
- Includes:
- Singleton
- Defined in:
- lib/tagrity/config_file.rb
Defined Under Namespace
Classes: ErrorTagFileNotWritable
Constant Summary
collapse
- CONFIG_FNAME =
'tagrity_config.yml'
Instance Method Summary
collapse
Instance Method Details
#command_for_extension(extension) ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'lib/tagrity/config_file.rb', line 29
def command_for_extension(extension)
cmd = extension_commands[extension.to_s]
if cmd.nil?
default_command
else
cmd
end
end
|
#default_command ⇒ Object
58
59
60
|
# File 'lib/tagrity/config_file.rb', line 58
def default_command
@config['default_command']
end
|
#excluded_paths ⇒ Object
78
79
80
|
# File 'lib/tagrity/config_file.rb', line 78
def excluded_paths
@config['excluded_paths']
end
|
#extension_commands ⇒ Object
54
55
56
|
# File 'lib/tagrity/config_file.rb', line 54
def extension_commands
@config['extension_commands']
end
|
#extensions_blacklist ⇒ Object
70
71
72
|
# File 'lib/tagrity/config_file.rb', line 70
def extensions_blacklist
@config['extensions_blacklist']
end
|
#extensions_whitelist ⇒ Object
66
67
68
|
# File 'lib/tagrity/config_file.rb', line 66
def extensions_whitelist
@config['extensions_whitelist']
end
|
#git_strategy ⇒ Object
74
75
76
|
# File 'lib/tagrity/config_file.rb', line 74
def git_strategy
@config['git_strategy']
end
|
#ignore_extension?(extension) ⇒ Boolean
38
39
40
41
42
43
44
|
# File 'lib/tagrity/config_file.rb', line 38
def ignore_extension?(extension)
unless extensions_whitelist.empty?
return !extensions_whitelist.include?(extension.to_s)
end
extensions_blacklist.include?(extension.to_s)
end
|
#initial_load ⇒ Object
23
24
25
26
27
|
# File 'lib/tagrity/config_file.rb', line 23
def initial_load
if @config.nil?
read_config
end
end
|
#path_ignored?(path) ⇒ Boolean
46
47
48
|
# File 'lib/tagrity/config_file.rb', line 46
def path_ignored?(path)
excluded_paths.any? { |pat| !(/^#{pat}/ =~ path.to_s).nil? }
end
|
#reload_global ⇒ Object
19
20
21
|
# File 'lib/tagrity/config_file.rb', line 19
def reload_global
read_config(fname: global_config_path)
end
|
#reload_local ⇒ Object
15
16
17
|
# File 'lib/tagrity/config_file.rb', line 15
def reload_local
read_config(fname: local_config_path)
end
|
#respect_git? ⇒ Boolean
50
51
52
|
# File 'lib/tagrity/config_file.rb', line 50
def respect_git?
git_strategy != 'NA'
end
|
#tagf ⇒ Object
62
63
64
|
# File 'lib/tagrity/config_file.rb', line 62
def tagf
@config['tagf']
end
|
#to_s ⇒ Object
82
83
84
|
# File 'lib/tagrity/config_file.rb', line 82
def to_s
@config.to_s
end
|