u3d 1.0.2 → 1.0.3

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
2
  SHA1:
3
- metadata.gz: d9c9db8b88f9c7f182b88f35bc6679cc6834ebbe
4
- data.tar.gz: 7adc661141c3939a5ad6a336a67d6f485982350f
3
+ metadata.gz: c156945d41aa0c5753f61054c8618d6d706a0fb5
4
+ data.tar.gz: fa35a0de169dc91df2fa4cc3ada92d1304107942
5
5
  SHA512:
6
- metadata.gz: 817e030bd2287a8584006bfac86d9651f9b75d62fb3c98959cbd91a5bd6c5b606867111a41f84c4c4f4a395caaaa3cec07fbd8869a035b6e095b5bf74b8faea1
7
- data.tar.gz: 7a95301d40fb53e6409c6aca3866a855c986bbdb7ed85cc972b6ff0e98254bcffa2d2bf47843598a61c19f5a7f122af1f7f98330c692a77e0e0a5022168329b3
6
+ metadata.gz: 1c9b94cf16b94a61101755148c5da1413e41ed0c2091cf19af09bba9567131533e04f7d06df22f38c7e3ce35942b833f8a16e586cddcb91db8f58329d23e2432
7
+ data.tar.gz: b5cdd481bc2d15091aad3caa612ba3fc9682923c246bb328be2ca363370e53a26615e04b77721cf00238bb77a3ee15b426b1b161654103e3bf2ae47272a379c6
@@ -1,4 +1,4 @@
1
- future-release=v1.0.2
1
+ future-release=v1.0.3
2
2
  since-tag=v0.9
3
3
  exclude_tags_regex=v0\.[0-8]\..*
4
4
  exclude-labels=nochangelog
data/.gitignore CHANGED
@@ -1,2 +1,5 @@
1
1
  pkg/
2
2
  coverage/
3
+ gems/
4
+ doc/
5
+ LOCAL/
data/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Change Log
2
2
 
