p4ruby 1.0.11 → 2012.1Beta
Sign up to get free protection for your applications and to get access to all the features.
- data/install.rb +66 -35
- data/p4ruby.gemspec +3 -2
- metadata +53 -49
data/install.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author: James M. Lawrence <quixoticsycophant@gmail.com>.
|
3
3
|
#
|
4
|
+
#Updated by Brett Bates and Jennifer Bottom.
|
4
5
|
|
5
6
|
require 'net/ftp'
|
6
7
|
require 'rbconfig'
|
@@ -8,6 +9,7 @@ require 'ostruct'
|
|
8
9
|
require 'fileutils'
|
9
10
|
require 'optparse'
|
10
11
|
require 'pathname'
|
12
|
+
require 'rubygems'
|
11
13
|
|
12
14
|
class Installer
|
13
15
|
include FileUtils
|
@@ -112,6 +114,11 @@ class Installer
|
|
112
114
|
raise "error: ruby must be configured with --enable-shared"
|
113
115
|
end
|
114
116
|
|
117
|
+
@s.ftp = Net::FTP.new(SERVER).tap { |t|
|
118
|
+
t.passive = true
|
119
|
+
t.login
|
120
|
+
}
|
121
|
+
|
115
122
|
@s.p4api = LazyStruct.new.tap { |t|
|
116
123
|
t.basename = P4API_REMOTE_BASENAME
|
117
124
|
}
|
@@ -122,46 +129,36 @@ class Installer
|
|
122
129
|
|
123
130
|
@s.specs = [ @s.p4ruby, @s.p4api ]
|
124
131
|
@s.specs.each { |spec|
|
125
|
-
spec.
|
126
|
-
DISTFILES_DIR + spec.basename
|
127
|
-
}
|
132
|
+
spec.local = DISTFILES_DIR + spec.basename
|
128
133
|
}
|
129
134
|
|
130
|
-
unless @s.
|
131
|
-
@s.
|
132
|
-
guess_platform
|
133
|
-
}
|
135
|
+
unless @s.version
|
136
|
+
@s.version = latest_version
|
134
137
|
end
|
135
138
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
139
|
+
@s.version_dir = SERVER_TOP_DIR + "r#{@s.version}"
|
140
|
+
|
141
|
+
unless @s.platform
|
142
|
+
@s.platform = guess_platform
|
140
143
|
end
|
141
144
|
|
142
|
-
@s.
|
143
|
-
|
144
|
-
|
145
|
+
if @s.platform =~ /nt/
|
146
|
+
@s.p4api.remote = @s.version_dir + "bin.#{@s.platform}"
|
147
|
+
else
|
148
|
+
@s.p4api.remote = @s.version_dir + "bin.#{@s.platform}" + @s.p4api.basename
|
149
|
+
@s.p4ruby.remote = @s.version_dir + "bin.tools" + @s.p4ruby.basename
|
150
|
+
end
|
145
151
|
|
146
|
-
@s.p4api.attribute(:remote) {
|
147
|
-
@s.version_dir + "bin.#{@s.platform}" + @s.p4api.basename
|
148
|
-
}
|
149
|
-
@s.p4ruby.attribute(:remote) {
|
150
|
-
@s.version_dir + "bin.tools" + @s.p4ruby.basename
|
151
|
-
}
|
152
152
|
|
153
|
-
@s.attribute(:ftp) {
|
154
|
-
Net::FTP.new(SERVER).tap { |t|
|
155
|
-
t.passive = true
|
156
|
-
t.login
|
157
|
-
}
|
158
|
-
}
|
159
153
|
end
|
160
154
|
|
161
155
|
def guess_cpu
|
162
156
|
if CONFIG["target_os"] =~ %r!darwin!
|
163
|
-
|
164
|
-
|
157
|
+
if CONFIG["build"] =~ /i686|x86_64/
|
158
|
+
"x86_64"
|
159
|
+
else
|
160
|
+
"x86"
|
161
|
+
end
|
165
162
|
else
|
166
163
|
case CONFIG["target_cpu"]
|
167
164
|
when %r!ia!i
|
@@ -183,11 +180,17 @@ class Installer
|
|
183
180
|
version = match.captures.join
|
184
181
|
cpu = guess_cpu
|
185
182
|
platforms = self.platforms
|
186
|
-
(0..version.to_i).map { |n|
|
183
|
+
built_platforms = (0..version.to_i).map { |n|
|
187
184
|
[os, n.to_s, cpu].join
|
188
185
|
}.select { |platform|
|
189
186
|
platforms.include? platform
|
190
|
-
}
|
187
|
+
}
|
188
|
+
if os =~ /darwin/
|
189
|
+
built_platforms.pop
|
190
|
+
built_platforms.last
|
191
|
+
else
|
192
|
+
built_platforms.last
|
193
|
+
end
|
191
194
|
else
|
192
195
|
nil
|
193
196
|
end
|
@@ -299,7 +302,15 @@ class Installer
|
|
299
302
|
end
|
300
303
|
|
301
304
|
def latest_version
|
302
|
-
versions.
|
305
|
+
versions.reverse_each{ |v|
|
306
|
+
begin
|
307
|
+
remote_files_matching("#{SERVER_TOP_DIR}/r#{v}/bin.tools",/p4ruby/) do
|
308
|
+
return v
|
309
|
+
end
|
310
|
+
rescue
|
311
|
+
next
|
312
|
+
end
|
313
|
+
}
|
303
314
|
end
|
304
315
|
|
305
316
|
def make(*args)
|
@@ -372,6 +383,21 @@ class Installer
|
|
372
383
|
end
|
373
384
|
end
|
374
385
|
|
386
|
+
def find_ruby_version(spec)
|
387
|
+
remote_files_matching(spec.remote, /p4ruby\d\d.exe/) {|r_ver|
|
388
|
+
|
389
|
+
#Find the latest version of p4ruby for this version of ruby
|
390
|
+
v_max = CONFIG["MAJOR"]
|
391
|
+
v_min = CONFIG["MINOR"]
|
392
|
+
version = [v_max, v_min].join
|
393
|
+
if r_ver.to_s =~ /p4ruby#{version}.exe/
|
394
|
+
return "p4ruby#{version}.exe"
|
395
|
+
end
|
396
|
+
|
397
|
+
}
|
398
|
+
nil
|
399
|
+
end
|
400
|
+
|
375
401
|
def windows_install
|
376
402
|
#
|
377
403
|
# For Windows, p4ruby is located in the p4api directory on the
|
@@ -379,8 +405,12 @@ class Installer
|
|
379
405
|
#
|
380
406
|
spec = @s.p4api
|
381
407
|
|
382
|
-
|
383
|
-
spec.
|
408
|
+
p4ruby_exe = find_ruby_version(spec)
|
409
|
+
if p4ruby_exe && !(spec.remote.to_s =~ /p4ruby/)
|
410
|
+
spec.remote += p4ruby_exe.to_s
|
411
|
+
else
|
412
|
+
abort("Failed to find a suitable p4ruby executable for ruby #{CONFIG["MAJOR"]}.#{CONFIG["MINOR"]}")
|
413
|
+
end
|
384
414
|
fetch_spec(spec)
|
385
415
|
|
386
416
|
error = lambda {
|
@@ -390,12 +420,13 @@ class Installer
|
|
390
420
|
}
|
391
421
|
|
392
422
|
puts "running Perforce P4Ruby Windows installer..."
|
393
|
-
if system(spec.local, "/S", "/v/qn")
|
423
|
+
if system(spec.local.to_s, "/S", "/v", "/qn")
|
394
424
|
if @s.gem_config
|
395
425
|
sleep(1)
|
396
426
|
raw_install_to_gem_install
|
397
427
|
sleep(1)
|
398
|
-
|
428
|
+
#Without the -x flag a permissions error raised on Windows.
|
429
|
+
unless system(spec.local, "/V", "/S", "/x", "/v/qn")
|
399
430
|
# We don't much care if this fails; just write to the log
|
400
431
|
puts "Note: the Perforce P4Ruby Windows uninstaller failed."
|
401
432
|
end
|
data/p4ruby.gemspec
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
|
2
2
|
Gem::Specification.new { |t|
|
3
3
|
t.name = "p4ruby"
|
4
|
-
t.version = "
|
4
|
+
t.version = "2012.1Beta"
|
5
5
|
t.summary = "Ruby interface to the Perforce API"
|
6
6
|
t.description = t.summary + "."
|
7
7
|
t.author = "Perforce Software (ruby gem by James M. Lawrence)"
|
8
|
-
t.email = "
|
8
|
+
t.email = "p4ruby@perforce.com"
|
9
9
|
t.homepage = "http://p4ruby.rubyforge.org"
|
10
10
|
t.rubyforge_project = "p4ruby"
|
11
11
|
t.extensions << "Rakefile"
|
12
12
|
t.add_dependency "rake"
|
13
|
+
t.add_dependency "rdoc"
|
13
14
|
t.require_paths << "ext"
|
14
15
|
|
15
16
|
t.files = %w[
|
metadata
CHANGED
@@ -1,57 +1,67 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: p4ruby
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 0
|
8
|
-
- 11
|
9
|
-
version: 1.0.11
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2012.1Beta
|
5
|
+
prerelease: 6
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Perforce Software (ruby gem by James M. Lawrence)
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-05-03 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
22
23
|
prerelease: false
|
23
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
25
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rdoc
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
31
38
|
type: :runtime
|
32
|
-
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
33
46
|
description: Ruby interface to the Perforce API.
|
34
|
-
email:
|
47
|
+
email: p4ruby@perforce.com
|
35
48
|
executables: []
|
36
|
-
|
37
|
-
extensions:
|
49
|
+
extensions:
|
38
50
|
- Rakefile
|
39
|
-
extra_rdoc_files:
|
51
|
+
extra_rdoc_files:
|
40
52
|
- README
|
41
|
-
files:
|
53
|
+
files:
|
42
54
|
- README
|
43
55
|
- CHANGES
|
44
56
|
- Rakefile
|
45
57
|
- install.rb
|
46
58
|
- p4ruby.gemspec
|
47
|
-
has_rdoc: true
|
48
59
|
homepage: http://p4ruby.rubyforge.org
|
49
60
|
licenses: []
|
50
|
-
|
51
61
|
post_install_message:
|
52
|
-
rdoc_options:
|
62
|
+
rdoc_options:
|
53
63
|
- --title
|
54
|
-
-
|
64
|
+
- ! 'P4Ruby: Ruby interface to the Perforce API'
|
55
65
|
- --main
|
56
66
|
- README
|
57
67
|
- --exclude
|
@@ -62,31 +72,25 @@ rdoc_options:
|
|
62
72
|
- install.rb
|
63
73
|
- --exclude
|
64
74
|
- p4ruby.gemspec
|
65
|
-
require_paths:
|
75
|
+
require_paths:
|
66
76
|
- lib
|
67
77
|
- ext
|
68
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
79
|
none: false
|
70
|
-
requirements:
|
71
|
-
- -
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
|
74
|
-
|
75
|
-
version: "0"
|
76
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
85
|
none: false
|
78
|
-
requirements:
|
79
|
-
- -
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
|
82
|
-
- 0
|
83
|
-
version: "0"
|
86
|
+
requirements:
|
87
|
+
- - ! '>'
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.3.1
|
84
90
|
requirements: []
|
85
|
-
|
86
91
|
rubyforge_project: p4ruby
|
87
|
-
rubygems_version: 1.
|
92
|
+
rubygems_version: 1.8.25
|
88
93
|
signing_key:
|
89
94
|
specification_version: 3
|
90
95
|
summary: Ruby interface to the Perforce API
|
91
96
|
test_files: []
|
92
|
-
|