Class: Wooget::Unity
- Inherits:
-
Thor
- Object
- Thor
- Wooget::Unity
- Includes:
- Thor::Actions
- Defined in:
- lib/wooget/template/unity.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/wooget/template/unity.rb', line 3 def @options end |
Class Method Details
.source_root ⇒ Object
8 9 10 |
# File 'lib/wooget/template/unity.rb', line 8 def self.source_root File.join(File.dirname(__FILE__), "files") end |
Instance Method Details
#bootstrap ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/wooget/template/unity.rb', line 14 def bootstrap dependencies_path = File.join([:path], "paket.dependencies") if File.exists?(dependencies_path) set_wooga_sources dependencies_path else template("unity_paket.dependencies.erb", File.join([:path], "paket.dependencies")) end required_files = %w(paket.lock paket.unity3d.references).select { |f| not File.exists?(File.join([:path], f)) } required_files.each { |f| create_file File.join([:path], f) } end |
#generate_references ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/wooget/template/unity.rb', line 45 def generate_references unless Paket.should_generate_unity3d_references? [:path] Wooget.log.debug "automanage tag not found - skipping `paket.unity3d.references` generation" return end to_install = File.open(File.join([:path], "paket.dependencies")).readlines.select { |l| l =~ /^\s*nuget \w+/ } to_install.map! { |d| d.match(/nuget (\S+)/)[1] } File.open(File.join([:path], "paket.unity3d.references"), "w") do |f| to_install.each { |dep| f.puts(dep) } end end |
#install(package) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/wooget/template/unity.rb', line 32 def install package unless Util.file_contains? File.join([:path], "paket.dependencies"), "nuget #{package}" package.split(",").each do |pkg| append_to_file File.join([:path], "paket.dependencies"), "\nnuget #{pkg}" end end generate_references end |