Class: Xmvc::Generator::Boot

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/xmvc/generators/boot.rb

Defined Under Namespace

Classes: PathError

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



8
9
10
# File 'lib/xmvc/generators/boot.rb', line 8

def self.source_root 
  File.join(Xmvc::TEMPLATE_PATH)
end

Instance Method Details

#defaultObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/xmvc/generators/boot.rb', line 13

def default
  
  ext = options[:type] || :js
  
  #host = Xmvc.host.config["name"]
  @development = []
  @production = []
  @test = []
  
  # Don't render app assets, those will be auto-loaded by javascript asset-mgr
  options[:vendors].reject{|v|v.class.vendor_name == :app}.each do |vendor|
    @development.concat(vendor.class.asset_urls(vendor, :development, :js))
    @development.concat(vendor.class.asset_urls(vendor, :production, :css))
    
    @production.concat(vendor.class.asset_urls(vendor, :production, :js))
    @production.concat(vendor.class.asset_urls(vendor, :production, :css))
  end
  @test = @development  # <-- TODO Think about test-resources
  
  @boot_filename = "/config/boot.js"
  @stylesheets = []
  
  template("index.html", "#{Xmvc::PUBLIC_PATH}/index.html", {:force => true})
  template("boot.js", "config/boot.js")
end

#sprocketsObject



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/xmvc/generators/boot.rb', line 40

def sprockets        
  @javascripts = []
  @stylesheets = []
  options[:vendors].each do |vendor|
    @javascripts.concat(vendor.class.asset_urls(vendor, :development, :js, "sprockets"))
    @stylesheets.concat(vendor.class.asset_urls(vendor, :production, :css))
  end
  
  # Application sass / css??
  template("index.html.sprockets", "public/index.html.sprockets")
end