Class: Piggly::Config
- Defined in:
- lib/piggly/config.rb,
lib/piggly/config.rb
Instance Attribute Summary collapse
-
#accumulate ⇒ Object
(also: #accumulate?)
Returns the value of attribute accumulate.
-
#cache_root ⇒ Object
Returns the value of attribute cache_root.
-
#connection_name ⇒ Object
Returns the value of attribute connection_name.
-
#database_yml ⇒ Object
Returns the value of attribute database_yml.
-
#dry_run ⇒ Object
(also: #dry_run?)
Returns the value of attribute dry_run.
-
#filters ⇒ Object
Returns the value of attribute filters.
-
#report_root ⇒ Object
Returns the value of attribute report_root.
-
#trace_prefix ⇒ Object
Returns the value of attribute trace_prefix.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #mkpath(*args) ⇒ Object
- #path(*args) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/piggly/config.rb', line 69 def initialize @cache_root = File.("#{Dir.pwd}/piggly/cache") @report_root = File.("#{Dir.pwd}/piggly/reports") @database_yml = nil @connection_name = "piggly" @trace_prefix = "PIGGLY" @accumulate = false @dry_run = false @filters = [] end |
Instance Attribute Details
#accumulate ⇒ Object Also known as: accumulate?
Returns the value of attribute accumulate.
48 49 50 |
# File 'lib/piggly/config.rb', line 48 def accumulate @accumulate end |
#cache_root ⇒ Object
Returns the value of attribute cache_root.
48 49 50 |
# File 'lib/piggly/config.rb', line 48 def cache_root @cache_root end |
#connection_name ⇒ Object
Returns the value of attribute connection_name.
48 49 50 |
# File 'lib/piggly/config.rb', line 48 def connection_name @connection_name end |
#database_yml ⇒ Object
Returns the value of attribute database_yml.
48 49 50 |
# File 'lib/piggly/config.rb', line 48 def database_yml @database_yml end |
#dry_run ⇒ Object Also known as: dry_run?
Returns the value of attribute dry_run.
48 49 50 |
# File 'lib/piggly/config.rb', line 48 def dry_run @dry_run end |
#filters ⇒ Object
Returns the value of attribute filters.
48 49 50 |
# File 'lib/piggly/config.rb', line 48 def filters @filters end |
#report_root ⇒ Object
Returns the value of attribute report_root.
48 49 50 |
# File 'lib/piggly/config.rb', line 48 def report_root @report_root end |
#trace_prefix ⇒ Object
Returns the value of attribute trace_prefix.
48 49 50 |
# File 'lib/piggly/config.rb', line 48 def trace_prefix @trace_prefix end |
Class Method Details
.mkpath(root, file = nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/piggly/config.rb', line 16 def mkpath(root, file=nil) if file.nil? FileUtils.makedirs(root) root else path = path(root, file) FileUtils.makedirs(File.dirname(path)) path end end |
.path(root, file = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/piggly/config.rb', line 6 def path(root, file=nil) if file.nil? root else file[%r{^\.\.|^\/|^(?:[A-Z]:)?/}i] ? file : # ../path, /path, or D:\path that isn't relative to root File.join(root, file) end end |