wooga_uvm 0.3.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 321144e354984193fa2ba6ef5e07f40904039e81
4
+ data.tar.gz: aba8caa86a9fac2d669fce481a3c3689dc65559d
5
+ SHA512:
6
+ metadata.gz: b68fc82bd8c6c7ae39d8dec5ef7b7d292766ea808b4c7f223c0868283b6fd39a494b54348d82e43cd517b72e3d03e77d4d51749c1d9fe8e4b561f10a7eb4d310
7
+ data.tar.gz: d28c9813b5abab0a0c785a6496a4b86fca33a785209a32c4b708592d994ca6085f3177478e98d298204d1e08758d7af3e5f2d68c2188de5aee4efb460b27f340
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ Gemfile.lock
2
+ /pkg
data/.travis.yml ADDED
@@ -0,0 +1,20 @@
1
+ sudo: false
2
+ language: ruby
3
+
4
+ script: bundle exec ruby spec/uvm_spec.rb
5
+
6
+ rvm:
7
+ - 2.3.0
8
+ - 2.2
9
+ - 2.1
10
+ - 2.0
11
+ - ruby-head
12
+ - rbx-2
13
+ - jruby-head
14
+ - jruby-9000
15
+
16
+ cache:
17
+ - bundler
18
+
19
+ # matrix:
20
+ # fast_finish: true
data/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ ## CHANGELOG
2
+
3
+ ### 0.1.0
4
+
5
+ * Inital release
6
+
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'minitest'
data/Licence.md ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2016 Donald Hutchison, git@toastymofo.net
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # unity version manager
2
+
3
+ A script that just manipulates a link to the current unity version to save a small amount of sanity
4
+
5
+
6
+ ## Setup
7
+
8
+ _install with brew_
9
+
10
+ ```bash
11
+ brew tap wooga/tools
12
+ brew install wooga/unity-version-manager
13
+ ```
14
+
15
+ _install with ruby gems_
16
+
17
+ ```bash
18
+ gem install wooga_uvm
19
+ ```
20
+
21
+
22
+ ## Usage
23
+
24
+ ```bash
25
+
26
+ Commands:
27
+ uvm current # Print the current version in use
28
+ uvm detect # Find which version of unity was used to generate the project in current dir
29
+ uvm help [COMMAND] # Describe available commands or one specific command
30
+ uvm list # list unity versions available
31
+ uvm use VERSION # Use specific version of unity
32
+
33
+ ```
34
+
35
+
36
+ ## MIT License
37
+
38
+ Copyright (C) 2016 Wooga
data/Rakefile ADDED
@@ -0,0 +1,30 @@
1
+ # # #
2
+ # Get gemspec info
3
+
4
+ gemspec_file = Dir['*.gemspec'].first
5
+ gemspec = eval File.read(gemspec_file), binding, gemspec_file
6
+ info = "#{gemspec.name} | #{gemspec.version} | " \
7
+ "#{gemspec.runtime_dependencies.size} dependencies | " \
8
+ "#{gemspec.files.size} files"
9
+
10
+
11
+ # # #
12
+ # Gem build and install task
13
+
14
+ desc info
15
+ task :gem do
16
+ puts info + "\n\n"
17
+ print " "; sh "gem build #{gemspec_file}"
18
+ FileUtils.mkdir_p 'pkg'
19
+ FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", 'pkg'
20
+ puts; sh %{gem install --no-document pkg/#{gemspec.name}-#{gemspec.version}.gem}
21
+ end
22
+
23
+
24
+ # # #
25
+ # Start an IRB session with the gem loaded
26
+
27
+ desc "#{gemspec.name} | IRB"
28
+ task :irb do
29
+ sh "irb -I ./lib -r #{gemspec.name.gsub '-','/'}"
30
+ end
data/bin/uvm ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'uvm'
4
+
5
+ UVM::CLI.start ARGV
6
+
data/lib/uvm/cli.rb ADDED
@@ -0,0 +1,108 @@
1
+ require 'thor'
2
+ require 'fileutils'
3
+ require 'wooget/util/misc'
4
+ module UVM
5
+ UNITY_LINK='/Applications/Unity'
6
+ UNITY_CONTENTS="#{UNITY_LINK}/Unity.app/Contents"
7
+ UNITY_INSTALL_LOCATION='/Applications'
8
+
9
+ class CLI < Thor
10
+
11
+ def initialize args, local_options, config
12
+ super(args, local_options, config)
13
+ ensure_link
14
+ end
15
+
16
+ desc "list", "list unity versions available"
17
+ def list
18
+ installed = Lib.list
19
+ current = Lib.current
20
+ puts installed.map {|i| (!current.nil? and current.include?(i)) ? i + " [active]" : i }
21
+ end
22
+
23
+ desc "use VERSION", "Use specific version of unity"
24
+ def use version
25
+ unless version =~ Lib.version_regex
26
+ puts "Invalid format '#{version}' - please try a version in format `X.X.X`"
27
+ exit
28
+ end
29
+
30
+ desired_version = File.join(UNITY_INSTALL_LOCATION,"Unity"+version)
31
+
32
+ unless Dir.exists? desired_version
33
+ puts "Version #{version} isn't available "
34
+ puts "Available versions are -"
35
+ list
36
+ exit
37
+ end
38
+
39
+ FileUtils.rm(UNITY_LINK) if File.exists? UNITY_LINK
40
+ FileUtils.ln_s(desired_version, UNITY_LINK, :force => true)
41
+
42
+ puts "Using #{version} : #{UNITY_LINK} -> #{desired_version}"
43
+ end
44
+
45
+ desc "clear", "Remove the link so you can install a new version without overwriting"
46
+ def clear
47
+ if File.symlink?(UNITY_LINK)
48
+ FileUtils.rm(UNITY_LINK)
49
+ end
50
+ end
51
+
52
+ desc "detect", "Find which version of unity was used to generate the project in current dir"
53
+ def detect
54
+ version = `find . -name ProjectVersion.txt | xargs cat | grep EditorVersion`
55
+ match_data = version.match /m_EditorVersion: (.*)/
56
+
57
+ if match_data and match_data.length > 1
58
+ puts match_data[1]
59
+ else
60
+ puts "Couldn't detect project version"
61
+ end
62
+ end
63
+
64
+ desc "current", "Print the current version in use"
65
+ def current
66
+ if Lib.current
67
+ puts Lib.current
68
+ else
69
+ puts "No unity version detected"
70
+ end
71
+ end
72
+
73
+ desc "launch [PATH=pwd] [PLATFORM=android]", "Launch the current version of unity"
74
+ def launch project_path=File.expand_path(Dir.pwd), platform="android"
75
+ project_str = ""
76
+ project_str = "-projectPath '#{project_path}'" if Wooget::Util.is_a_unity_project_dir(project_path)
77
+
78
+ exec "open #{UNITY_LINK}/Unity.app --args -buildTarget #{platform} #{project_str}"
79
+ end
80
+
81
+ private
82
+ def ensure_link
83
+ if !File.symlink?(UNITY_LINK) and File.directory?(UNITY_LINK)
84
+ new_dir_name = File.join(UNITY_INSTALL_LOCATION,"Unity"+Lib.current)
85
+ FileUtils.mv(UNITY_LINK, new_dir_name)
86
+ FileUtils.ln_s(new_dir_name, UNITY_LINK, :force => true)
87
+ end
88
+ end
89
+ end
90
+
91
+ class Lib
92
+ def self.current
93
+ plist_path = File.join(UNITY_CONTENTS,"Info.plist")
94
+ if File.exists? plist_path
95
+ `/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' #{plist_path}`.split("f").first
96
+ end
97
+ end
98
+
99
+ def self.list
100
+ installed = `find #{UNITY_INSTALL_LOCATION} -name "Unity*" -type d -maxdepth 1`.lines
101
+ installed.map{|u| u.match(version_regex){|m| m[1]} }
102
+ end
103
+
104
+ def self.version_regex
105
+ /(\d+\.\d+\.\d+$)/
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,4 @@
1
+ module Uvm
2
+ VERSION = "0.3.1".freeze
3
+ end
4
+
data/lib/uvm.rb ADDED
@@ -0,0 +1,6 @@
1
+ require_relative "uvm/version"
2
+ require_relative "uvm/cli"
3
+
4
+ module Uvm
5
+ end
6
+
data/spec/uvm_spec.rb ADDED
@@ -0,0 +1,9 @@
1
+ require_relative "../lib/uvm"
2
+ require "minitest/autorun"
3
+
4
+ describe Uvm do
5
+ it "works" do
6
+ assert_equal true, false
7
+ end
8
+ end
9
+
data/uvm.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require File.dirname(__FILE__) + "/lib/uvm/version"
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = "wooga_uvm"
7
+ gem.version = Uvm::VERSION
8
+ gem.summary = "Switch between multiple versions of unity"
9
+ gem.description = "A command line utility to help manage multiple versions of unity on the same machine."
10
+ gem.authors = ["Donald Hutchison"]
11
+ gem.email = ["donald.hutchison@wooga.net"]
12
+ gem.homepage = "https://github.com/wooga/unity-version-manager"
13
+ gem.license = "MIT"
14
+
15
+ gem.files = Dir["{**/}{.*,*}"].select{ |path| File.file?(path) && path !~ /^pkg/ }
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.required_ruby_version = "~> 2.0"
21
+ gem.add_runtime_dependency "thor"
22
+ gem.add_runtime_dependency "wooga_wooget"
23
+ gem.add_development_dependency "rake"
24
+ gem.add_development_dependency "pry-byebug"
25
+
26
+ end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wooga_uvm
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.1
5
+ platform: ruby
6
+ authors:
7
+ - Donald Hutchison
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-02-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: wooga_wooget
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry-byebug
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: A command line utility to help manage multiple versions of unity on the
70
+ same machine.
71
+ email:
72
+ - donald.hutchison@wooga.net
73
+ executables:
74
+ - uvm
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - ".gitignore"
79
+ - ".travis.yml"
80
+ - CHANGELOG.md
81
+ - Gemfile
82
+ - Licence.md
83
+ - README.md
84
+ - Rakefile
85
+ - bin/uvm
86
+ - lib/uvm.rb
87
+ - lib/uvm/cli.rb
88
+ - lib/uvm/version.rb
89
+ - spec/uvm_spec.rb
90
+ - uvm.gemspec
91
+ homepage: https://github.com/wooga/unity-version-manager
92
+ licenses:
93
+ - MIT
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '2.0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.5.1
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: Switch between multiple versions of unity
115
+ test_files:
116
+ - spec/uvm_spec.rb