ubb 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d33000db9895bb667d213bbbccb063746b79467f
4
- data.tar.gz: 859ae44cf28afc33df44f78b216cb300c292dbe3
3
+ metadata.gz: 4b6caf5ea8a6c97a58bd823fa5e27f0d511bc92e
4
+ data.tar.gz: 9ffc640e29c80060d4ad2398c0bbfa0f89c3f174
5
5
  SHA512:
6
- metadata.gz: 5b6f17837f3719d0d3c6d3959080531f8b7c1898e79467e59470de217891d45acd2906a034bfbc1ace1ec4fbd8357177e0343b60e4dc436949e40ceae560bcd5
7
- data.tar.gz: 878ccfce2035fc603587fc2b112e0dccefc5ba540e06022dbe98d9e404c1355039d9656e75e81a8e9062016bc2a0d48f79eae3910d3be3c780d7fbc9a0d77a98
6
+ metadata.gz: 6cbfce60a13faad0cc61a91871f125dd9c57380c900b4db31e9db01d5fa6b77a49a44071b80c87fd000217ac3ad184aa562e98cf3a91b205691dc81663ca0b69
7
+ data.tar.gz: 764d83fd0a60df9b8aba28fdd05f6d6ce601c4590943459723353406080411a29970c6679e1dc33b44de67e3432cde0170489b81f823e462e1c9dad8a3d7ae93
data/README.md CHANGED
@@ -12,19 +12,11 @@ Unity Editor からビルドしたりパッケージを入出力する時に使
12
12
 
13
13
  ## Installation
14
14
 
15
- Add this line to your application's Gemfile:
15
+ Install it yourself as:
16
16
 
17
- ```ruby
18
- gem 'ubb'
19
17
  ```
