u3d 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0be22743b701cf41ec7c0ec7502b3e83e398dfa3
4
- data.tar.gz: 50cf04086a670bee0dd8712c9aa0a674bde8cb37
2
+ SHA256:
3
+ metadata.gz: 0c128eb99e14bacffa362e52f40d1a2c4630f35d669165fddb9f6ab1a3f1879a
4
+ data.tar.gz: ae99d106583181bcd9e9809a9c03a16ba28a439bce5d897db5d667ec654e37f3
5
5
  SHA512:
6
- metadata.gz: 579f873a2b755f118ee77795615e407c97757fcc49118137e1dc42bdfea366d3997cf03bf35c057d764df949286d3fb88bdab3a401d6f0fd57f4d8b31325aeae
7
- data.tar.gz: 883df9835b2b0a77c13c124848d936658f558bda6927510f7ab3ca60865e381b7704f4cc1a99a28126be35d03780322ca712c40b463d54851eea545d75aba345
6
+ metadata.gz: a3dd9e7300532f9551b40367d9c20e16ff6e9c12fc2ef548beb09f3794033b3b15f85f7c6e47c3ad4f7bb9824e1084d9dbb6ad00084332d1cbd035a3949222bb
7
+ data.tar.gz: 3c7bd315433353642fde4c2a4d42850d6c4e00ee4bd6ffd57009cca741c7cf49a8818dfd946845340c8a626b02e7e8ad043359b86f5c48b333b60f81ea3c2c24
@@ -1,4 +1,4 @@
1
- future-release=v1.1.3
1
+ future-release=v1.1.4
2
2
  since-tag=v0.9
3
3
  exclude_tags_regex=v0\.[0-8]\..*
4
4
  exclude-labels=nochangelog,question
@@ -1,5 +1,26 @@
1
1
  # Change Log
2
2
 
