Class: Jax::Packager

Inherits:
Object
  • Object
show all
Includes:
FileUtils
Defined in:
lib/jax/packager.rb

Defined Under Namespace

Classes: SprocketsTemplate

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pkg_path) ⇒ Packager

Returns a new instance of Packager.



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/jax/packager.rb', line 41

def initialize(pkg_path)
  @pkg_path = pkg_path
  @manifest = []
  
  @path = File.join(@pkg_path, "javascripts/#{Jax.application.class.name.underscore}.js")
  @secretary = Sprockets::Secretary.new(
          :root => Jax.root,
          :asset_root => @pkg_path.to_s,
          :load_path => Jax.application.javascript_load_paths,
          :source_files => []
  )
  @project = Jax::Packager::SprocketsTemplate.new(@secretary.environment)
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



6
7
8
# File 'lib/jax/packager.rb', line 6

def path
  @path
end

#pkg_pathObject (readonly)

Returns the value of attribute pkg_path.



6
7
8
# File 'lib/jax/packager.rb', line 6

def pkg_path
  @pkg_path
end

#projectObject (readonly)

Returns the value of attribute project.



6
7
8
# File 'lib/jax/packager.rb', line 6

def project
  @project
end

Class Method Details

.invokeObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/jax/packager.rb', line 10

def invoke
  puts "DEPRECATED"
  puts
  puts "Please invoke the Jax packager with the following command:"
  puts
  puts "  jax package"
  puts
  puts "This notice will be removed sometime around Jax v1.2."
  puts
  puts
  
  Jax::Generators::Packager::PackageGenerator.start([])
end

Instance Method Details

#build!Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/jax/packager.rb', line 25

def build!
  @secretary.preprocessor.require(project)
  
  mkdir_p File.dirname(@path)
  @secretary.concatenation.save_to @path
  
  file = File.open(@path, "a")
  Jax.application.shaders.each { |shader| shader.save_to file }
  Jax::ResourceCompiler.new.save(file)
  Jax.application.routes.compile(file)
  
  file.close
  
  @secretary.install_assets
end