3
+ ## [v1.0.3](https://github.com/DragonBox/u3d/tree/v1.0.3) (2017-09-11)
4
+ [Full Changelog](https://github.com/DragonBox/u3d/compare/v1.0.2...v1.0.3)
5
+
6
+ **Implemented enhancements:**
7
+
8
+ - u3d/internal: create a argescape cross platform method [\#132](https://github.com/DragonBox/u3d/issues/132)
9
+ - u3d/prettifyer should fail with contextual information to ease improvement [\#128](https://github.com/DragonBox/u3d/issues/128)
10
+ - u3d: accept password-less sudo [\#126](https://github.com/DragonBox/u3d/issues/126)
11
+
12
+ **Fixed bugs:**
13
+
14
+ - u3d run: -logFile /dev/stdout causes crashes on Linux [\#43](https://github.com/DragonBox/u3d/issues/43)
15
+
16
+ **Closed issues:**
17
+
18
+ - Create a full circleci mac/linux example [\#15](https://github.com/DragonBox/u3d/issues/15)
19
+
20
+ **Merged pull requests:**
21
+
22
+ - Automate bump & changelog tasks [\#135](https://github.com/DragonBox/u3d/pull/135) ([lacostej](https://github.com/lacostej))
23
+ - u3d/prettifyer: fail with contextual information \(Fixes \#128\) [\#134](https://github.com/DragonBox/u3d/pull/134) ([lacostej](https://github.com/lacostej))
24
+ - u3d/internal: introduce a argescape string function \(Fixes \#132\) [\#133](https://github.com/DragonBox/u3d/pull/133) ([lacostej](https://github.com/lacostej))
25
+ - u3d/credentials support empty passwords for passwordless sudo \(Fixes \#128\) [\#130](https://github.com/DragonBox/u3d/pull/130) ([lacostej](https://github.com/lacostej))
26
+ - Download file now prints progress also in non interactive mode \(only in verbose\) [\#129](https://github.com/DragonBox/u3d/pull/129) ([lacostej](https://github.com/lacostej))
27
+
3
28
  ## [v1.0.2](https://github.com/DragonBox/u3d/tree/v1.0.2) (2017-09-05)
4
29
  [Full Changelog](https://github.com/DragonBox/u3d/compare/v1.0.1...v1.0.2)
5
30
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- u3d (1.0.2)
4
+ u3d (1.0.3)
5
5
  colored (>= 1.2, < 2.0.0)
6
6
  commander (>= 4.4.0, < 5.0.0)
7
7
  file-tail (>= 1.2.0)
data/Rakefile CHANGED
@@ -23,6 +23,9 @@
23
23
  require "bundler/gem_tasks"
24
24
  require "rspec/core/rake_task"
25
25
  require 'rubocop/rake_task'
26
+ require 'u3d'
27
+ UI = U3dCore::UI
28
+
26
29
  # doesn't yet support dot file
27
30
  # https://github.com/skywinder/github-changelog-generator/issues/473
28
31
  # require 'github_changelog_generator/task'
@@ -30,6 +33,115 @@ require 'rubocop/rake_task'
30
33
  RSpec::Core::RakeTask.new(:spec)
31
34
  RuboCop::RakeTask.new
32
35
 
36
+ class GithubChangelogGenerator
37
+ PATH = '.github_changelog_generator'.freeze
38
+ class << self
39
+ def future_release
40
+ s = File.read(PATH)
41
+ s.split("\n").each do |line|
42
+ m = line.match(/future-release=v(.*)/)
43
+ return m[1] if m
44
+ end
45
+ raise "Couldn't find future-release in #{PATH}"
46
+ end
47
+
48
+ def future_release=(nextv)
49
+ s = File.read(PATH)
50
+ lines = s.split("\n").map do |line|
51
+ m = line.match(/future-release=v(.*)/)
52
+ if m
53
+ "future-release=v#{nextv}"
54
+ else
55
+ line
56
+ end
57
+ end
58
+ File.write(PATH, lines.join("\n") + "\n")
59
+ end
60
+ end
61
+ end
62
+
63
+ class U3dCode
64
+ PATH = 'lib/u3d/version.rb'.freeze
65
+ class << self
66
+ def version=(version)
67
+ s = File.read(PATH)
68
+ lines = s.split("\n").map do |line|
69
+ m = line.match(/(.*VERSION = ').*('.freeze.*)/)
70
+ if m
71
+ "#{m[1]}#{version}#{m[2]}"
72
+ else
73
+ line
74
+ end
75
+ end
76
+ File.write(PATH, lines.join("\n") + "\n")
77
+ end
78
+ end
79
+ end
80
+
81
+ def run_command(command, error_message = nil)
82
+ output = `#{command}`
83
+ unless $CHILD_STATUS.success?
84
+ error_message = "Failed to run command '#{command}'" if error_message.nil?
85
+ UI.user_error!(error_message)
86
+ end
87
+ output
88
+ end
89
+
90
+ task :ensure_git_clean do
91
+ branch = run_command('git rev-parse --abbrev-ref HEAD', "Couldn't get current git branch").strip
92
+ UI.user_error!("You are not on 'master' but on '#{branch}'") unless branch == "master"
93
+ output = run_command('git status --porcelain', "Couldn't get git status")
94
+ UI.user_error!("git status not clean:\n#{output}") unless output == ""
95
+ end
96
+
97
+ # ensure ready to prepare a PR
98
+ task :prepare_git_pr, [:pr_branch] do |_t, args|
99
+ pr_branch = args['pr_branch']
100
+ raise "Missing pr_branch argument" unless pr_branch
101
+ UI.user_error! "Prepare git PR stopped by user" unless UI.confirm("Creating PR branch #{pr_branch}")
102
+ run_command("git checkout -b #{pr_branch}")
103
+ end
104
+
105
+ task pre_release: 'ensure_git_clean' do
106
+ require 'u3d/version'
107
+ nextversion = U3d::VERSION
108
+
109
+ # check not already released
110
+ output = run_command("git tag -l v#{nextversion}").strip
111
+ UI.user_error! "Version '#{nextversion}' already released. Run 'rake bump'" unless output == ''
112
+
113
+ gh_future_release = GithubChangelogGenerator.future_release
114
+ UI.user_error! "GithubChangelogGenerator version #{gh_future_release} != #{nextversion}" unless gh_future_release == nextversion
115
+
116
+ pr_branch = "release_#{nextversion}"
117
+ Rake::Task["prepare_git_pr"].invoke(pr_branch)
118
+
119
+ Rake::Task["changelog"].invoke
120
+
121
+ sh('git diff')
122
+ UI.user_error! "Pre release stopped by user." unless UI.confirm("CHANGELOG PR for version #{nextversion}. Confirm?")
123
+
124
+ msg = "Preparing release for #{nextversion}"
125
+ sh 'git add CHANGELOG.md'
126
+ sh "git commit -m '#{msg}'"
127
+ sh "git push lacostej" # FIXME: hardcoded
128
+ # FIXME check hub present
129
+ sh "hub pull-request -m '#{msg}' -l nochangelog"
130
+ sh 'git checkout master'
131
+ sh "git branch -D #{pr_branch}"
132
+ end
133
+
134
+ task bump: 'ensure_git_clean' do
135
+ nextversion = UI.input "Next version will be:"
136
+ UI.user_error! "Bump version stopped by user" unless UI.confirm("Next version will be #{nextversion}. Confirm?")
137
+ U3dCode.version = nextversion
138
+ GithubChangelogGenerator.future_release = nextversion
139
+ sh 'rspec'
140
+ sh 'git add .github_changelog_generator lib/u3d/version.rb Gemfile.lock'
141
+ sh "git commit -m 'Bump version to #{nextversion}'"
142
+ sh 'git push'
143
+ end
144
+
33
145
  task :changelog do
34
146
  puts "Updating changelog #{ENV['CHANGELOG_GITHUB_TOKEN']}"
35
147
  sh "github_changelog_generator" if ENV['CHANGELOG_GITHUB_TOKEN']
data/lib/u3d.rb CHANGED
@@ -25,7 +25,7 @@ require 'u3d/unity_version_number'
25
25
 
26
26
  require 'u3d_core'
27
27
  # require 'terminal-table'
28
- require 'shellwords'
28
+ require 'u3d_core/core_ext/string'
29
29
 
30
30
  module U3d
31
31
  Helper = U3dCore::Helper
data/lib/u3d/installer.rb CHANGED
@@ -21,6 +21,7 @@
21
21
  ## --- END LICENSE BLOCK ---
22
22
 
23
23
  require 'u3d/utils'
24
+ require 'u3d_core/core_ext/string'
24
25
  require 'u3d/installation'
25
26
  require 'fileutils'
26
27
  require 'file-tail'
@@ -229,8 +230,8 @@ module U3d
229
230
 
230
231
  source_path.tr!('/', '\\')
231
232
  new_path.tr!('/', '\\')
232
- source_path = "\"" + source_path + "\"" if source_path =~ / /
233
- new_path = "\"" + new_path + "\"" if new_path =~ / /
233
+ source_path = source_path.argescape
234
+ new_path = new_path.argescape
234
235
 
235
236
  command = "move #{source_path} #{new_path}"
236
237
 
@@ -197,7 +197,8 @@ module U3d
197
197
  if @active_rule
198
198
  # Active rule should be finished
199
199
  # If it is still active during phase change, it means that something went wrong
200
- UI.error("[#{@active_phase}] Could not finish active rule '#{@active_rule}'. Aborting it.")
200
+ context = @lines_memory.map { |l| "\n> #{l}" }.join('')
201
+ UI.error("[#{@active_phase}] Could not finish active rule '#{@active_rule}'. Aborting it. Context:#{context}")
201
202
  @active_rule = nil
202
203
  end
203
204
  UI.verbose("--- Ending #{@active_phase} phase ---")
@@ -21,6 +21,7 @@
21
21
  ## --- END LICENSE BLOCK ---
22
22
 
23
23
  require 'u3d/utils'
24
+ require 'u3d_core/core_ext/string'
24
25
  require 'fileutils'
25
26
  require 'file-tail'
26
27
 
@@ -49,11 +50,7 @@ module U3d
49
50
 
50
51
  begin
51
52
  args.unshift(installation.exe_path)
52
- if Helper.windows?
53
- args.map! { |a| a =~ / / ? "\"#{a}\"" : a }
54
- else
55
- args.map!(&:shellescape)
56
- end
53
+ args.map!(&:argescape)
57
54
 
58
55
  U3dCore::CommandExecutor.execute_command(command: args, output_callback: output_callback)
59
56
  ensure
data/lib/u3d/utils.rb CHANGED
@@ -64,6 +64,7 @@ module U3d
64
64
  uri = URI(url)
65
65
  current = 0
66
66
  last_print_update = 0
67
+ print_progress = UI.interactive? || U3dCore::Globals.verbose?
67
68
  Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
68
69
  request = Net::HTTP::Get.new uri
69
70
  http.request request do |response|
@@ -79,7 +80,7 @@ module U3d
79
80
  # wait for Net::HTTP buffer on slow networks
80
81
  # FIXME revisits, this slows down download on fast network
81
82
  # sleep 0.08 # adjust to reduce CPU
82
- next unless UI.interactive?
83
+ next unless print_progress
83
84
  next unless Time.now.to_f - last_print_update > 0.5
84
85
  last_print_update = Time.now.to_f
85
86
  if size
@@ -87,10 +88,11 @@ module U3d
87
88
  else
88
89
  Utils.print_progress_nosize(current, started_at)
89
90
  end
91
+ print "\n" unless UI.interactive?
90
92
  end
91
93
  end
92
94
  end
93
- print "\n" if UI.interactive?
95
+ print "\n" if print_progress
94
96
  end
95
97
  end
96
98
 
data/lib/u3d/version.rb CHANGED
@@ -21,7 +21,7 @@
21
21
  ## --- END LICENSE BLOCK ---
22
22
 
23
23
  module U3d
24
- VERSION = '1.0.2'.freeze
24
+ VERSION = '1.0.3'.freeze
25
25
  DESCRIPTION = 'Provides numerous tools for installing, managing and running the Unity3D game engine from command line.'.freeze
26
26
  UNITY_VERSIONS_NOTE = "Unity3d 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 Unity3d\n"\
@@ -0,0 +1,35 @@
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 'u3d_core/helper'
24
+
25
+ class String
26
+ # a crossplatform version of shellescape
27
+ def argescape
28
+ if U3dCore::Helper.windows?
29
+ self =~ / / ? "\"#{self}\"" : self
30
+ else
31
+ require 'shellwords'
32
+ Shellwords.escape(self)
33
+ end
34
+ end
35
+ end
@@ -51,12 +51,12 @@ module U3dCore
51
51
  if Helper.mac? && @use_keychain
52
52
  unless @password
53
53
  UI.message 'Fetching password from keychain'
54
- password_holder = Security::InternetPassword.find(server: MAC_U3D_SERVER)
54
+ password_holder = Security::InternetPassword.find(server: server_name)
55
55
  @password = password_holder.password unless password_holder.nil?
56
56
  end
57
57
  end
58
58
 
59
- if @password.to_s.empty?
59
+ if @password.nil?
60
60
  UI.verbose 'Could not retrieve password'
61
61
  if U3dCore::Globals.do_not_login?
62
62
  UI.verbose 'Login disabled'
@@ -73,8 +73,8 @@ module U3dCore
73
73
 
74
74
  raise CredentialsError, 'No username specified' unless user
75
75
 
76
- while @password.to_s.empty?
77
- UI.verbose 'Password does not exist or is empty'
76
+ while @password.nil?
77
+ UI.verbose 'Password does not exist'
78
78
  raise CredentialsError, 'Password missing and context is not interactive. Please make sure it is correct' unless UI.interactive?
79
79
  @password = UI.password "Password for #{user}:"
80
80
  end
@@ -91,7 +91,7 @@ module U3dCore
91
91
  ENV['U3D_PASSWORD'] = @password
92
92
  if Helper.mac? && @use_keychain
93
93
  UI.message 'Storing credentials to the keychain'
94
- return Security::InternetPassword.add(MAC_U3D_SERVER, user, password)
94
+ return Security::InternetPassword.add(server_name, user, password)
95
95
  end
96
96
 
97
97
  return false
@@ -103,12 +103,16 @@ module U3dCore
103
103
  if force || UI.interactive?
104
104
  if Helper.mac? && @use_keychain && (force || UI.confirm('Remove credentials from the keychain?'))
105
105
  UI.message 'Deleting credentials from the keychain'
106
- Security::InternetPassword.delete(server: MAC_U3D_SERVER)
106
+ Security::InternetPassword.delete(server: server_name)
107
107
  end
108
108
  elsif Helper.mac?
109
109
  UI.verbose 'Keychain may store invalid credentials for u3d'
110
110
  end
111
111
  end
112
+
113
+ def server_name
114
+ MAC_U3D_SERVER
115
+ end
112
116
  end
113
117
 
114
118
  class CredentialsError < StandardError
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.0.2
4
+ version: 1.0.3
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: 2017-09-05 00:00:00.000000000 Z
12
+ date: 2017-09-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: commander
@@ -380,6 +380,7 @@ files:
380
380
  - lib/u3d_core.rb
381
381
  - lib/u3d_core/command_executor.rb
382
382
  - lib/u3d_core/command_runner.rb
383
+ - lib/u3d_core/core_ext/string.rb
383
384
  - lib/u3d_core/credentials.rb
384
385
  - lib/u3d_core/globals.rb
385
386
  - lib/u3d_core/helper.rb