uas2git 0.9.0
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 +7 -0
- data/.gitignore +21 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +26 -0
- data/Rakefile +1 -0
- data/Vagrantfile +127 -0
- data/bin/uas2git +7 -0
- data/lib/uas2git/migration.rb +188 -0
- data/lib/uas2git/uas.rb +67 -0
- data/lib/uas2git/version.rb +3 -0
- data/lib/uas2git.rb +3 -0
- data/uas2git.gemspec +28 -0
- metadata +155 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 7a70decd0b14837ca3526f1d98333bb28e44a0f1
|
|
4
|
+
data.tar.gz: 84818ab460828c100ac617fdc72a58f724c4d17b
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 3d26305283cf71e20eb722db960cbcc28c46ad64c3aa47d64a1e127d637caa2aa4c90127e4b629b16c2f2af577d6ade0537d6f0e94e46c4798adda55419820bb
|
|
7
|
+
data.tar.gz: 85658cf3caee2c0ba5ec51bebb633676bc5850f01787292d77060f5e46ff5b53eda29b325cd7b380cae5412a4a06875a262b56fe4499033f6db742ff2ef9abe0
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2014 Toru Nayuki
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# uas2git
|
|
2
|
+
|
|
3
|
+
A tool for migrating Unity Asset Server projects to git
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
gem install uas2git
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
Usage: uas2git PROJECT_NAME [options]
|
|
12
|
+
|
|
13
|
+
Specific options:
|
|
14
|
+
-H, --host NAME Unity Asset Server host
|
|
15
|
+
-u, --username NAME Crendential for Unity Asset Server
|
|
16
|
+
-p, --password PASSWD
|
|
17
|
+
|
|
18
|
+
-h, --help Show this message
|
|
19
|
+
|
|
20
|
+
## Contributing
|
|
21
|
+
|
|
22
|
+
1. Fork it ( http://github.com/<my-github-username>/uas2git/fork )
|
|
23
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
24
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
25
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
26
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
data/Vagrantfile
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# -*- mode: ruby -*-
|
|
2
|
+
# vi: set ft=ruby :
|
|
3
|
+
|
|
4
|
+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
|
5
|
+
VAGRANTFILE_API_VERSION = "2"
|
|
6
|
+
|
|
7
|
+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|
8
|
+
# All Vagrant configuration is done here. The most common configuration
|
|
9
|
+
# options are documented and commented below. For a complete reference,
|
|
10
|
+
# please see the online documentation at vagrantup.com.
|
|
11
|
+
|
|
12
|
+
# Every Vagrant virtual environment requires a box to build off of.
|
|
13
|
+
config.vm.box = "precise32"
|
|
14
|
+
|
|
15
|
+
# The url from where the 'config.vm.box' box will be fetched if it
|
|
16
|
+
# doesn't already exist on the user's system.
|
|
17
|
+
# config.vm.box_url = "http://domain.com/path/to/above.box"
|
|
18
|
+
|
|
19
|
+
# Create a forwarded port mapping which allows access to a specific port
|
|
20
|
+
# within the machine from a port on the host machine. In the example below,
|
|
21
|
+
# accessing "localhost:8080" will access port 80 on the guest machine.
|
|
22
|
+
# config.vm.network :forwarded_port, guest: 80, host: 8080
|
|
23
|
+
config.vm.network :forwarded_port, guest: 10733, host: 10733
|
|
24
|
+
|
|
25
|
+
# Create a private network, which allows host-only access to the machine
|
|
26
|
+
# using a specific IP.
|
|
27
|
+
# config.vm.network :private_network, ip: "192.168.33.10"
|
|
28
|
+
|
|
29
|
+
# Create a public network, which generally matched to bridged network.
|
|
30
|
+
# Bridged networks make the machine appear as another physical device on
|
|
31
|
+
# your network.
|
|
32
|
+
# config.vm.network :public_network
|
|
33
|
+
|
|
34
|
+
# If true, then any SSH connections made will enable agent forwarding.
|
|
35
|
+
# Default value: false
|
|
36
|
+
# config.ssh.forward_agent = true
|
|
37
|
+
|
|
38
|
+
# Share an additional folder to the guest VM. The first argument is
|
|
39
|
+
# the path on the host to the actual folder. The second argument is
|
|
40
|
+
# the path on the guest to mount the folder. And the optional third
|
|
41
|
+
# argument is a set of non-required options.
|
|
42
|
+
# config.vm.synced_folder "../data", "/vagrant_data"
|
|
43
|
+
|
|
44
|
+
# Provider-specific configuration so you can fine-tune various
|
|
45
|
+
# backing providers for Vagrant. These expose provider-specific options.
|
|
46
|
+
# Example for VirtualBox:
|
|
47
|
+
#
|
|
48
|
+
# config.vm.provider :virtualbox do |vb|
|
|
49
|
+
# # Don't boot with headless mode
|
|
50
|
+
# vb.gui = true
|
|
51
|
+
#
|
|
52
|
+
# # Use VBoxManage to customize the VM. For example to change memory:
|
|
53
|
+
# vb.customize ["modifyvm", :id, "--memory", "1024"]
|
|
54
|
+
# end
|
|
55
|
+
#
|
|
56
|
+
# View the documentation for the provider you're using for more
|
|
57
|
+
# information on available options.
|
|
58
|
+
|
|
59
|
+
# Enable provisioning with Puppet stand alone. Puppet manifests
|
|
60
|
+
# are contained in a directory path relative to this Vagrantfile.
|
|
61
|
+
# You will need to create the manifests directory and a manifest in
|
|
62
|
+
# the file base.pp in the manifests_path directory.
|
|
63
|
+
#
|
|
64
|
+
# An example Puppet manifest to provision the message of the day:
|
|
65
|
+
#
|
|
66
|
+
# # group { "puppet":
|
|
67
|
+
# # ensure => "present",
|
|
68
|
+
# # }
|
|
69
|
+
# #
|
|
70
|
+
# # File { owner => 0, group => 0, mode => 0644 }
|
|
71
|
+
# #
|
|
72
|
+
# # file { '/etc/motd':
|
|
73
|
+
# # content => "Welcome to your Vagrant-built virtual machine!
|
|
74
|
+
# # Managed by Puppet.\n"
|
|
75
|
+
# # }
|
|
76
|
+
#
|
|
77
|
+
# config.vm.provision :puppet do |puppet|
|
|
78
|
+
# puppet.manifests_path = "manifests"
|
|
79
|
+
# puppet.manifest_file = "site.pp"
|
|
80
|
+
# end
|
|
81
|
+
|
|
82
|
+
# Enable provisioning with chef solo, specifying a cookbooks path, roles
|
|
83
|
+
# path, and data_bags path (all relative to this Vagrantfile), and adding
|
|
84
|
+
# some recipes and/or roles.
|
|
85
|
+
#
|
|
86
|
+
# config.vm.provision :chef_solo do |chef|
|
|
87
|
+
# chef.cookbooks_path = "../my-recipes/cookbooks"
|
|
88
|
+
# chef.roles_path = "../my-recipes/roles"
|
|
89
|
+
# chef.data_bags_path = "../my-recipes/data_bags"
|
|
90
|
+
# chef.add_recipe "mysql"
|
|
91
|
+
# chef.add_role "web"
|
|
92
|
+
#
|
|
93
|
+
# # You may also specify custom JSON attributes:
|
|
94
|
+
# chef.json = { :mysql_password => "foo" }
|
|
95
|
+
# end
|
|
96
|
+
|
|
97
|
+
# Enable provisioning with chef server, specifying the chef server URL,
|
|
98
|
+
# and the path to the validation key (relative to this Vagrantfile).
|
|
99
|
+
#
|
|
100
|
+
# The Opscode Platform uses HTTPS. Substitute your organization for
|
|
101
|
+
# ORGNAME in the URL and validation key.
|
|
102
|
+
#
|
|
103
|
+
# If you have your own Chef Server, use the appropriate URL, which may be
|
|
104
|
+
# HTTP instead of HTTPS depending on your configuration. Also change the
|
|
105
|
+
# validation key to validation.pem.
|
|
106
|
+
#
|
|
107
|
+
# config.vm.provision :chef_client do |chef|
|
|
108
|
+
# chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
|
|
109
|
+
# chef.validation_key_path = "ORGNAME-validator.pem"
|
|
110
|
+
# end
|
|
111
|
+
#
|
|
112
|
+
# If you're using the Opscode platform, your validator client is
|
|
113
|
+
# ORGNAME-validator, replacing ORGNAME with your organization name.
|
|
114
|
+
#
|
|
115
|
+
# If you have your own Chef Server, the default validation client name is
|
|
116
|
+
# chef-validator, unless you changed the configuration.
|
|
117
|
+
#
|
|
118
|
+
# chef.validation_client_name = "ORGNAME-validator"
|
|
119
|
+
|
|
120
|
+
config.vm.provision "shell", inline: <<EOF
|
|
121
|
+
wget -O /tmp/unity-asset-server_2.0.1_i386.deb http://download.unity3d.com/asset_server/unity-asset-server_2.0.1_i386.deb
|
|
122
|
+
dpkg -i /tmp/unity-asset-server_2.0.1_i386.deb
|
|
123
|
+
|
|
124
|
+
( echo admin ; echo admin ) | /opt/unity_asset_server/bin/reset_admin_password
|
|
125
|
+
EOF
|
|
126
|
+
|
|
127
|
+
end
|
data/bin/uas2git
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
require 'optparse'
|
|
2
|
+
require 'rugged'
|
|
3
|
+
require 'progress'
|
|
4
|
+
|
|
5
|
+
module Uas2Git
|
|
6
|
+
class Migration
|
|
7
|
+
def initialize(args)
|
|
8
|
+
@options = parse(args)
|
|
9
|
+
|
|
10
|
+
show_help_message('Missing PROJECT_NAME parameter') if args.empty?
|
|
11
|
+
show_help_message('Too many arguments') if args.size > 1
|
|
12
|
+
|
|
13
|
+
@project_name = args.first
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def run!
|
|
17
|
+
ActiveRecord::Base.establish_connection(
|
|
18
|
+
:adapter => 'postgresql',
|
|
19
|
+
:host => @options[:host],
|
|
20
|
+
:port => '10733',
|
|
21
|
+
:username => @options[:username],
|
|
22
|
+
:password => @options[:password],
|
|
23
|
+
:database => @project_name
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
# Initialize a git repository
|
|
27
|
+
repo = Progress.start('Initializing a git repository', 1) do
|
|
28
|
+
Progress.step do
|
|
29
|
+
Rugged::Repository.init_at('.')
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Import files
|
|
34
|
+
oids = {}
|
|
35
|
+
meta_oids = {}
|
|
36
|
+
|
|
37
|
+
asset_versions = Uas2Git::Uas::Model::AssetVersion.joins(:type).where('assettype.description <> \'dir\'')
|
|
38
|
+
Progress.start('Importing ' + asset_versions.count.to_s + ' files', asset_versions.count) do
|
|
39
|
+
asset_versions.find_each do |asset_version|
|
|
40
|
+
Progress.step do
|
|
41
|
+
asset_version.contents.each do |contents|
|
|
42
|
+
blob = ''
|
|
43
|
+
|
|
44
|
+
asset_version.transaction do
|
|
45
|
+
fd = asset_version.class.connection.raw_connection.lo_open(contents.stream, PG::INV_READ)
|
|
46
|
+
|
|
47
|
+
loop do
|
|
48
|
+
data = asset_version.class.connection.raw_connection.lo_read(fd, 65536)
|
|
49
|
+
break if data == nil || data.empty?
|
|
50
|
+
|
|
51
|
+
blob += data
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
asset_version.class.connection.raw_connection.lo_close(fd)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
oid = repo.write(blob, :blob)
|
|
58
|
+
|
|
59
|
+
if contents.tag == 'asset' then
|
|
60
|
+
oids[asset_version.asset.serial] = {} if oids[asset_version.asset.serial].nil?
|
|
61
|
+
oids[asset_version.asset.serial][asset_version.revision] = oid
|
|
62
|
+
elsif contents.tag == 'asset.meta' then
|
|
63
|
+
meta_oids[asset_version.asset.serial] = {} if meta_oids[asset_version.asset.serial].nil?
|
|
64
|
+
meta_oids[asset_version.asset.serial][asset_version.revision] = oid
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Precalculating directory paths from changesets
|
|
72
|
+
dirs = {}
|
|
73
|
+
prev_changeset = nil
|
|
74
|
+
|
|
75
|
+
Progress.start('Precalculating directory paths', Uas2Git::Uas::Model::Changeset.count) do
|
|
76
|
+
Uas2Git::Uas::Model::Changeset.find_each do |changeset|
|
|
77
|
+
Progress.step do
|
|
78
|
+
dirs[changeset.serial] = prev_changeset ? dirs[prev_changeset.serial].clone : {}
|
|
79
|
+
|
|
80
|
+
changeset.asset_versions.joins(:type).where('assettype.description = \'dir\'').find_each do |asset_version|
|
|
81
|
+
if asset_version.parent then
|
|
82
|
+
dirs[changeset.serial][asset_version.asset.serial] = dirs[changeset.serial][asset_version.parent.serial] + '/' + asset_version.name
|
|
83
|
+
else
|
|
84
|
+
dirs[changeset.serial][asset_version.asset.serial] = asset_version.name
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
prev_changeset = changeset
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Importing changesets
|
|
94
|
+
Progress.start('Importing ' + Uas2Git::Uas::Model::Changeset.count.to_s + ' changesets', Uas2Git::Uas::Model::Changeset.count) do
|
|
95
|
+
Uas2Git::Uas::Model::Changeset.find_each do |changeset|
|
|
96
|
+
Progress.step do
|
|
97
|
+
index = Rugged::Index.new
|
|
98
|
+
|
|
99
|
+
Uas2Git::Uas::Model::AssetVersion.joins(:type).where('assettype.description <> \'dir\'').where(
|
|
100
|
+
'created_in <= :c AND assetversion.serial IN (SELECT assetversion FROM changesetcontents WHERE changesetcontents.changeset <= :c) AND revision = (SELECT MAX(revision) FROM assetversion AV2 WHERE AV2.asset = assetversion.asset AND AV2.created_in <= :c)',
|
|
101
|
+
{ :c => changeset.serial }
|
|
102
|
+
).find_each do |asset_version|
|
|
103
|
+
if asset_version.parent then
|
|
104
|
+
path = dirs[changeset.serial][asset_version.parent.serial] + '/' + asset_version.name
|
|
105
|
+
else
|
|
106
|
+
path = 'ProjectSettings/' + asset_version.name
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
if !path.start_with?('Trash/') then
|
|
110
|
+
index.add(:path => path, :oid => oids[asset_version.asset.serial][asset_version.revision], :mode => 0100644)
|
|
111
|
+
if meta_oids.has_key?(asset_version.asset.serial) then
|
|
112
|
+
index.add(:path => path + '.meta', :oid => meta_oids[asset_version.asset.serial][asset_version.revision], :mode => 0100644)
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
author = {
|
|
118
|
+
:name => changeset.creator.username,
|
|
119
|
+
:email => '',
|
|
120
|
+
:time => changeset.commit_time.nil? ? Time.now : changeset.commit_time
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
Rugged::Commit.create(repo, {
|
|
124
|
+
:tree => index.write_tree(repo),
|
|
125
|
+
:author => author,
|
|
126
|
+
:committer => author,
|
|
127
|
+
:message => changeset.description,
|
|
128
|
+
:parents => repo.empty? ? [] : [ repo.head.target ].compact,
|
|
129
|
+
:update_ref => 'HEAD'
|
|
130
|
+
})
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Checking out the working copy
|
|
136
|
+
Progress.start('Checking out the work tree', 1) do
|
|
137
|
+
Progress.step do
|
|
138
|
+
repo.reset('HEAD', :hard)
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def parse(args)
|
|
144
|
+
# Set up reasonable defaults for options.
|
|
145
|
+
options = {}
|
|
146
|
+
options[:host] = 'localhost'
|
|
147
|
+
options[:username] = 'admin'
|
|
148
|
+
options[:password] = nil
|
|
149
|
+
|
|
150
|
+
@opts = OptionParser.new do |opts|
|
|
151
|
+
opts.banner = 'Usage: uas2git PROJECT_NAME [options]'
|
|
152
|
+
|
|
153
|
+
opts.separator ''
|
|
154
|
+
opts.separator 'Specific options:'
|
|
155
|
+
|
|
156
|
+
opts.on('-H', '--host NAME', 'Unity Asset Server host') do |host|
|
|
157
|
+
options[:host] = host
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
opts.on('-u', '--username NAME', 'Crendential for Unity Asset Server') do |username|
|
|
161
|
+
options[:username] = username
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
opts.on('-p', '--password PASSWD') do |password|
|
|
165
|
+
options[:password] = password
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
opts.separator ''
|
|
169
|
+
|
|
170
|
+
# No argument, shows at tail. This will print an options summary.
|
|
171
|
+
# Try it and see!
|
|
172
|
+
opts.on_tail('-h', '--help', 'Show this message') do
|
|
173
|
+
puts opts
|
|
174
|
+
exit
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
@opts.parse! args
|
|
179
|
+
options
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def show_help_message(msg)
|
|
183
|
+
puts "Error starting script: #{msg}\n\n"
|
|
184
|
+
puts @opts.help
|
|
185
|
+
exit
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
end
|
data/lib/uas2git/uas.rb
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
require 'active_record'
|
|
2
|
+
require 'safe_attributes/base'
|
|
3
|
+
|
|
4
|
+
module Uas2Git
|
|
5
|
+
module Uas
|
|
6
|
+
module Model
|
|
7
|
+
class Asset < ActiveRecord::Base
|
|
8
|
+
self.table_name = 'asset'
|
|
9
|
+
self.primary_key = 'serial'
|
|
10
|
+
|
|
11
|
+
has_many :versions, :class_name => 'AssetVersion', :primary_key => 'serial', :foreign_key => 'asset'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class AssetContents < ActiveRecord::Base
|
|
15
|
+
self.table_name = 'assetcontents'
|
|
16
|
+
self.primary_key = [ 'assetversion', 'tag' ]
|
|
17
|
+
|
|
18
|
+
belongs_to :asset_version, :class_name => 'AssetVersion', :primary_key => 'serial', :foreign_key => 'assetversion'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class AssetType < ActiveRecord::Base
|
|
22
|
+
self.table_name = 'assettype'
|
|
23
|
+
self.primary_key = 'serial'
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
class AssetVersion < ActiveRecord::Base
|
|
27
|
+
self.table_name = 'assetversion'
|
|
28
|
+
self.primary_key = 'serial'
|
|
29
|
+
|
|
30
|
+
belongs_to :asset, :class_name => 'Asset', :primary_key => 'serial', :foreign_key => 'asset'
|
|
31
|
+
belongs_to :parent, :class_name => 'Asset', :primary_key => 'serial', :foreign_key => 'parent'
|
|
32
|
+
belongs_to :created_in, :class_name => 'Changeset', :primary_key => 'serial', :foreign_key => 'created_in'
|
|
33
|
+
belongs_to :type, :class_name => 'AssetType', :primary_key => 'serial', :foreign_key => 'assettype'
|
|
34
|
+
has_many :contents, :class_name => 'AssetContents', :primary_key => 'serial', :foreign_key => 'assetversion'
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
class Changeset < ActiveRecord::Base
|
|
38
|
+
include SafeAttributes::Base
|
|
39
|
+
|
|
40
|
+
bad_attribute_names :my_attr
|
|
41
|
+
validates_presence_of :my_attr
|
|
42
|
+
|
|
43
|
+
self.table_name = 'changeset'
|
|
44
|
+
self.primary_key = 'serial'
|
|
45
|
+
|
|
46
|
+
has_many :contents, :class_name => 'ChangesetContents', :foreign_key => 'changeset'
|
|
47
|
+
has_many :asset_versions, :through => :contents
|
|
48
|
+
|
|
49
|
+
belongs_to :creator, :class_name => 'Person', :primary_key => 'serial', :foreign_key => 'creator'
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
class ChangesetContents < ActiveRecord::Base
|
|
53
|
+
self.table_name = 'changesetcontents'
|
|
54
|
+
|
|
55
|
+
belongs_to :changeset, :foreign_key => 'changeset'
|
|
56
|
+
belongs_to :asset_version, :foreign_key => 'assetversion'
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
class Person < ActiveRecord::Base
|
|
60
|
+
self.table_name = 'person'
|
|
61
|
+
self.primary_key = 'serial'
|
|
62
|
+
|
|
63
|
+
has_many :changesets, :foreign_key => 'creator'
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
data/lib/uas2git.rb
ADDED
data/uas2git.gemspec
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'uas2git/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = 'uas2git'
|
|
8
|
+
spec.version = UAS2Git::VERSION
|
|
9
|
+
spec.authors = ['Toru Nayuki']
|
|
10
|
+
spec.email = ['tnayuki@icloud.com']
|
|
11
|
+
spec.summary = 'A tool for migrating Unity Asset Server projects to git'
|
|
12
|
+
spec.homepage = 'https://github.com/tnayuki/uas2git'
|
|
13
|
+
spec.license = 'MIT'
|
|
14
|
+
|
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
18
|
+
spec.require_paths = ['lib']
|
|
19
|
+
|
|
20
|
+
spec.add_runtime_dependency 'activerecord'
|
|
21
|
+
spec.add_runtime_dependency 'rugged'
|
|
22
|
+
spec.add_runtime_dependency 'pg'
|
|
23
|
+
spec.add_runtime_dependency 'progress'
|
|
24
|
+
spec.add_runtime_dependency 'safe_attributes'
|
|
25
|
+
|
|
26
|
+
spec.add_development_dependency 'bundler', '~> 1.5'
|
|
27
|
+
spec.add_development_dependency 'rake'
|
|
28
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: uas2git
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.9.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Toru Nayuki
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-02-13 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: activerecord
|
|
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: rugged
|
|
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: pg
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - '>='
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :runtime
|
|
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: progress
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - '>='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - '>='
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: safe_attributes
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - '>='
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - '>='
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: bundler
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ~>
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '1.5'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ~>
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '1.5'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: rake
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - '>='
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - '>='
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
111
|
+
description:
|
|
112
|
+
email:
|
|
113
|
+
- tnayuki@icloud.com
|
|
114
|
+
executables:
|
|
115
|
+
- uas2git
|
|
116
|
+
extensions: []
|
|
117
|
+
extra_rdoc_files: []
|
|
118
|
+
files:
|
|
119
|
+
- .gitignore
|
|
120
|
+
- Gemfile
|
|
121
|
+
- LICENSE.txt
|
|
122
|
+
- README.md
|
|
123
|
+
- Rakefile
|
|
124
|
+
- Vagrantfile
|
|
125
|
+
- bin/uas2git
|
|
126
|
+
- lib/uas2git.rb
|
|
127
|
+
- lib/uas2git/migration.rb
|
|
128
|
+
- lib/uas2git/uas.rb
|
|
129
|
+
- lib/uas2git/version.rb
|
|
130
|
+
- uas2git.gemspec
|
|
131
|
+
homepage: https://github.com/tnayuki/uas2git
|
|
132
|
+
licenses:
|
|
133
|
+
- MIT
|
|
134
|
+
metadata: {}
|
|
135
|
+
post_install_message:
|
|
136
|
+
rdoc_options: []
|
|
137
|
+
require_paths:
|
|
138
|
+
- lib
|
|
139
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
140
|
+
requirements:
|
|
141
|
+
- - '>='
|
|
142
|
+
- !ruby/object:Gem::Version
|
|
143
|
+
version: '0'
|
|
144
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
|
+
requirements:
|
|
146
|
+
- - '>='
|
|
147
|
+
- !ruby/object:Gem::Version
|
|
148
|
+
version: '0'
|
|
149
|
+
requirements: []
|
|
150
|
+
rubyforge_project:
|
|
151
|
+
rubygems_version: 2.0.14
|
|
152
|
+
signing_key:
|
|
153
|
+
specification_version: 4
|
|
154
|
+
summary: A tool for migrating Unity Asset Server projects to git
|
|
155
|
+
test_files: []
|