Module: Exportr::Helpers
- Extended by:
- Config
- Included in:
- Command
- Defined in:
- lib/exportr/helpers.rb
Constant Summary
Constants included
from Config
Config::CONFIG_FILE, Config::NOT_RAILS, Config::NO_CONFIG_FILE
Instance Method Summary
collapse
Methods included from Config
extended
Instance Method Details
#config_file ⇒ Object
33
34
35
|
# File 'lib/exportr/helpers.rb', line 33
def config_file
File.expand_path(CONFIG_FILE, rails_root)
end
|
#error(msg) ⇒ Object
13
14
15
16
|
# File 'lib/exportr/helpers.rb', line 13
def error msg
STDERR.puts " | ERROR: #{msg}"
exit 1
end
|
#in_rails_application? ⇒ Boolean
18
19
20
|
# File 'lib/exportr/helpers.rb', line 18
def in_rails_application?
!!rails_root
end
|
#log(msg = nil) ⇒ Object
9
10
11
|
# File 'lib/exportr/helpers.rb', line 9
def log msg=nil
STDOUT.puts msg ? " | #{msg}" : ""
end
|
#rails_root ⇒ Object
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/exportr/helpers.rb', line 22
def rails_root
begin
return Dir.pwd if File.exists?('script/rails')
raise
rescue
Dir.chdir '..'
retry unless Dir.pwd == '/'
return false
end
end
|