Class: Ellipses::Client::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/ellipses/client/application.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#loaderObject (readonly)

Returns the value of attribute loader.



6
7
8
# File 'lib/ellipses/client/application.rb', line 6

def loader
  @loader
end

#pathsObject (readonly)

Returns the value of attribute paths.



6
7
8
# File 'lib/ellipses/client/application.rb', line 6

def paths
  @paths
end

#repositoryObject (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

#dumpObject



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

#shutdownObject



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

#updateObject



47
48
49
50
51
# File 'lib/ellipses/client/application.rb', line 47

def update
  init!
  repository.each_source(&:recompile)
  shutdown
end

#validate!Object

Raises:

  • (NotImplementedError)


53
54
55
# File 'lib/ellipses/client/application.rb', line 53

def validate!(*)
  raise NotImplementedError
end