Module: Confection::Current
- Included in:
- Confection
- Defined in:
- lib/confection/current.rb
Overview
Current mixin extends the Confection module. Primarily is provides class methods for working with the current project’s configurations.
Instance Method Summary collapse
- #bootstrap ⇒ Object
- #clear! ⇒ Object
- #controller(scope, tool, *options) ⇒ Object
- #current_directory ⇒ Object
- #current_project ⇒ Object
- #each(&block) ⇒ Object
- #profiles(tool) ⇒ Object
- #projects ⇒ Object
-
#properties ⇒ Object
Project properties.
- #size ⇒ Object
Instance Method Details
#bootstrap ⇒ Object
29 30 31 |
# File 'lib/confection/current.rb', line 29 def bootstrap $properties = current_project.properties end |
#clear! ⇒ Object
49 50 51 |
# File 'lib/confection/current.rb', line 49 def clear! current_project.store.clear! end |
#controller(scope, tool, *options) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/confection/current.rb', line 15 def controller(scope, tool, *) params = (Hash === .last ? .pop : {}) params[:profile] = .shift unless .empty? if from = params[:from] projects[from] ||= Project.load(from) projects[from].controller(scope, tool, params) else bootstrap if $properties.nil? # TODO: better way to go about this? current_project.controller(scope, tool, params) end end |
#current_directory ⇒ Object
39 40 41 |
# File 'lib/confection/current.rb', line 39 def current_directory @current_directory ||= Dir.pwd end |
#current_project ⇒ Object
44 45 46 |
# File 'lib/confection/current.rb', line 44 def current_project projects[current_directory] ||= Project.lookup(current_directory) end |
#each(&block) ⇒ Object
59 60 61 |
# File 'lib/confection/current.rb', line 59 def each(&block) current_project.each(&block) end |
#profiles(tool) ⇒ Object
54 55 56 |
# File 'lib/confection/current.rb', line 54 def profiles(tool) current_project.profiles(tool) end |
#projects ⇒ Object
34 35 36 |
# File 'lib/confection/current.rb', line 34 def projects @projects ||= {} end |
#properties ⇒ Object
Project properties.
71 72 73 |
# File 'lib/confection/current.rb', line 71 def properties current_project.properties end |
#size ⇒ Object
64 65 66 |
# File 'lib/confection/current.rb', line 64 def size current_project.size end |