Class: Bower::Project::Creator
- Inherits:
-
Object
- Object
- Bower::Project::Creator
- Defined in:
- lib/rab/bower/project.rb
Instance Attribute Summary collapse
-
#src ⇒ Object
readonly
Returns the value of attribute src.
Instance Method Summary collapse
- #create! ⇒ Object
-
#initialize(src) ⇒ Creator
constructor
A new instance of Creator.
Constructor Details
#initialize(src) ⇒ Creator
11 12 13 |
# File 'lib/rab/bower/project.rb', line 11 def initialize(src) @src = src end |
Instance Attribute Details
#src ⇒ Object (readonly)
Returns the value of attribute src.
9 10 11 |
# File 'lib/rab/bower/project.rb', line 9 def src @src end |
Instance Method Details
#create! ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rab/bower/project.rb', line 15 def create! cmd = Bower::Command.new(src) cmd.install! prj_json = JSON.parse(cmd.list!) dep_paths = JSON.parse(cmd.list_paths!) cwd = prj_json.fetch("canonicalDir") = prj_json.fetch("pkgMeta") name = .fetch("name") version = .fetch("version") prj = Bower::Project.new(name, version, []) prj.assets += build_assets(cwd, ["main"]) # current prj.assets += build_dep_assets(cwd, dep_paths) prj end |