Class: Ellipses::Client::Application
- Inherits:
-
Object
- Object
- Ellipses::Client::Application
- Defined in:
- lib/ellipses/client/application.rb
Instance Attribute Summary collapse
-
#loader ⇒ Object
readonly
Returns the value of attribute loader.
-
#paths ⇒ Object
readonly
Returns the value of attribute paths.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
- #compile(file) ⇒ Object
- #compile!(file) ⇒ Object
- #decompile(file) ⇒ Object
- #decompile!(file) ⇒ Object
- #dump ⇒ Object
- #init(directory) ⇒ Object
-
#initialize(loader: nil, repository: nil, paths: nil) ⇒ Application
constructor
A new instance of Application.
- #shutdown ⇒ Object
- #update ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(loader: nil, repository: nil, paths: nil) ⇒ Application
Returns a new instance of Application.
8 9 10 11 12 |
# File 'lib/ellipses/client/application.rb', line 8 def initialize(loader: nil, repository: nil, paths: nil) @loader = loader || MetaFile.new @paths = locate(paths) @repository = repository || Repository.new(@loader, @paths) end |
Instance Attribute Details
#loader ⇒ Object (readonly)
Returns the value of attribute loader.
6 7 8 |
# File 'lib/ellipses/client/application.rb', line 6 def loader @loader end |
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
6 7 8 |
# File 'lib/ellipses/client/application.rb', line 6 def paths @paths end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
6 7 8 |
# File 'lib/ellipses/client/application.rb', line 6 def repository @repository end |
Instance Method Details
#compile(file) ⇒ Object
24 25 26 27 |
# File 'lib/ellipses/client/application.rb', line 24 def compile(file) init! repository.register(file).recompile end |
#compile!(file) ⇒ Object
29 30 31 32 |
# File 'lib/ellipses/client/application.rb', line 29 def compile!(file) compile(file) shutdown end |
#decompile(file) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/ellipses/client/application.rb', line 34 def decompile(file) init! return unless repository.registered?(file) repository[file].decompile repository.unregister(file) end |
#decompile!(file) ⇒ Object
42 43 44 45 |
# File 'lib/ellipses/client/application.rb', line 42 def decompile!(file) decompile(file) shutdown end |
#dump ⇒ Object
57 58 59 |
# File 'lib/ellipses/client/application.rb', line 57 def dump repository.dump end |
#init(directory) ⇒ Object
14 15 16 |
# File 'lib/ellipses/client/application.rb', line 14 def init(directory) @loader = MetaFile.create(directory) end |
#shutdown ⇒ Object
18 19 20 21 22 |
# File 'lib/ellipses/client/application.rb', line 18 def shutdown Support::UI.warn 'Nothing changed' unless repository.save loader.write(dump) and Support::UI.info('Updated lock file') end |
#update ⇒ Object
47 48 49 50 51 |
# File 'lib/ellipses/client/application.rb', line 47 def update init! repository.each_source(&:recompile) shutdown end |
#validate! ⇒ Object
53 54 55 |
# File 'lib/ellipses/client/application.rb', line 53 def validate!(*) raise NotImplementedError end |