wooga_wooget 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/.travis.yml +20 -0
  4. data/Gemfile +3 -0
  5. data/Licence.md +21 -0
  6. data/README.md +48 -0
  7. data/Rakefile +80 -0
  8. data/bin/wooget +5 -0
  9. data/lib/wooget.rb +57 -0
  10. data/lib/wooget/build/build_info.rb +64 -0
  11. data/lib/wooget/build/builder.rb +285 -0
  12. data/lib/wooget/cli.rb +293 -0
  13. data/lib/wooget/nuget.rb +96 -0
  14. data/lib/wooget/paket.rb +81 -0
  15. data/lib/wooget/project.rb +42 -0
  16. data/lib/wooget/releasing.rb +112 -0
  17. data/lib/wooget/template/files/README.md.erb +20 -0
  18. data/lib/wooget/template/files/RELEASE_NOTES.md.erb +2 -0
  19. data/lib/wooget/template/files/assemblyinfo.erb +36 -0
  20. data/lib/wooget/template/files/class.erb +15 -0
  21. data/lib/wooget/template/files/csproj.erb +56 -0
  22. data/lib/wooget/template/files/gitignore.erb +13 -0
  23. data/lib/wooget/template/files/metafile.cs.erb +11 -0
  24. data/lib/wooget/template/files/paket.binary.template.erb +17 -0
  25. data/lib/wooget/template/files/paket.dependencies.erb +13 -0
  26. data/lib/wooget/template/files/paket.references.erb +2 -0
  27. data/lib/wooget/template/files/paket.template.erb +22 -0
  28. data/lib/wooget/template/files/sln.erb +32 -0
  29. data/lib/wooget/template/files/test_file.erb +19 -0
  30. data/lib/wooget/template/files/tests_assemblyinfo.erb +36 -0
  31. data/lib/wooget/template/files/tests_csproj.erb +67 -0
  32. data/lib/wooget/template/files/unity_paket.dependencies.erb +12 -0
  33. data/lib/wooget/template/unity.rb +73 -0
  34. data/lib/wooget/template/visual_studio.rb +56 -0
  35. data/lib/wooget/template/wooget_conf.json +13 -0
  36. data/lib/wooget/third_party/paket.bootstrapper.exe +0 -0
  37. data/lib/wooget/third_party/paket.exe +0 -0
  38. data/lib/wooget/third_party/paket.targets +36 -0
  39. data/lib/wooget/third_party/paket.unity3d.bootstrapper.exe +0 -0
  40. data/lib/wooget/third_party/paket.unity3d.exe +0 -0
  41. data/lib/wooget/util/build_error.rb +8 -0
  42. data/lib/wooget/util/misc.rb +91 -0
  43. data/lib/wooget/util/package_list_formatter.rb +59 -0
  44. data/lib/wooget/version.rb +22 -0
  45. data/tests/nuget_feed.xml +3439 -0
  46. data/tests/nuget_package.xml +49 -0
  47. data/tests/nuget_test.rb +27 -0
  48. data/tests/package_test.rb +72 -0
  49. data/tests/unity_test.rb +12 -0
  50. data/wiki/bootstrap.png +0 -0
  51. data/wiki/compiling.png +0 -0
  52. data/wiki/create.png +0 -0
  53. data/wiki/install.png +0 -0
  54. data/wiki/list.png +0 -0
  55. data/wiki/monodevelop.png +0 -0
  56. data/wiki/release.png +0 -0
  57. data/wiki/stupidmenu.png +0 -0
  58. data/wooget.gemspec +33 -0
  59. metadata +244 -0
