lib/xmvc/builder.rb in xmvc-0.1.0 vs lib/xmvc/builder.rb in xmvc-0.1.1
- old
+ new
@@ -25,48 +25,38 @@
##
# Invoke jammit init app-name so that Jammit creates it's config/assets.yml
# Note that we must pass-in the name of the newly created app @name so that
# Jammit appends that to its config_path, otherwise it would create its config file
# in the pwd.
-
@asset_root = options[:asset_root] || File.expand_path('.')
- app_assets
+ javascripts = {
+ "application" => application_assets("javascripts", options[:application])
+ }
+ options[:vendors].each do |vendor|
+ javascripts.update(vendor["name"] => vendor_assets("javascripts", vendor))
+ end
jammit = Jammit::CLI.new([], options)
jammit.invoke(:init)
- jammit.invoke(:config, ["set", "javascripts", {
- "mvc" => mvc_assets,
- "app" => app_assets
- }])
+ jammit.invoke(:config, ["set", "javascripts", javascripts])
jammit.invoke(:build)
rescue Jammit::Error => e
raise Xmvc::BuilderError.new(e.message)
end
end
- def jammit(options={})
- Jammit::CLI.new([], options)
+ def vendor_assets(type, vendor)
+ vendor[type].map {|f| File.join("vendor", vendor["name"], f) }
end
- def mvc_assets
- YAML.load(File.read(File.join(@asset_root, 'vendor', 'mvc', 'build'))).map {|f|
- File.join('vendor', 'mvc', f)
- }
+ def application_assets(type, assets)
+ assets.map {|f| File.join(f)}
end
- def app_assets
- [
- 'app/App.js',
- 'config/application.js',
- 'config/routes.js',
- 'vendor/plugins/*/**.js',
- 'overrides/*.js',
- 'app/models/*.js',
- 'app/controllers/*.js',
- 'app/views/*/**.js'
- ]
+ def jammit(options={})
+ Jammit::CLI.new([], options)
end
end
end
end
\ No newline at end of file