wooga_wooget 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.travis.yml +20 -0
- data/Gemfile +3 -0
- data/Licence.md +21 -0
- data/README.md +48 -0
- data/Rakefile +80 -0
- data/bin/wooget +5 -0
- data/lib/wooget.rb +57 -0
- data/lib/wooget/build/build_info.rb +64 -0
- data/lib/wooget/build/builder.rb +285 -0
- data/lib/wooget/cli.rb +293 -0
- data/lib/wooget/nuget.rb +96 -0
- data/lib/wooget/paket.rb +81 -0
- data/lib/wooget/project.rb +42 -0
- data/lib/wooget/releasing.rb +112 -0
- data/lib/wooget/template/files/README.md.erb +20 -0
- data/lib/wooget/template/files/RELEASE_NOTES.md.erb +2 -0
- data/lib/wooget/template/files/assemblyinfo.erb +36 -0
- data/lib/wooget/template/files/class.erb +15 -0
- data/lib/wooget/template/files/csproj.erb +56 -0
- data/lib/wooget/template/files/gitignore.erb +13 -0
- data/lib/wooget/template/files/metafile.cs.erb +11 -0
- data/lib/wooget/template/files/paket.binary.template.erb +17 -0
- data/lib/wooget/template/files/paket.dependencies.erb +13 -0
- data/lib/wooget/template/files/paket.references.erb +2 -0
- data/lib/wooget/template/files/paket.template.erb +22 -0
- data/lib/wooget/template/files/sln.erb +32 -0
- data/lib/wooget/template/files/test_file.erb +19 -0
- data/lib/wooget/template/files/tests_assemblyinfo.erb +36 -0
- data/lib/wooget/template/files/tests_csproj.erb +67 -0
- data/lib/wooget/template/files/unity_paket.dependencies.erb +12 -0
- data/lib/wooget/template/unity.rb +73 -0
- data/lib/wooget/template/visual_studio.rb +56 -0
- data/lib/wooget/template/wooget_conf.json +13 -0
- data/lib/wooget/third_party/paket.bootstrapper.exe +0 -0
- data/lib/wooget/third_party/paket.exe +0 -0
- data/lib/wooget/third_party/paket.targets +36 -0
- data/lib/wooget/third_party/paket.unity3d.bootstrapper.exe +0 -0
- data/lib/wooget/third_party/paket.unity3d.exe +0 -0
- data/lib/wooget/util/build_error.rb +8 -0
- data/lib/wooget/util/misc.rb +91 -0
- data/lib/wooget/util/package_list_formatter.rb +59 -0
- data/lib/wooget/version.rb +22 -0
- data/tests/nuget_feed.xml +3439 -0
- data/tests/nuget_package.xml +49 -0
- data/tests/nuget_test.rb +27 -0
- data/tests/package_test.rb +72 -0
- data/tests/unity_test.rb +12 -0
- data/wiki/bootstrap.png +0 -0
- data/wiki/compiling.png +0 -0
- data/wiki/create.png +0 -0
- data/wiki/install.png +0 -0
- data/wiki/list.png +0 -0
- data/wiki/monodevelop.png +0 -0
- data/wiki/release.png +0 -0
- data/wiki/stupidmenu.png +0 -0
- data/wooget.gemspec +33 -0
- metadata +244 -0
@@ -0,0 +1,67 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
3
|
+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
4
|
+
<PropertyGroup>
|
5
|
+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
6
|
+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
7
|
+
<ProjectGuid>{<%= options[:tests][:guid] %>}</ProjectGuid>
|
8
|
+
<OutputType>Library</OutputType>
|
9
|
+
<AppDesignerFolder>Properties</AppDesignerFolder>
|
10
|
+
<RootNamespace><%= options[:name].split(".").first %></RootNamespace>
|
11
|
+
<AssemblyName><%= options[:name] %>.Tests</AssemblyName>
|
12
|
+
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
13
|
+
<FileAlignment>512</FileAlignment>
|
14
|
+
</PropertyGroup>
|
15
|
+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
16
|
+
<DebugSymbols>true</DebugSymbols>
|
17
|
+
<DebugType>full</DebugType>
|
18
|
+
<Optimize>false</Optimize>
|
19
|
+
<OutputPath>bin\Debug\</OutputPath>
|
20
|
+
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
21
|
+
<ErrorReport>prompt</ErrorReport>
|
22
|
+
<WarningLevel>4</WarningLevel>
|
23
|
+
</PropertyGroup>
|
24
|
+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
25
|
+
<DebugType>pdbonly</DebugType>
|
26
|
+
<Optimize>true</Optimize>
|
27
|
+
<OutputPath>bin\Release\</OutputPath>
|
28
|
+
<DefineConstants>TRACE</DefineConstants>
|
29
|
+
<ErrorReport>prompt</ErrorReport>
|
30
|
+
<WarningLevel>4</WarningLevel>
|
31
|
+
</PropertyGroup>
|
32
|
+
<ItemGroup>
|
33
|
+
<Reference Include="System" />
|
34
|
+
<Reference Include="System.Core" />
|
35
|
+
<Reference Include="System.Xml.Linq" />
|
36
|
+
<Reference Include="System.Data.DataSetExtensions" />
|
37
|
+
<Reference Include="System.Data" />
|
38
|
+
<Reference Include="System.Xml" />
|
39
|
+
</ItemGroup>
|
40
|
+
<ItemGroup>
|
41
|
+
<Compile Include="Properties\AssemblyInfo.cs" />
|
42
|
+
<% if options[:tests][:files] %>
|
43
|
+
<% options[:tests][:files].each do |file|%>
|
44
|
+
<%= %(<Compile Include="#{file}"/>) %>
|
45
|
+
<% end %>
|
46
|
+
<% end -%>
|
47
|
+
</ItemGroup>
|
48
|
+
<% if options[:tests][:projects] %>
|
49
|
+
<% options[:tests][:projects].each do |project| %>
|
50
|
+
<ItemGroup>
|
51
|
+
<ProjectReference Include="<%= project[:relative_location] %>">
|
52
|
+
<Project>{<%= project[:guid] %>}</Project>
|
53
|
+
<Name><%= project[:name] %></Name>
|
54
|
+
</ProjectReference>
|
55
|
+
</ItemGroup>
|
56
|
+
<% end %>
|
57
|
+
<% end %>
|
58
|
+
|
59
|
+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
60
|
+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
61
|
+
Other similar extension points exist, see Microsoft.Common.targets.
|
62
|
+
<Target Name="BeforeBuild">
|
63
|
+
</Target>
|
64
|
+
<Target Name="AfterBuild">
|
65
|
+
</Target>
|
66
|
+
-->
|
67
|
+
</Project>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
//remove the below line if you want to manually manage your paket.unity3d.references file
|
2
|
+
//[!automanage!]
|
3
|
+
|
4
|
+
//legacy wooga repo
|
5
|
+
source https://wooga.artifactoryonline.com/wooga/api/nuget/nuget-private username: "%USERNAME%" password: "%PASSWORD%"
|
6
|
+
|
7
|
+
//private wooga repos
|
8
|
+
source https://wooga.artifactoryonline.com/wooga/api/nuget/sdk-main username: "%USERNAME%" password: "%PASSWORD%"
|
9
|
+
source https://wooga.artifactoryonline.com/wooga/api/nuget/sdk-universe username: "%USERNAME%" password: "%PASSWORD%"
|
10
|
+
|
11
|
+
//public nuget repo
|
12
|
+
source https://nuget.org/api/v2
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module Wooget
|
2
|
+
class Unity < Thor
|
3
|
+
attr_accessor :options
|
4
|
+
include Thor::Actions
|
5
|
+
|
6
|
+
class_option :path, desc: "Path to unity project root", default: Dir.pwd
|
7
|
+
|
8
|
+
def self.source_root
|
9
|
+
File.join(File.dirname(__FILE__), "files")
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "bootstrap", "Add required files to unity project for wooget usage"
|
13
|
+
|
14
|
+
def bootstrap
|
15
|
+
|
16
|
+
dependencies_path = File.join(options[:path], "paket.dependencies")
|
17
|
+
if File.exists?(dependencies_path)
|
18
|
+
set_wooga_sources dependencies_path
|
19
|
+
else
|
20
|
+
template("unity_paket.dependencies.erb", File.join(options[:path], "paket.dependencies"))
|
21
|
+
end
|
22
|
+
|
23
|
+
required_files = %w(paket.lock paket.unity3d.references).select { |f| not File.exists?(File.join(options[:path], f)) }
|
24
|
+
required_files.each { |f| create_file File.join(options[:path], f) }
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
#todo: move things below into paket.rb and convert paket.rb to be thor task
|
29
|
+
|
30
|
+
desc "install PACKAGE_ID", "Install specific package into unity project"
|
31
|
+
|
32
|
+
def install package
|
33
|
+
unless Util.file_contains? File.join(options[:path], "paket.dependencies"), "nuget #{package}"
|
34
|
+
|
35
|
+
package.split(",").each do |pkg|
|
36
|
+
append_to_file File.join(options[:path], "paket.dependencies"), "\nnuget #{pkg}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
generate_references
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "generate_references", "Generate the paket.unity3d.references file from paket.dependency contents"
|
44
|
+
|
45
|
+
def generate_references
|
46
|
+
unless Paket.should_generate_unity3d_references? options[:path]
|
47
|
+
Wooget.log.debug "automanage tag not found - skipping `paket.unity3d.references` generation"
|
48
|
+
return
|
49
|
+
end
|
50
|
+
|
51
|
+
to_install = File.open(File.join(options[:path], "paket.dependencies")).readlines.select { |l| l =~ /^\s*nuget \w+/ }
|
52
|
+
to_install.map! { |d| d.match(/nuget (\S+)/)[1] }
|
53
|
+
|
54
|
+
File.open(File.join(options[:path], "paket.unity3d.references"), "w") do |f|
|
55
|
+
to_install.each { |dep| f.puts(dep) }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
no_commands do
|
60
|
+
def set_wooga_sources dependencies_path
|
61
|
+
lines = File.open(dependencies_path).readlines
|
62
|
+
lines.delete_if {|line| line =~ /wooga\.artifactoryonline\.com\/wooga/}
|
63
|
+
|
64
|
+
wooga_sources = ['source https://wooga.artifactoryonline.com/wooga/api/nuget/nuget-private username: "%USERNAME%" password: "%PASSWORD%"',
|
65
|
+
'source https://wooga.artifactoryonline.com/wooga/api/nuget/sdk-main username: "%USERNAME%" password: "%PASSWORD%"',
|
66
|
+
'source https://wooga.artifactoryonline.com/wooga/api/nuget/sdk-universe username: "%USERNAME%" password: "%PASSWORD%"'].map {|l| l + "\n"}
|
67
|
+
|
68
|
+
lines.insert(1, wooga_sources)
|
69
|
+
File.open(dependencies_path,"w") {|f| f << lines.join}
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Wooget
|
2
|
+
module Templates
|
3
|
+
class VisualStudio < Thor
|
4
|
+
attr_accessor :options
|
5
|
+
include Thor::Actions
|
6
|
+
add_runtime_options!
|
7
|
+
|
8
|
+
def self.source_root
|
9
|
+
File.join(File.dirname(__FILE__), "files")
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "create_project options", "create a wooget package tree"
|
13
|
+
|
14
|
+
def create_project options={}
|
15
|
+
raise "name not provided" unless options[:name]
|
16
|
+
|
17
|
+
@options = options #needed for erb binding
|
18
|
+
@options[:guid] ||= `uuidgen`.chomp
|
19
|
+
|
20
|
+
#src project defaults
|
21
|
+
if @options[:src]
|
22
|
+
@options[:src][:guid] ||= `uuidgen`.chomp
|
23
|
+
@options[:src][:name] ||= options[:name]
|
24
|
+
@options[:src][:files]||= []
|
25
|
+
@options[:src][:files] << "DummyClass.cs"
|
26
|
+
end
|
27
|
+
|
28
|
+
template("assemblyinfo.erb", "#{options[:name]}/src/#{options[:name]}/Properties/AssemblyInfo.cs")
|
29
|
+
template("class.erb", "#{options[:name]}/src/#{options[:name]}/DummyClass.cs")
|
30
|
+
template("csproj.erb", "#{options[:name]}/src/#{options[:name]}/#{options[:name]}.csproj")
|
31
|
+
create_file("#{options[:name]}/src/#{options[:name]}/#{options[:name]}.csproj.paket.references", "Wooga.Unity.DLLs")
|
32
|
+
template("paket.binary.template.erb", "#{options[:name]}/src/#{options[:name]}/#{options[:name]}.csproj.paket.template")
|
33
|
+
|
34
|
+
if @options[:tests]
|
35
|
+
@options[:tests][:guid] ||= `uuidgen`.chomp
|
36
|
+
@options[:tests][:files]||= []
|
37
|
+
@options[:tests][:name] ||= options[:name]
|
38
|
+
@options[:tests][:files] << "DummyTest.cs"
|
39
|
+
|
40
|
+
#referencing src project from test project
|
41
|
+
@options[:tests][:projects]||= []
|
42
|
+
src_project = {:guid => @options[:src][:guid], :name => @options[:src][:name], :relative_location => "../src/#{options[:name]}/#{options[:name]}.csproj"}
|
43
|
+
@options[:tests][:projects] << src_project
|
44
|
+
|
45
|
+
template("test_file.erb", "#{options[:name]}/tests/DummyTest.cs")
|
46
|
+
template("tests_csproj.erb", "#{options[:name]}/tests/#{options[:name]}.Tests.csproj")
|
47
|
+
template("tests_assemblyinfo.erb", "#{options[:name]}/tests/Properties/AssemblyInfo.cs")
|
48
|
+
template("paket.references.erb", "#{options[:name]}/tests/paket.references")
|
49
|
+
end
|
50
|
+
|
51
|
+
template("sln.erb", "#{options[:name]}/src/#{options[:name]}.sln")
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
Binary file
|
Binary file
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
3
|
+
<PropertyGroup>
|
4
|
+
<!-- Enable the restore command to run before builds -->
|
5
|
+
<RestorePackages Condition=" '$(RestorePackages)' == '' ">true</RestorePackages>
|
6
|
+
<!-- Download Paket.exe if it does not already exist -->
|
7
|
+
<DownloadPaket Condition=" '$(DownloadPaket)' == '' ">true</DownloadPaket>
|
8
|
+
<PaketToolsPath>$(MSBuildThisFileDirectory)</PaketToolsPath>
|
9
|
+
<PaketRootPath>$(MSBuildThisFileDirectory)..\</PaketRootPath>
|
10
|
+
</PropertyGroup>
|
11
|
+
<PropertyGroup>
|
12
|
+
<!-- Paket command -->
|
13
|
+
<PaketExePath Condition=" '$(PaketExePath)' == '' ">$(PaketToolsPath)paket.exe</PaketExePath>
|
14
|
+
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' ">$(PaketToolsPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
|
15
|
+
<PaketCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketExePath)"</PaketCommand>
|
16
|
+
<PaketCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(PaketExePath)</PaketCommand>
|
17
|
+
<PaketBootStrapperCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
|
18
|
+
<PaketBootStrapperCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(PaketBootStrapperExePath)</PaketBootStrapperCommand>
|
19
|
+
<!-- Commands -->
|
20
|
+
<RestoreCommand>$(PaketCommand) restore</RestoreCommand>
|
21
|
+
<DownloadPaketCommand>$(PaketBootStrapperCommand)</DownloadPaketCommand>
|
22
|
+
<!-- We need to ensure packages are restored prior to assembly resolve -->
|
23
|
+
<BuildDependsOn Condition="$(RestorePackages) == 'true'">RestorePackages; $(BuildDependsOn);</BuildDependsOn>
|
24
|
+
</PropertyGroup>
|
25
|
+
<Target Name="CheckPrerequisites">
|
26
|
+
<!-- Raise an error if we're unable to locate paket.exe -->
|
27
|
+
<Error Condition="'$(DownloadPaket)' != 'true' AND !Exists('$(PaketExePath)')" Text="Unable to locate '$(PaketExePath)'" />
|
28
|
+
<MsBuild Targets="DownloadPaket" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadPaket=$(DownloadPaket)" />
|
29
|
+
</Target>
|
30
|
+
<Target Name="DownloadPaket">
|
31
|
+
<Exec Command="$(DownloadPaketCommand)" Condition=" '$(DownloadPaket)' == 'true' AND !Exists('$(PaketExePath)')" />
|
32
|
+
</Target>
|
33
|
+
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
|
34
|
+
<Exec Command="$(RestoreCommand)" WorkingDirectory="$(PaketRootPath)" />
|
35
|
+
</Target>
|
36
|
+
</Project>
|
Binary file
|
Binary file
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'pty'
|
2
|
+
|
3
|
+
module Wooget
|
4
|
+
module Util
|
5
|
+
def self.author
|
6
|
+
`git config user.name || getent passwd $(id -un) | cut -d : -f 5 | cut -d , -f 1`.chomp
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.is_a_wooget_package_dir path
|
10
|
+
contents = Dir[File.join(path, "*")]
|
11
|
+
contents.map! { |c| File.basename(c) }
|
12
|
+
|
13
|
+
contents.include?("paket.dependencies") and contents.include?("RELEASE_NOTES.md")
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.is_a_unity_project_dir path
|
17
|
+
contents = Dir[File.join(path, "*")]
|
18
|
+
contents.map! { |c| File.basename(c) }
|
19
|
+
contents.include?("Assets") and contents.include?("ProjectSettings")
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
#runs a command in a separate process and working dir, takes a block which is yielded on every line of stdout
|
24
|
+
#returns [[stdout], exit_status]
|
25
|
+
def self.run_cmd cmd, path=Dir.pwd
|
26
|
+
Wooget.log.debug "Running `#{cmd}` in path #{File.expand_path(path)}"
|
27
|
+
|
28
|
+
cmd_output = []
|
29
|
+
shutdown = -> {Wooget.log.error "Trying to shutdown child before pid recieved"}
|
30
|
+
begin
|
31
|
+
Signal.trap("INT") do
|
32
|
+
shutdown.call()
|
33
|
+
end
|
34
|
+
|
35
|
+
PTY.spawn("cd #{path} && #{cmd}") do |stdout, stdin, pid|
|
36
|
+
shutdown = -> {Process.kill(9, pid)}
|
37
|
+
|
38
|
+
begin
|
39
|
+
stdout.each do |line|
|
40
|
+
cmd_output << line.uncolorize
|
41
|
+
yield line if block_given?
|
42
|
+
end
|
43
|
+
rescue Errno::EIO
|
44
|
+
#This means the process has finished giving output
|
45
|
+
ensure
|
46
|
+
Process.wait(pid)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
rescue PTY::ChildExited => e
|
50
|
+
#Child process exited
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
exit_status = $?.exitstatus
|
56
|
+
[cmd_output, exit_status]
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.file_contains? filename, string
|
60
|
+
File.foreach(filename).grep(/#{Regexp.escape(string)}/).any?
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.valid_version_string? version
|
64
|
+
!version.match(/(\d+\.\d+\.\d+)-?(\w*)/).nil?
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
class String
|
71
|
+
REGEXP_PATTERN = /\033\[([0-9]+);([0-9]+);([0-9]+)m(.+?)\033\[0m|([^\033]+)/m
|
72
|
+
|
73
|
+
#get rid of goddamn ansi control codes
|
74
|
+
def uncolorize
|
75
|
+
result = self.scan(REGEXP_PATTERN).inject("") do |str, match|
|
76
|
+
str << (match[3] || match[4])
|
77
|
+
end
|
78
|
+
|
79
|
+
#more ansi control codes that the above doesn't pickup
|
80
|
+
result.gsub(/\[(?:[A-Z0-9]{1,2}[nmKM]?)|\[(?:\?.*[=<>])|(?:;\d+[nmKM]?)/, '')
|
81
|
+
end
|
82
|
+
|
83
|
+
#convert to snake case
|
84
|
+
def snake_case
|
85
|
+
self.gsub(/::/, '/').
|
86
|
+
gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
|
87
|
+
gsub(/([a-z\d])([A-Z])/, '\1_\2').
|
88
|
+
tr("-", "_").
|
89
|
+
downcase
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Wooget
|
2
|
+
class PackageListFormatter
|
3
|
+
def self.format_list package_hash, format, show_binary=false
|
4
|
+
|
5
|
+
package_hash.values.each {|list| Package.process_binary_packages(list)}
|
6
|
+
|
7
|
+
case format
|
8
|
+
when "shell", :shell
|
9
|
+
output = ""
|
10
|
+
package_hash.each do |repo, packages|
|
11
|
+
output << "### #{repo.upcase}\n"
|
12
|
+
packages.each do |package|
|
13
|
+
next if package.is_binary and not show_binary
|
14
|
+
|
15
|
+
output << " #{package.package_id} #{"(B)" if package.has_binary and not show_binary} - #{package.version} \n"
|
16
|
+
end
|
17
|
+
output << "\n"
|
18
|
+
end
|
19
|
+
output << "- (B) : binary variant available"
|
20
|
+
output
|
21
|
+
when "json", :json
|
22
|
+
|
23
|
+
unless show_binary
|
24
|
+
package_hash.each do |_,packages|
|
25
|
+
packages.delete_if {|p| p.is_binary}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
package_hash.to_json
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.format_package package_hash, format, package_id=false
|
33
|
+
package_hash.values.each {|list| Package.process_binary_packages(list)}
|
34
|
+
|
35
|
+
package = nil
|
36
|
+
package_hash.each do |_, packages|
|
37
|
+
package = packages.find {|p| p.package_id == package_id}
|
38
|
+
break if package
|
39
|
+
end
|
40
|
+
|
41
|
+
return "Package '#{package_id}' not found in repos - #{package_hash.keys.join(",")}" unless package
|
42
|
+
|
43
|
+
case format
|
44
|
+
when "shell", :shell
|
45
|
+
output = ""
|
46
|
+
output << "### #{package.package_id}\n"
|
47
|
+
%i(version authors created last_updated summary description project_url release_notes
|
48
|
+
is_latest_version url has_binary dependencies download_count tags).each do |prop|
|
49
|
+
output << "## #{prop.capitalize}\n"
|
50
|
+
output << " " +package.send(prop).to_s + "\n"
|
51
|
+
|
52
|
+
end
|
53
|
+
output
|
54
|
+
when "json", :json
|
55
|
+
package.to_json
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
Encoding.default_external = Encoding::UTF_8
|
3
|
+
Encoding.default_internal = Encoding::UTF_8
|
4
|
+
|
5
|
+
module Wooget
|
6
|
+
VERSION = "2.1.1".freeze
|
7
|
+
|
8
|
+
POST_INSTALL= '
|
9
|
+
_ _
|
10
|
+
__ _____ ___ __ _ ___| |_| |
|
11
|
+
\ \ /\ / / _ \ / _ \ / _` |/ _ \ __| |
|
12
|
+
\ V V / (_) | (_) | (_| | __/ |_|_|
|
13
|
+
\_/\_/ \___/ \___/ \__, |\___|\__(_)
|
14
|
+
|___/
|
15
|
+
|
16
|
+
' + "unity package manager cli version #{VERSION}!
|
17
|
+
|
18
|
+
"
|
19
|
+
|
20
|
+
|
21
|
+
end
|
22
|
+
|