Class: Figs::Application
- Inherits:
-
Object
- Object
- Figs::Application
- Includes:
- Enumerable
- Defined in:
- lib/figs/application.rb
Constant Summary collapse
- FIGS_ENV_PREFIX =
"_FIGS_"
Instance Attribute Summary collapse
Instance Method Summary collapse
- #configuration ⇒ Object
- #each(&block) ⇒ Object
- #env ⇒ Object
- #figsfile ⇒ Object
- #flattened_filenames(filenames) ⇒ Object
-
#initialize(options = {}) ⇒ Application
constructor
A new instance of Application.
- #load ⇒ Object
- #load_path ⇒ Object
- #locations ⇒ Object
- #path_from_git(git_path, filenames = nil) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Application
Returns a new instance of Application.
17 18 19 20 21 |
# File 'lib/figs/application.rb', line 17 def initialize( = {}) @figsfile = [:file] @stage = [:stage] load_path end |
Instance Attribute Details
#path ⇒ Object
51 52 53 |
# File 'lib/figs/application.rb', line 51 def path (@path || default_path) end |
#stage ⇒ Object
55 56 57 |
# File 'lib/figs/application.rb', line 55 def stage (@stage || default_stage).to_s end |
Instance Method Details
#configuration ⇒ Object
59 60 61 |
# File 'lib/figs/application.rb', line 59 def configuration global_configuration.merge(stage_configuration) end |
#each(&block) ⇒ Object
75 76 77 |
# File 'lib/figs/application.rb', line 75 def each(&block) configuration.each(&block) end |
#figsfile ⇒ Object
47 48 49 |
# File 'lib/figs/application.rb', line 47 def figsfile (@figsfile || default_figsfile) end |
#flattened_filenames(filenames) ⇒ Object
27 28 29 |
# File 'lib/figs/application.rb', line 27 def flattened_filenames(filenames) Figs::DirectoryFlattener.flattened_filenames(filenames) end |
#load ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/figs/application.rb', line 63 def load each do |key, value| set(key, value) unless skip?(key) end ensure Figs::GitHandler.clear_temp_files end |
#load_path ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/figs/application.rb', line 31 def load_path if figsfile["method"].eql? "git" @path = path_from_git(figsfile["repo"], flattened_filenames(figsfile["locations"])) else @path = flattened_filenames(figsfile["locations"]) end end |
#locations ⇒ Object
23 24 25 |
# File 'lib/figs/application.rb', line 23 def locations figsfile["locations"] end |
#path_from_git(git_path, filenames = nil) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/figs/application.rb', line 39 def path_from_git(git_path, filenames = nil) if(locations.is_a?(Array)) Figs::GitHandler.location(git_path, filenames) else Figs::GitHandler.location(git_path, @stage) end end |