@@ -0,0 +1,42 @@
1
+ require 'fileutils'
2
+
3
+ module Wooget
4
+ #
5
+ #Essential project files for packaging
6
+ #
7
+ class Project < Thor
8
+ attr_reader :options
9
+ include Thor::Actions
10
+ add_runtime_options!
11
+
12
+ def self.source_root
13
+ File.join(File.dirname(__FILE__), "template", "files")
14
+ end
15
+
16
+ desc "create package_name", "create a package with the provided id / name"
17
+ def create package_name, options={}
18
+ @options = {}.merge(options)
19
+ @options[:author] ||= Util.author
20
+ @options[:repo] ||= "wdk-unity-universe"
21
+ @options[:source_folder] = package_name
22
+
23
+ empty_directory package_name
24
+ create_file File.join(package_name, "paket.lock")
25
+ template("gitignore.erb", File.join(package_name, ".gitignore"))
26
+ template("paket.template.erb", File.join(package_name, "paket.template"))
27
+ template("paket.dependencies.erb", File.join(package_name, "paket.dependencies"))
28
+ template("RELEASE_NOTES.md.erb", File.join(package_name, "RELEASE_NOTES.md"))
29
+ template("README.md.erb", File.join(package_name, "README.md"))
30
+ template("metafile.cs.erb", File.join(package_name,"src", package_name, package_name + "_meta.cs"))
31
+
32
+ if options[:visual_studio]
33
+ temp = Wooget::Templates::VisualStudio.new()
34
+ destination = File.expand_path("./#{package_name}")
35
+
36
+ vs_options = {:destination => destination, :name => package_name, :src =>{}, :quiet =>@options[:quiet]}
37
+ vs_options[:tests] = {} if options[:tests]
38
+ temp.create_project(vs_options)
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,112 @@
1
+ require 'fileutils'
2
+ require 'shellwords'
3
+
4
+ module Wooget
5
+ class Packager < Thor
6
+
7
+ class_option :path, desc: "Base path of the package we are working on", default: Dir.pwd
8
+ class_option :output_dir, desc: "Destination for artifacts", default: File.join(Dir.pwd, "bin")
9
+
10
+ option :templates, desc: "Template files you want to build", type: :array, required: true
11
+ option :version, desc: "Version to set packages to", type: :string, required: true
12
+ option :release_notes, desc: "Release notes for packages", type: :string, required: true
13
+ option :native, desc: "Invoke native build functionality", type: :boolean, default: true
14
+
15
+ desc "build", "build the package and create .nupkg files"
16
+
17
+ def build
18
+ clean
19
+
20
+ build_info = Build::BuildInfo.new options[:templates], options[:output_dir], options[:version], options[:release_notes], options[:path]
21
+ unless build_info.valid?
22
+ Wooget.log.error "Invalid build options - #{build_info.invalid_reason}"
23
+ return
24
+ end
25
+
26
+ builder = Build::Builder.new [], options
27
+ builder.perform_build build_info
28
+ end
29
+
30
+ option :push, desc: "push to remote repo", type: :boolean, default: true
31
+ option :confirm, desc: "ask for confirmation before pushing", type: :boolean, default: true
32
+ option :native, desc: "Invoke native build functionality", type: :boolean, default: true
33
+
34
+ desc "release", "set release deps, build + push"
35
+
36
+ def release
37
+ clean
38
+
39
+ build_info = get_build_info_from_template_files
40
+ unless build_info.valid?
41
+ Wooget.log.error "Invalid build options - #{build_info.invalid_reason}"
42
+ return
43
+ end
44
+
45
+
46
+ builder = Build::ReleaseBuilder.new [], options
47
+ builder.perform_build build_info
48
+ end
49
+
50
+ option :push, desc: "push to remote repo", type: :boolean, default: true
51
+ option :confirm, desc: "ask for confirmation before pushing", type: :boolean, default: true
52
+ option :native, desc: "Invoke native build functionality", type: :boolean, default: true
53
+ desc "prerelease", "set prerelease deps, build + push"
54
+
55
+ def prerelease
56
+ clean
57
+
58
+ build_info = get_build_info_from_template_files
59
+ unless build_info.valid?
60
+ Wooget.log.error "Invalid build options - #{build_info.invalid_reason}"
61
+ return
62
+ end
63
+
64
+
65
+ builder = Build::PrereleaseBuilder.new [], options
66
+ builder.perform_build build_info
67
+ end
68
+
69
+ private
70
+
71
+ def clean
72
+ if Dir.exists? File.join(options[:path], "bin")
73
+ Wooget.log.debug "Cleaning bin dir"
74
+ FileUtils.rmtree File.join(options[:path], "bin")
75
+ end
76
+
77
+ Dir.mkdir(options[:output_dir]) unless Dir.exists? options[:output_dir]
78
+ end
79
+
80
+
81
+ def get_build_info_from_template_files
82
+
83
+ version, prerelease = get_version_from_release_notes
84
+ version = version+"-"+prerelease unless prerelease.empty?
85
+ templates = Dir.glob(File.join(options[:path], "/**/*paket.template"))
86
+
87
+ #make template paths relative to project root
88
+ base = Pathname.new options[:path]
89
+ templates.map! { |t| absolute_template_path = Pathname.new(t); absolute_template_path.relative_path_from(base).to_s }
90
+
91
+ Build::BuildInfo.new templates, options[:output_dir], version, get_latest_release_notes, options[:path]
92
+ end
93
+
94
+ def get_version_from_release_notes
95
+ regex = /#*\s*(\d+\.\d+\.\d+)-?(\w*)/
96
+ notes = File.open(File.join(options[:path], "RELEASE_NOTES.md")).read
97
+ notes.scan(regex).first
98
+ end
99
+
100
+ def get_latest_release_notes
101
+ notes = []
102
+ File.open(File.join(options[:path], "RELEASE_NOTES.md")).each do |line|
103
+ break if line.strip.empty? and notes.length > 0
104
+
105
+ #include the line unless it's a version title
106
+ notes << line unless line.match /^#/
107
+ end
108
+
109
+ notes.join
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,20 @@
1
+
2
+ ## <%= options[:name] %>
3
+
4
+ ### Summary
5
+
6
+ A cool package summary
7
+
8
+ ### Description
9
+
10
+ A cool package description
11
+
12
+ ### Usage
13
+
14
+ ```csharp
15
+ var coolness = Cool.Package("yeah");
16
+ coolness.Execute();
17
+
18
+ ```
19
+
20
+ *author: <%= options[:author] %>*
@@ -0,0 +1,2 @@
1
+ ### 0.0.0 - <%= Time.now.strftime("%d %B %Y") %>
2
+ * initial release
@@ -0,0 +1,36 @@
1
+ using System.Reflection;
2
+ using System.Runtime.CompilerServices;
3
+ using System.Runtime.InteropServices;
4
+
5
+ // General Information about an assembly is controlled through the following
6
+ // set of attributes. Change these attribute values to modify the information
7
+ // associated with an assembly.
8
+ [assembly: AssemblyTitle("<%= options[:name] %>")]
9
+ [assembly: AssemblyDescription("")]
10
+ [assembly: AssemblyConfiguration("")]
11
+ [assembly: AssemblyCompany("")]
12
+ [assembly: AssemblyProduct("<%= options[:name] %>")]
13
+ [assembly: AssemblyCopyright("Copyright Wooga © 2016")]
14
+ [assembly: AssemblyTrademark("")]
15
+ [assembly: AssemblyCulture("")]
16
+
17
+ // Setting ComVisible to false makes the types in this assembly not visible
18
+ // to COM components. If you need to access a type in this assembly from
19
+ // COM, set the ComVisible attribute to true on that type.
20
+ [assembly: ComVisible(false)]
21
+
22
+ // The following GUID is for the ID of the typelib if this project is exposed to COM
23
+ [assembly: Guid("<%= options[:src][:guid] %>")]
24
+
25
+ // Version information for an assembly consists of the following four values:
26
+ //
27
+ // Major Version
28
+ // Minor Version
29
+ // Build Number
30
+ // Revision
31
+ //
32
+ // You can specify all the values or you can default the Build and Revision Numbers
33
+ // by using the '*' as shown below:
34
+ // [assembly: AssemblyVersion("1.0.*")]
35
+ [assembly: AssemblyVersion("1.0.0.0")]
36
+ [assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,15 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.Linq;
4
+ using System.Text;
5
+
6
+ namespace <%= options[:name] %>
7
+ {
8
+ public class DummyClass
9
+ {
10
+ public static bool TheFunction()
11
+ {
12
+ return true;
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,56 @@
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[:src][:guid] %>}</ProjectGuid>
8
+ <OutputType>Library</OutputType>
9
+ <AppDesignerFolder>Properties</AppDesignerFolder>
10
+ <RootNamespace><%= options[:name].split(".").first %></RootNamespace>
11
+ <AssemblyName><%= options[:name] %></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[:src][:files] %>
43
+ <% options[:src][:files].each do |file|%>
44
+ <%= %(<Compile Include="#{file}"/>) %>
45
+ <% end %>
46
+ <% end -%>
47
+ </ItemGroup>
48
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
49
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
50
+ Other similar extension points exist, see Microsoft.Common.targets.
51
+ <Target Name="BeforeBuild">
52
+ </Target>
53
+ <Target Name="AfterBuild">
54
+ </Target>
55
+ -->
56
+ </Project>
@@ -0,0 +1,13 @@
1
+ bin/
2
+ obj/
3
+ .vs/
4
+ Debug/
5
+ packages
6
+ paket-files
7
+ .DS_Store
8
+ build/
9
+ *.csproj.user
10
+ TestResult.xml
11
+ project/
12
+ *_meta.cs
13
+ .DS_Store
@@ -0,0 +1,11 @@
1
+ //This file is generated on release
2
+ //The Wooga.SDK.Meta namespace is inspected by the tracking sdk at startup to detect which libs are in use
3
+
4
+ namespace Wooga.SDK.Meta
5
+ {
6
+ static public class <%= options[:source_folder].gsub(".","_") %>
7
+ {
8
+ public static readonly string name = "<%= options[:source_folder] %>";
9
+ public static readonly string version = "0.0.0";
10
+ }
11
+ }
@@ -0,0 +1,17 @@
1
+ type project
2
+ id <%= options[:name].start_with?("Wooga.") ? options[:name] : "Wooga.#{options[:name]}"%>.Binary
3
+ owners Wooga
4
+ authors Wooga
5
+ projectUrl
6
+ todo: add url
7
+ requireLicenseAcceptance
8
+ false
9
+ copyright
10
+ Copyright <%= Time.now.year %>
11
+ tags
12
+ wdk, unity, wooget, binary
13
+ summary
14
+ Compiled version of <%= options[:name].start_with?("Wooga.") ? options[:name] : "Wooga.#{options[:name]}"%>
15
+ description
16
+ Binary version of <%= options[:name].start_with?("Wooga.") ? options[:name] : "Wooga.#{options[:name]}"%> - to be used mainly for development dependencies.
17
+
@@ -0,0 +1,13 @@
1
+ //public nuget repo
2
+ source https://nuget.org/api/v2
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
+ nuget NUnit ~> 2
12
+ nuget NUnit.Runners ~> 2
13
+ nuget Wooga.Unity.DLLs
@@ -0,0 +1,2 @@
1
+ NUnit
2
+ NUnit.Runners
@@ -0,0 +1,22 @@
1
+ type file
2
+ id <%= options[:source_folder].start_with?("Wooga.") ? options[:source_folder] : "Wooga.#{options[:source_folder]}"%>
3
+ owners Wooga
4
+ authors <%= options[:author] %>
5
+ projectUrl
6
+ https://github.com/wooga/<%= options[:repo] %>
7
+ requireLicenseAcceptance
8
+ false
9
+ copyright
10
+ Copyright <%= Time.now.year %>
11
+ tags
12
+ wdk, unity3d, wooget
13
+ summary
14
+ TODO: fill in summary
15
+ description
16
+ TODO: fill in description
17
+ files
18
+ ../<%=options[:source_folder]%>/src/<%=options[:source_folder]%>/**/*.cs ==> content/<%= options[:source_folder] %>
19
+ ../<%=options[:source_folder]%>/resources/**/*.cs ==> content/<%= options[:source_folder] %>
20
+ !../<%=options[:source_folder]%>/bin
21
+ !../<%=options[:source_folder]%>/tests/**/*.cs
22
+ !../**/AssemblyInfo.cs
@@ -0,0 +1,32 @@
1
+ Microsoft Visual Studio Solution File, Format Version 12.00
2
+ # Visual Studio 14
3
+ VisualStudioVersion = 14.0.24720.0
4
+ MinimumVisualStudioVersion = 10.0.40219.1
5
+ Project("{<%= options[:guid]%>}") = "<%= options[:src][:name]%>", "<%= options[:src][:name]%>\<%= options[:src][:name]%>.csproj", "{<%= options[:src][:guid]%>}"
6
+ EndProject
7
+ <% if options[:tests] -%>
8
+ Project("{<%= options[:guid]%>}") = "<%= options[:tests][:name]%>.Tests", "..\tests\<%= options[:tests][:name]%>.Tests.csproj", "{<%= options[:tests][:guid]%>}"
9
+ EndProjectTests\<%= options[:tests][:name]%>Tests.csproj", "{<%= options[:tests][:guid]%>}"
10
+ EndProject
11
+ <% end -%>
12
+ Global
13
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
14
+ Debug|Any CPU = Debug|Any CPU
15
+ Release|Any CPU = Release|Any CPU
16
+ EndGlobalSection
17
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
18
+ {<%= options[:src][:guid]%>}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19
+ {<%= options[:src][:guid]%>}.Debug|Any CPU.Build.0 = Debug|Any CPU
20
+ {<%= options[:src][:guid]%>}.Release|Any CPU.ActiveCfg = Release|Any CPU
21
+ {<%= options[:src][:guid]%>}.Release|Any CPU.Build.0 = Release|Any CPU
22
+ <% if options[:tests] -%>
23
+ {<%= options[:tests][:guid]%>}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24
+ {<%= options[:tests][:guid]%>}.Debug|Any CPU.Build.0 = Debug|Any CPU
25
+ {<%= options[:tests][:guid]%>}.Release|Any CPU.ActiveCfg = Release|Any CPU
26
+ {<%= options[:tests][:guid]%>}.Release|Any CPU.Build.0 = Release|Any CPU
27
+ <% end -%>
28
+ EndGlobalSection
29
+ GlobalSection(SolutionProperties) = preSolution
30
+ HideSolutionNode = FALSE
31
+ EndGlobalSection
32
+ EndGlobal
@@ -0,0 +1,19 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.Linq;
4
+ using System.Text;
5
+ using <%= options[:name] %>;
6
+ using NUnit.Framework;
7
+
8
+ namespace ClassLibraryTests
9
+ {
10
+ [TestFixture]
11
+ public class TestsThatShouldBeDeleted
12
+ {
13
+ [Test]
14
+ public void TheTest()
15
+ {
16
+ Assert.True(DummyClass.TheFunction(), "The function should return true");
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,36 @@
1
+ using System.Reflection;
2
+ using System.Runtime.CompilerServices;
3
+ using System.Runtime.InteropServices;
4
+
5
+ // General Information about an assembly is controlled through the following
6
+ // set of attributes. Change these attribute values to modify the information
7
+ // associated with an assembly.
8
+ [assembly: AssemblyTitle("<%= options[:name] %>.Tests")]
9
+ [assembly: AssemblyDescription("")]
10
+ [assembly: AssemblyConfiguration("")]
11
+ [assembly: AssemblyCompany("")]
12
+ [assembly: AssemblyProduct("<%= options[:name] %>.Tests")]
13
+ [assembly: AssemblyCopyright("Copyright Wooga © 2016")]
14
+ [assembly: AssemblyTrademark("")]
15
+ [assembly: AssemblyCulture("")]
16
+
17
+ // Setting ComVisible to false makes the types in this assembly not visible
18
+ // to COM components. If you need to access a type in this assembly from
19
+ // COM, set the ComVisible attribute to true on that type.
20
+ [assembly: ComVisible(false)]
21
+
22
+ // The following GUID is for the ID of the typelib if this project is exposed to COM
23
+ [assembly: Guid("<%= options[:tests][:guid] %>")]
24
+
25
+ // Version information for an assembly consists of the following four values:
26
+ //
27
+ // Major Version
28
+ // Minor Version
29
+ // Build Number
30
+ // Revision
31
+ //
32
+ // You can specify all the values or you can default the Build and Revision Numbers
33
+ // by using the '*' as shown below:
34
+ // [assembly: AssemblyVersion("1.0.*")]
35
+ [assembly: AssemblyVersion("1.0.0.0")]
36
+ [assembly: AssemblyFileVersion("1.0.0.0")]