3
+ ## [v1.1.4](https://github.com/DragonBox/u3d/tree/v1.1.4) (2019-02-23)
4
+ [Full Changelog](https://github.com/DragonBox/u3d/compare/v1.1.3...v1.1.4)
5
+
6
+ **Implemented enhancements:**
7
+
8
+ - u3d/asset: add feature that enables easy inspection of asset in a Unity project [\#341](https://github.com/DragonBox/u3d/pull/341) ([niezbop](https://github.com/niezbop))
9
+
10
+ **Closed issues:**
11
+
12
+ - u3d returns code=0 if failed [\#343](https://github.com/DragonBox/u3d/issues/343)
13
+ - `user\_error!': package 'Mac' doesn't exist [\#340](https://github.com/DragonBox/u3d/issues/340)
14
+ - list fails when version does not follow standard format, e.g. MagicLeap versions [\#331](https://github.com/DragonBox/u3d/issues/331)
15
+ - Bug: Failed to install pkg file [\#310](https://github.com/DragonBox/u3d/issues/310)
16
+
17
+ **Merged pull requests:**
18
+
19
+ - u3d/list: support Magic Leap Versions parsing and sorting \(fixes \#331\) [\#346](https://github.com/DragonBox/u3d/pull/346) ([lacostej](https://github.com/lacostej))
20
+ - Update to latest hub to label PRs and remove the hardcoding of the user's repo [\#345](https://github.com/DragonBox/u3d/pull/345) ([lacostej](https://github.com/lacostej))
21
+ - u3d/install exit 1 when version not found. Fixes \#343 [\#344](https://github.com/DragonBox/u3d/pull/344) ([lacostej](https://github.com/lacostej))
22
+ - Add `-t\*` flag for 7z when unpacking packages [\#342](https://github.com/DragonBox/u3d/pull/342) ([rawstacktech](https://github.com/rawstacktech))
23
+
3
24
  ## [v1.1.3](https://github.com/DragonBox/u3d/tree/v1.1.3) (2019-01-08)
4
25
  [Full Changelog](https://github.com/DragonBox/u3d/compare/v1.1.2...v1.1.3)
5
26
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- u3d (1.1.3)
4
+ u3d (1.1.4)
5
5
  colored (>= 1.2, < 2.0.0)
6
6
  commander (>= 4.4.0, < 5.0.0)
7
7
  file-tail (>= 1.2.0)
@@ -25,8 +25,8 @@ GEM
25
25
  byebug (10.0.2)
26
26
  coderay (1.1.2)
27
27
  colored (1.2)
28
- commander (4.4.6)
29
- highline (~> 1.7.2)
28
+ commander (4.4.7)
29
+ highline (~> 2.0.0)
30
30
  concurrent-ruby (1.0.5)
31
31
  coveralls (0.8.21)
32
32
  json (>= 1.8, < 3)
@@ -51,7 +51,7 @@ GEM
51
51
  rainbow (>= 2.1)
52
52
  rake (>= 10.0)
53
53
  retriable (~> 2.1)
54
- highline (1.7.10)
54
+ highline (2.0.1)
55
55
  i18n (0.8.6)
56
56
  inifile (3.0.0)
57
57
  json (2.1.0)
@@ -134,4 +134,4 @@ DEPENDENCIES
134
134
  u3d!
135
135
 
136
136
  BUNDLED WITH
137
- 1.16.1
137
+ 1.17.1
data/Rakefile CHANGED
@@ -87,6 +87,32 @@ def run_command(command, error_message = nil)
87
87
  output
88
88
  end
89
89
 
90
+ ###
91
+ ### see https://github.com/github/hub/issues/2055
92
+ def ensure_hub!
93
+ require 'English'
94
+ `which hub`
95
+ raise "Missing hub command. This script requires the hub command. Get it from https://hub.github.com" unless $CHILD_STATUS.exitstatus.zero?
96
+ end
97
+
98
+ def hub_config
99
+ require 'YAML'
100
+ File.open(File.expand_path("~/.config/hub"), 'r:bom|utf-8') { |f| Psych.safe_load(f.read) }
101
+ end
102
+
103
+ def hub_user(server)
104
+ hub_config[server][0]['user']
105
+ end
106
+
107
+ def hub_fork_remote_name
108
+ server = 'github.com'
109
+
110
+ user = hub_user(server)
111
+
112
+ `git remote -v`.split("\n").map(&:split).select { |a| a[2] == '(push)' && a[1] =~ /#{server}.#{user}/ }.first[0]
113
+ end
114
+ ###
115
+
90
116
  task :ensure_git_clean do
91
117
  branch = run_command('git rev-parse --abbrev-ref HEAD', "Couldn't get current git branch").strip
92
118
  UI.user_error!("You are not on 'master' but on '#{branch}'") unless branch == "master"
@@ -126,9 +152,11 @@ task pre_release: 'ensure_git_clean' do
126
152
  msg = "Preparing release for #{nextversion}"
127
153
  sh 'git add CHANGELOG.md'
128
154
  sh "git commit -m '#{msg}'"
129
- sh "git push lacostej" # FIXME: hardcoded
130
- # FIXME: check hub present
131
- sh "hub pull-request -m '#{msg}'" # requires hub pre-release " -l nochangelog"
155
+
156
+ ensure_hub!
157
+ hub_remote = hub_fork_remote_name
158
+ sh "git push #{hub_remote}"
159
+ sh "hub pull-request -m '#{msg}' -l nochangelog"
132
160
  sh 'git checkout master'
133
161
  sh "git branch -D #{pr_branch}"
134
162
  end
data/lib/u3d.rb CHANGED
@@ -25,6 +25,7 @@ require 'u3d_core'
25
25
  require 'u3d/utils'
26
26
  require 'u3d/version'
27
27
 
28
+ require 'u3d/asset'
28
29
  require 'u3d/cache'
29
30
  require 'u3d/commands'
30
31
  require 'u3d/commands_generator'
@@ -0,0 +1,87 @@
1
+ ## --- BEGIN LICENSE BLOCK ---
2
+ # Copyright (c) 2016-present WeWantToKnow AS
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ # of this software and associated documentation files (the "Software"), to deal
6
+ # in the Software without restriction, including without limitation the rights
7
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ # copies of the Software, and to permit persons to whom the Software is
9
+ # furnished to do so, subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in all
12
+ # copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ # SOFTWARE.
21
+ ## --- END LICENSE BLOCK ---
22
+
23
+ require 'yaml'
24
+
25
+ module U3d
26
+ # U3d::Asset provides you with a way to easily manipulate an search for assets in Unity Projects
27
+ class Asset
28
+ class << self
29
+ def glob(pattern, unity_project_path = Dir.pwd)
30
+ unity_project = U3d::UnityProject.new(unity_project_path)
31
+ Dir.glob(pattern).reject { |path| File.extname(path) == '.meta' || !File.file?(path) }.map { |path| Asset.new(path, unity_project) }
32
+ end
33
+ end
34
+
35
+ attr_reader :path, :meta_path, :meta, :guid
36
+
37
+ def initialize(path, unity_project = nil)
38
+ raise ArgumentError, "No file at #{path}" unless File.exist?(path)
39
+ @path = path
40
+ @meta_path = path + ".meta"
41
+ @meta = YAML.safe_load(File.read(@meta_path))
42
+ @guid = @meta['guid']
43
+ @unity_project = unity_project
44
+ end
45
+
46
+ def guid_references
47
+ @guid_references ||= U3dCore::CommandExecutor.execute(
48
+ command: "grep -rl #{@guid} #{grep_reference_root}",
49
+ print_command: false
50
+ ).split("\n").reject { |f| f == @meta_path }.map { |path| Asset.new(path) }
51
+ end
52
+
53
+ def name_references
54
+ @name_references ||= U3dCore::CommandExecutor.execute(
55
+ command: "grep -rl #{File.basename(@path, extension)} #{grep_reference_root} --include=*.cs",
56
+ print_command: false
57
+ ).split("\n").map { |path| Asset.new(path) }
58
+ end
59
+
60
+ def extension
61
+ File.extname(@path)
62
+ end
63
+
64
+ def eql?(other)
65
+ return false unless other.is_a? Asset
66
+ other.guid == @guid
67
+ end
68
+
69
+ def hash
70
+ @guid.to_i
71
+ end
72
+
73
+ def to_s
74
+ "#{@guid}:#{@path}"
75
+ end
76
+
77
+ def inspect
78
+ to_s
79
+ end
80
+
81
+ private
82
+
83
+ def grep_reference_root
84
+ @unity_project && @unity_project.exist? ? 'Assets/' : '.'
85
+ end
86
+ end
87
+ end
@@ -151,7 +151,7 @@ module U3d
151
151
  cache_versions = cache_versions(os, offline: !options[:download])
152
152
  version = interpret_latest(version, cache_versions)
153
153
  unless cache_versions[version]
154
- UI.error "No version '#{version}' was found in cache. Either it doesn't exist or u3d doesn't know about it yet. Try refreshing with 'u3d available -f'"
154
+ UI.crash! "No version '#{version}' was found in cache. Either it doesn't exist or u3d doesn't know about it yet. Try refreshing with 'u3d available -f'"
155
155
  return
156
156
  end
157
157
 
@@ -84,13 +84,7 @@ module U3d
84
84
  def installed_sorted_by_versions
85
85
  list = installed
86
86
  return [] if list.empty?
87
- # version -> installations
88
- arraym = list.map { |a| [a.version, a] }
89
- map = Hash[*arraym.flatten]
90
- # sorted versions
91
- vcomparators = map.keys.map { |k| UnityVersionComparator.new(k) }
92
- sorted_keys = vcomparators.sort.map { |v| v.version.to_s }
93
- sorted_keys.map { |k| map[k] }
87
+ list.sort { |a, b| UnityVersionComparator.new(a.version) <=> UnityVersionComparator.new(b.version) }
94
88
  end
95
89
  end
96
90
 
@@ -285,7 +279,7 @@ module U3d
285
279
  Dir.mktmpdir do |tmp_dir|
286
280
  UI.verbose "Working in tmp dir #{tmp_dir}"
287
281
 
288
- command = "7z -aos -o#{tmp_dir.shellescape} e #{file.shellescape}"
282
+ command = "7z -aos -t* -o#{tmp_dir.shellescape} e #{file.shellescape}"
289
283
  U3dCore::CommandExecutor.execute(command: command)
290
284
 
291
285
  target_location = pkg_install_path(installation_path, "#{tmp_dir}/PackageInfo")
@@ -31,12 +31,20 @@ module U3d
31
31
  end
32
32
 
33
33
  def exist?
34
- Dir.exist?("#{@path}/Assets") && Dir.exist?("#{@path}/ProjectSettings")
34
+ Dir.exist?(assets_path) && Dir.exist?(project_settings_path)
35
+ end
36
+
37
+ def assets_path
38
+ File.join(@path, 'Assets')
39
+ end
40
+
41
+ def project_settings_path
42
+ File.join(@path, 'ProjectSettings')
35
43
  end
36
44
 
37
45
  def editor_version
38
46
  require 'yaml'
39
- project_version = "#{@path}/ProjectSettings/ProjectVersion.txt"
47
+ project_version = File.join(project_settings_path, 'ProjectVersion.txt')
40
48
  return nil unless File.exist? project_version
41
49
  yaml = YAML.safe_load(File.read(project_version))
42
50
  version = yaml['m_EditorVersion']
@@ -24,10 +24,12 @@ require 'u3d/utils'
24
24
 
25
25
  module U3d
26
26
  class UnityVersionNumber
27
+ attr_reader :unity_version
27
28
  attr_reader :parts
28
29
 
29
30
  def initialize(version)
30
- parsed = Utils.parse_unity_version(version)
31
+ @unity_version = version
32
+ parsed = Utils.parse_unity_version(@unity_version)
31
33
  parsed.each_with_index do |val, index|
32
34
  next if val.nil? || (index == 3)
33
35
  parsed[index] = val.to_i
@@ -21,7 +21,7 @@
21
21
  ## --- END LICENSE BLOCK ---
22
22
 
23
23
  module U3d
24
- VERSION = '1.1.3'.freeze
24
+ VERSION = '1.1.4'.freeze
25
25
  DESCRIPTION = 'Provides numerous tools for installing, managing and running the Unity game engine from command line.'.freeze
26
26
  UNITY_VERSIONS_NOTE = "Unity uses the following version formatting: 0.0.0x0. The \'x\' can takes different values:\n"\
27
27
  "\t. 'f' are the main release candidates for Unity\n"\
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: u3d
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jerome Lacoste
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-01-08 00:00:00.000000000 Z
12
+ date: 2019-02-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colored
@@ -376,6 +376,7 @@ files:
376
376
  - fastlane-plugin-u3d/spec/spec_helper.rb
377
377
  - lib/assets/utf8.txt
378
378
  - lib/u3d.rb
379
+ - lib/u3d/asset.rb
379
380
  - lib/u3d/cache.rb
380
381
  - lib/u3d/commands.rb
381
382
  - lib/u3d/commands_generator.rb
@@ -433,7 +434,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
433
434
  version: '0'
434
435
  requirements: []
435
436
  rubyforge_project:
436
- rubygems_version: 2.6.12
437
+ rubygems_version: 2.7.6
437
438
  signing_key:
438
439
  specification_version: 4
439
440
  summary: U3d