20
-
21
- And then execute:
22
-
23
- $ bundle
24
-
25
- Or install it yourself as:
26
-
27
- $ gem install ubb
18
+ $ gem install ubb
19
+ ```
28
20
 
29
21
  ## Usage
30
22
 
@@ -56,10 +48,16 @@ ubb import 'パッケージファイル名'
56
48
 
57
49
  ### build
58
50
 
59
- (開発中)
60
-
51
+ 指定したプロジェクトのビルドを行います。
61
52
 
53
+ ```
54
+ ubb build --output '出力先フォルダ' --target [ios] --config [development|release|distribution]
55
+ ```
62
56
 
57
+ * target
58
+ * ビルドターゲットの指定。現在は `ios` のみ。
59
+ * config
60
+ * ビルドコンフィグの指定。
63
61
 
64
62
 
65
63
 
data/bin/ubb CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  LIB_PATH = File.expand_path("../../lib", __FILE__)
3
3
  $:.unshift LIB_PATH
4
-
5
4
  #require 'rubygems'
6
5
  require 'commander/import'
7
6
  require 'ubb'
@@ -10,13 +9,6 @@ require 'fileutils'
10
9
  require 'erb'
11
10
 
12
11
  $unity_app_path = "/Applications/Unity/Unity.app/Contents/MacOS/Unity"
13
- dirs = Dir.glob("**/Assets")
14
- dirs.each do |d|
15
- d = d.sub(/(\/)?Assets$/, '')
16
- if Dir.exist?("#{d}/ProjectSettings")
17
- $project_path = File.expand_path(d)
18
- end
19
- end
20
12
 
21
13
  program :version, Ubb::VERSION
22
14
  program :description, 'Unity Batch Build helper'
@@ -5,16 +5,17 @@ using System.IO;
5
5
  using UnityEditor;
6
6
 
7
7
  public class Build {
8
- enum Target {
8
+ enum Config {
9
9
  Unknown,
10
10
  Development,
11
11
  Release,
12
- Final,
12
+ Distribution,
13
13
  }
14
14
  private static string _bakDefines;
15
15
  private static string _buildPath = "<%= output %>";
16
16
  // Android
17
- static void PerformBuild() {
17
+ public static void PerformBuild_android() {
18
+ BuildTargetGroup group = BuildTargetGroup.Android;
18
19
  Debug.Log("build start");
19
20
  string[] scenes = GetAllScenes();
20
21
  //update_symbols();
@@ -29,29 +30,29 @@ public class Build {
29
30
  }
30
31
  }
31
32
  // iOS
32
- public static void PerformiOSBuild() {
33
+ public static void PerformBuild_ios() {
33
34
  BuildTargetGroup group = BuildTargetGroup.iOS;
34
35
  Debug.Log("build start");
35
36
  string[] scenes = GetAllScenes();
36
37
  BuildOptions opt = BuildOptions.SymlinkLibraries;
37
- Target tgt = (UnityEditorInternal.InternalEditorUtility.inBatchMode) ? get_target() : Target.Development;
38
- if (tgt == Target.Unknown) {
38
+ Config tgt = (UnityEditorInternal.InternalEditorUtility.inBatchMode) ? get_config() : Config.Development;
39
+ if (tgt == Config.Unknown) {
39
40
  Debug.LogError("TARGET UNKNOWN");
40
41
  EditorApplication.Exit(1);
41
42
  }
42
43
  switch (tgt) {
43
- case Target.Development:
44
+ case Config.Development:
44
45
  opt |= BuildOptions.Development;
45
46
  PlayerSettings.strippingLevel = StrippingLevel.Disabled;
46
47
  PlayerSettings.iOS.scriptCallOptimization = ScriptCallOptimizationLevel.SlowAndSafe;
47
48
  break;
48
- case Target.Release:
49
+ case Config.Release:
49
50
  //opt |= BuildOptions.Development;
50
51
  //PlayerSettings.strippingLevel = StrippingLevel.StripByteCode; // リフレクション使ってる箇所で死ぬ
51
52
  PlayerSettings.strippingLevel = StrippingLevel.Disabled;
52
53
  PlayerSettings.iOS.scriptCallOptimization = ScriptCallOptimizationLevel.FastButNoExceptions;
53
54
  break;
54
- case Target.Final:
55
+ case Config.Distribution:
55
56
  //PlayerSettings.strippingLevel = StrippingLevel.StripByteCode;
56
57
  PlayerSettings.strippingLevel = StrippingLevel.Disabled;
57
58
  PlayerSettings.iOS.scriptCallOptimization = ScriptCallOptimizationLevel.FastButNoExceptions;
@@ -60,8 +61,7 @@ public class Build {
60
61
  push_symbols(group);
61
62
  //
62
63
  update_symbols(group);
63
- BuildTarget buildTarget = BuildTarget.iOS;
64
- string error = BuildPipeline.BuildPlayer(scenes, _buildPath, buildTarget, opt);
64
+ string error = BuildPipeline.BuildPlayer(scenes, _buildPath, BuildTarget.iOS, opt);
65
65
  //
66
66
  pop_symbols(group);
67
67
  //
@@ -109,13 +109,13 @@ public class Build {
109
109
  Debug.Log(string.Format("NEW: {0}", defines));
110
110
  PlayerSettings.SetScriptingDefineSymbolsForGroup(group, defines);
111
111
  }
112
- private static Target get_target() {
113
- List<string> tgts = get_argv("-target");
112
+ private static Config get_config() {
113
+ List<string> tgts = get_argv("-config");
114
114
  foreach (string t in tgts) {
115
- if (t == "DEV") return Target.Development;
116
- if (t == "REL") return Target.Release;
117
- if (t == "FNL") return Target.Final;
115
+ if (t == "development") return Config.Development;
116
+ if (t == "release") return Config.Release;
117
+ if (t == "distribution") return Config.Distribution;
118
118
  }
119
- return Target.Unknown;
119
+ return Config.Unknown;
120
120
  }
121
121
  }
data/lib/ubb.rb CHANGED
@@ -15,6 +15,28 @@ module Ubb
15
15
  def self.has_editor?
16
16
  Dir.exist?(self.editor_path)
17
17
  end
18
+ def self.find_project
19
+ return unless $project_path.nil?
20
+ dirs = Dir.glob("**/Assets")
21
+ dirs.each do |d|
22
+ d = d.sub(/(\/)?Assets$/, '')
23
+ if Dir.exist?("#{d}/ProjectSettings")
24
+ $project_path = File.expand_path(d)
25
+ end
26
+ end
27
+ end
28
+ def self.check_target(target)
29
+ cand = [ 'ios', 'android' ]
30
+ cand.select! { |c| c =~ /^#{target}/i }
31
+ return cand[0] if cand.size == 1
32
+ return nil
33
+ end
34
+ def self.check_config(config)
35
+ cand = [ 'development', 'release', 'distribution' ]
36
+ cand.select! { |c| c =~ /^#{config}/i }
37
+ return cand[0] if cand.size == 1
38
+ return nil
39
+ end
18
40
  end
19
41
 
20
42
  command :showlog do |c|
@@ -28,6 +50,7 @@ end
28
50
  alias_command :log, :showlog
29
51
 
30
52
  command :export do |c|
53
+ Ubb.find_project
31
54
  c.syntax = 'ubb export [options]'
32
55
  c.summary = 'export .unitypackage'
33
56
  c.description = 'hoge'
@@ -43,6 +66,7 @@ command :export do |c|
43
66
  end
44
67
 
45
68
  command :import do |c|
69
+ Ubb.find_project
46
70
  c.syntax = 'ubb import [package]'
47
71
  c.summary = 'import .unitypackage'
48
72
  c.description = 'hoge'
@@ -57,28 +81,46 @@ command :import do |c|
57
81
  end
58
82
 
59
83
  command :build do |c|
84
+ Ubb.find_project
85
+ c.syntax = 'ubb build [options]'
86
+ c.summary = 'build project'
87
+ c.description = 'hoge'
88
+ c.example 'build project', 'ubb build --project path/to/unityproject --output path/to/outputproject'
60
89
  c.option '--output PATH', String, 'specify output path'
90
+ c.option '--target TARGET', String, 'specify build target (ios|android)'
91
+ c.option '--config COFIGURATION', String, 'specify build configuration (development|release|distribution)'
61
92
  c.action do |args, options|
93
+ options.default :config => 'development'
62
94
  raise 'specify output path' if options.output.nil?
95
+ raise 'specify target' if options.target.nil?
96
+ output = File.expand_path(options.output)
97
+ target = Ubb.check_target(options.target)
98
+ config = Ubb.check_config(options.config)
99
+ raise "could not recognize a target: \"#{options.target}\"" if target.nil?
63
100
  begin
64
- output = File.expand_path(options.output)
65
101
  has = Ubb.has_editor?
66
102
  editor_path = Ubb.editor_path
67
- FileUtils.mkdir_p editor_path unless has
68
103
  src = "#{LIB_PATH}/assets/UbbBuild.cs"
69
104
  dst = "#{editor_path}/UbbBuild.cs"
70
- raise 'build script has already existed' if File.exist?(dst)
105
+ FileUtils.mkdir_p editor_path unless has
106
+ noop = false
107
+ if File.exist?(dst)
108
+ noop = true
109
+ raise 'build script has already existed'
110
+ end
71
111
  cs = File.read(src)
72
112
  csfile = File.open(dst, "w+")
73
113
  csfile.write(ERB.new(cs).result binding)
74
114
  csfile.flush
75
- Ubb.sh "#{$unity_app_path} -batchmode -projectPath #{$project_path} -quit -executeMethod Build.PerformiOSBuild -target DEV"
115
+ Ubb.sh "#{$unity_app_path} -batchmode -projectPath #{$project_path} -quit -executeMethod Build.PerformBuild_#{target} -config #{config}"
76
116
  ensure
77
- FileUtils.rm_f "#{editor_path}/UbbBuild.cs"
78
- FileUtils.rm_f "#{editor_path}/UbbBuild.cs.meta"
79
- unless has
80
- FileUtils.rm_rf editor_path
81
- FileUtils.rm_f "#{editor_path}.meta"
117
+ unless noop
118
+ FileUtils.rm_f "#{editor_path}/UbbBuild.cs"
119
+ FileUtils.rm_f "#{editor_path}/UbbBuild.cs.meta"
120
+ unless has
121
+ FileUtils.rm_rf editor_path
122
+ FileUtils.rm_f "#{editor_path}.meta"
123
+ end
82
124
  end
83
125
  end
84
126
  end
@@ -1,3 +1,3 @@
1
1
  module Ubb
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -8,18 +8,18 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Ubb::VERSION
9
9
  spec.authors = ["fum1h1ro"]
10
10
  spec.email = ["fumihiro@gmail.com"]
11
- spec.summary = %q{Unity Batch Build Helper}
12
- spec.description = %q{Helping batch build from Unity Editor}
13
- spec.homepage = ""
11
+ spec.summary = %q{Ubb}
12
+ spec.description = %q{CLI for helping batch building from Unity Editor}
13
+ spec.homepage = "https://github.com/fum1h1ro/ubb"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib", "bin"]
19
+ spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.7"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
23
  spec.add_development_dependency "rspec"
24
- spec.add_development_dependency "commander", "~> 4.3"
24
+ spec.add_dependency "commander", "~> 4.3"
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ubb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - fum1h1ro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-07 00:00:00.000000000 Z
11
+ date: 2015-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -59,14 +59,14 @@ dependencies:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '4.3'
62
- type: :development
62
+ type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '4.3'
69
- description: Helping batch build from Unity Editor
69
+ description: CLI for helping batch building from Unity Editor
70
70
  email:
71
71
  - fumihiro@gmail.com
72
72
  executables:
@@ -75,8 +75,6 @@ extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
77
  - ".gitignore"
78
- - ".rspec"
79
- - ".travis.yml"
80
78
  - Gemfile
81
79
  - LICENSE.txt
82
80
  - README.md
@@ -88,7 +86,7 @@ files:
88
86
  - spec/spec_helper.rb
89
87
  - spec/ubb_spec.rb
90
88
  - ubb.gemspec
91
- homepage: ''
89
+ homepage: https://github.com/fum1h1ro/ubb
92
90
  licenses:
93
91
  - MIT
94
92
  metadata: {}
@@ -96,7 +94,6 @@ post_install_message:
96
94
  rdoc_options: []
97
95
  require_paths:
98
96
  - lib
99
- - bin
100
97
  required_ruby_version: !ruby/object:Gem::Requirement
101
98
  requirements:
102
99
  - - ">="
@@ -112,7 +109,7 @@ rubyforge_project:
112
109
  rubygems_version: 2.4.5
113
110
  signing_key:
114
111
  specification_version: 4
115
- summary: Unity Batch Build Helper
112
+ summary: Ubb
116
113
  test_files:
117
114
  - spec/spec_helper.rb
118
115
  - spec/ubb_spec.rb
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color
@@ -1,3 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.0.0