six-updater 0.17.1-x86-mswin32
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.
- data/LICENSE +674 -0
- data/README +3 -0
- data/Rakefile +109 -0
- data/bin/six-updater +17 -0
- data/lib/six/updater-app.rb +91 -0
- data/lib/six/updater.rb +440 -0
- data/lib/six/updater/gitrepo.rb +112 -0
- data/lib/six/updater/mod.rb +348 -0
- data/lib/six/updater/options.rb +126 -0
- data/lib/six/updater/rsyncrepo.rb +73 -0
- metadata +155 -0
@@ -0,0 +1,126 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Docu: http://www.ruby-doc.org/stdlib/libdoc/optparse/rdoc/classes/OptionParser.html
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
module Six
|
7
|
+
module Updater
|
8
|
+
module_function
|
9
|
+
def parse_options
|
10
|
+
todo, general_todo, second_todo = [], [], []
|
11
|
+
|
12
|
+
options = Hash.new
|
13
|
+
OptionParser.new do |opts|
|
14
|
+
$0[/.*\/(.*)/]
|
15
|
+
opts.banner = "Usage: #{$1} [config.yml] [options]"
|
16
|
+
|
17
|
+
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
|
18
|
+
options[:verbose] = v
|
19
|
+
end
|
20
|
+
|
21
|
+
opts.on("-i", "--install", "Installs the mods, unless already installed") do |bool|
|
22
|
+
todo << :install if bool
|
23
|
+
end
|
24
|
+
|
25
|
+
opts.on("-d", "--uninstall", "Uninstalls the mods, unless not installed") do |bool|
|
26
|
+
todo << :uninstall if bool
|
27
|
+
end
|
28
|
+
|
29
|
+
opts.on("-u", "--update", "Updates each mod to latest version") do |bool|
|
30
|
+
todo << :update if bool
|
31
|
+
end
|
32
|
+
|
33
|
+
opts.on("-r", "--reset", "Resets the modfolders to latest commit status. All modifications lost") do |bool|
|
34
|
+
todo << :reset if bool
|
35
|
+
end
|
36
|
+
|
37
|
+
opts.on("-z", "--userconfig", "Processes the userconfigs of each mod. Makes backups of previous files") do |bool|
|
38
|
+
todo << :userconfig if bool
|
39
|
+
end
|
40
|
+
|
41
|
+
opts.on("-k", "--keys", "Processes the keys of each mod. Removes old keys automatically") do |bool|
|
42
|
+
todo << :keys if bool
|
43
|
+
end
|
44
|
+
|
45
|
+
opts.on("-l", "--changelog", "Display Changelog after update") do |bool|
|
46
|
+
second_todo << :changelog if bool
|
47
|
+
end
|
48
|
+
|
49
|
+
opts.on("-c", "--cleanup", "Cleans up the modfolders git repositories") do |bool|
|
50
|
+
second_todo << :cleanup if bool
|
51
|
+
end
|
52
|
+
|
53
|
+
opts.on("-s", "--createshortcut", "Creates shortcut to run the game with the mods, in installation folder") do |bool|
|
54
|
+
general_todo << :createshortcut if bool
|
55
|
+
end
|
56
|
+
|
57
|
+
opts.on("-t", "--createdesktopshortcut", "Creates shortcut to run the game with the mods, on the desktop") do |bool|
|
58
|
+
general_todo << :createdesktopshortcut if bool
|
59
|
+
end
|
60
|
+
|
61
|
+
opts.on("-j", "--join", "Starts the game with #{@config[:app_params]} -mod=#{@mods} -connect=#{@config[:server][:address]} -port=#{@config[:server][:port]}") do |bool|
|
62
|
+
general_todo << :joingame if bool
|
63
|
+
end
|
64
|
+
|
65
|
+
opts.on("-g", "--startgame", "Starts the game with #{@config[:app_params]} -mod=#{@mods}") do |bool|
|
66
|
+
general_todo << :startgame if bool
|
67
|
+
end
|
68
|
+
|
69
|
+
opts.on("-w", "--wait", "Waits at the end for user pressing ENTER") do |bool|
|
70
|
+
options[:wait] = bool
|
71
|
+
end
|
72
|
+
|
73
|
+
opts.on("-f", "--force", "Forces to run tasks even though no changes were detected") do |bool|
|
74
|
+
options[:force] = bool
|
75
|
+
end
|
76
|
+
|
77
|
+
opts.on("--mods S", String, "Additional Mods") do |s|
|
78
|
+
options[:mods] = s
|
79
|
+
end
|
80
|
+
|
81
|
+
opts.on("--apppath S", String, "Destination folder") do |s|
|
82
|
+
options[:app_path] = s
|
83
|
+
end
|
84
|
+
end.parse!
|
85
|
+
|
86
|
+
default = if (todo + second_todo + general_todo).size > 0
|
87
|
+
false
|
88
|
+
else
|
89
|
+
true
|
90
|
+
end
|
91
|
+
|
92
|
+
# TODO: Move this to Updater ?
|
93
|
+
@todo = if todo.size > 0
|
94
|
+
todo
|
95
|
+
else
|
96
|
+
log.info "No parameters given, running the default"
|
97
|
+
#options[:wait] = true
|
98
|
+
if default
|
99
|
+
@config[:defaultactions]
|
100
|
+
else
|
101
|
+
[]
|
102
|
+
end
|
103
|
+
end
|
104
|
+
@general_todo = if general_todo.size > 0
|
105
|
+
general_todo
|
106
|
+
else
|
107
|
+
if default
|
108
|
+
@config[:defaultgeneralactions]
|
109
|
+
else
|
110
|
+
[]
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
@second_todo = if second_todo.size > 0
|
115
|
+
second_todo
|
116
|
+
else
|
117
|
+
if default
|
118
|
+
@config[:defaultsecondactions]
|
119
|
+
else
|
120
|
+
[]
|
121
|
+
end
|
122
|
+
end
|
123
|
+
@config = @config.merge(options)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module Six
|
4
|
+
module Updater
|
5
|
+
class RsyncRepo
|
6
|
+
def initialize(repositories, path, depth = 1)
|
7
|
+
@repositories = repositories
|
8
|
+
@path = path
|
9
|
+
@changed = false
|
10
|
+
@installed = false
|
11
|
+
end
|
12
|
+
|
13
|
+
def log
|
14
|
+
Six::Updater.log
|
15
|
+
end
|
16
|
+
|
17
|
+
def version
|
18
|
+
f = File.join(@path, '.rsync', '.pack', '.repository.yml')
|
19
|
+
if FileTest.exist?(f)
|
20
|
+
File.open(f) {|file| YAML::load(file)[:version] }
|
21
|
+
else
|
22
|
+
nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def open(opts = {})
|
27
|
+
repository(opts)
|
28
|
+
end
|
29
|
+
|
30
|
+
def reset(opts = {})
|
31
|
+
repository.reset(opts)
|
32
|
+
end
|
33
|
+
|
34
|
+
def status(force = false)
|
35
|
+
[]
|
36
|
+
end
|
37
|
+
|
38
|
+
def repository(opts = {:log => log})
|
39
|
+
@repository || Six::Repositories::Rsync.open(@path, opts)
|
40
|
+
end
|
41
|
+
|
42
|
+
def clone(opts = {})
|
43
|
+
done = false
|
44
|
+
@path[/(.*)\/(.*)/]
|
45
|
+
opts = {:path => $1, :depth => @depth, :log => log}
|
46
|
+
#begin
|
47
|
+
@repository = Rsync.clone(@repositories, $2, opts)
|
48
|
+
# FIXME: Update needs to be fixed
|
49
|
+
done = true
|
50
|
+
# rescue
|
51
|
+
# log.warn "WARNING: Failed, was unable to clone!" unless done
|
52
|
+
#log.debug "WARNING: Failed, trying other mirrors if available"
|
53
|
+
# end
|
54
|
+
done
|
55
|
+
end
|
56
|
+
|
57
|
+
def update(opts = {})
|
58
|
+
cfg = nil
|
59
|
+
File.open(File.join(@path, '.rsync/config.yml')) { |file| cfg = YAML::load(file) }
|
60
|
+
cfg[:hosts] = @repositories
|
61
|
+
File.open(File.join(@path, '.rsync/config.yml'), 'w') { |file| file.puts cfg.to_yaml }
|
62
|
+
|
63
|
+
# begin
|
64
|
+
repository.update
|
65
|
+
done = true
|
66
|
+
# rescue
|
67
|
+
# log.warn "WARNING: Failed, was unable to update!" unless done
|
68
|
+
# end
|
69
|
+
done
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
metadata
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: six-updater
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 17
|
8
|
+
- 1
|
9
|
+
version: 0.17.1
|
10
|
+
platform: x86-mswin32
|
11
|
+
authors:
|
12
|
+
- Sickboy
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-04-22 00:00:00 +02:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: win32-api
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 4
|
30
|
+
- 6
|
31
|
+
version: 1.4.6
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: win32-process
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
43
|
+
- 6
|
44
|
+
- 0
|
45
|
+
version: 0.6.0
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: win32-shortcut
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 0
|
57
|
+
- 2
|
58
|
+
- 3
|
59
|
+
version: 0.2.3
|
60
|
+
type: :runtime
|
61
|
+
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: log4r
|
64
|
+
prerelease: false
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
segments:
|
70
|
+
- 1
|
71
|
+
- 1
|
72
|
+
- 2
|
73
|
+
version: 1.1.2
|
74
|
+
type: :runtime
|
75
|
+
version_requirements: *id004
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: six-uac
|
78
|
+
prerelease: false
|
79
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
segments:
|
84
|
+
- 0
|
85
|
+
- 1
|
86
|
+
- 0
|
87
|
+
version: 0.1.0
|
88
|
+
type: :runtime
|
89
|
+
version_requirements: *id005
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
name: six-rsync
|
92
|
+
prerelease: false
|
93
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
- 3
|
100
|
+
- 4
|
101
|
+
version: 0.3.4
|
102
|
+
type: :runtime
|
103
|
+
version_requirements: *id006
|
104
|
+
description: Your summary here
|
105
|
+
email: sb@dev-heaven.net
|
106
|
+
executables:
|
107
|
+
- six-updater
|
108
|
+
extensions: []
|
109
|
+
|
110
|
+
extra_rdoc_files:
|
111
|
+
- README
|
112
|
+
- LICENSE
|
113
|
+
files:
|
114
|
+
- LICENSE
|
115
|
+
- README
|
116
|
+
- Rakefile
|
117
|
+
- bin/six-updater
|
118
|
+
- lib/six/updater/gitrepo.rb
|
119
|
+
- lib/six/updater/mod.rb
|
120
|
+
- lib/six/updater/options.rb
|
121
|
+
- lib/six/updater/rsyncrepo.rb
|
122
|
+
- lib/six/updater-app.rb
|
123
|
+
- lib/six/updater.rb
|
124
|
+
has_rdoc: true
|
125
|
+
homepage:
|
126
|
+
licenses: []
|
127
|
+
|
128
|
+
post_install_message:
|
129
|
+
rdoc_options: []
|
130
|
+
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
segments:
|
138
|
+
- 0
|
139
|
+
version: "0"
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
segments:
|
145
|
+
- 0
|
146
|
+
version: "0"
|
147
|
+
requirements: []
|
148
|
+
|
149
|
+
rubyforge_project:
|
150
|
+
rubygems_version: 1.3.6
|
151
|
+
signing_key:
|
152
|
+
specification_version: 3
|
153
|
+
summary: Your summary here
|
154
|
+
test_files: []
|
155
|
+
|