sq_mini_racer 0.3.1.0.0 → 0.3.1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5a4f1dcba4f3dd9929c02a63a4ca5e123626c670aec78dd1bd99e045b4406ef
4
- data.tar.gz: 162ccdbc01829df6b722e885d6242c17764373b66d5610287a7604d6dcf9dbc1
3
+ metadata.gz: d8ffbedb494b5384038b21e205060ab0ef1a56a852cdab5904b3462952af6206
4
+ data.tar.gz: b9d185c49effc232ff2f6bd31e5475f9c4e6a05f5de81b35619ee0c16045dec3
5
5
  SHA512:
6
- metadata.gz: b3182e0f36469dbc4a2d5a254c879f7bfb51d1dd2abe903284cb9aefaecc8743fdd16408dec1ae58ab61e90b1e19c61152dbc80ed4d9c92f550684469c80e2b9
7
- data.tar.gz: ab44723c482430200ffc20a127cc27672020de03a22e1edd84a42212166742dbe006173951bd345a0f76437ab6186cb5078faa7de2b5d6d41d27df8a0c2f3109
6
+ metadata.gz: 7dfc7a570a835dc0231f451ac9016e49be96ed2ef59e940df3eb0911e1df9921cce4b0da739a0e100e5c8ae4cc6122ecf417a851a2661586aea892b2f52e204d
7
+ data.tar.gz: fac74a6bd2be1e22956e6575e1787c1e42de977c0e1065b564f13bf7e1fa33075b2db4b2c306fc4f14f816ccd196673a6e7bbf998d7a12cf7a3888d0095c5a3d
@@ -64,6 +64,6 @@ jobs:
64
64
 
65
65
  - template: azure-template.yml
66
66
  parameters:
67
- name: macos_10_14
68
- displayName: MacOS 10.14
69
- imageName: 'macos-10.14'
67
+ name: macos_10_15
68
+ displayName: MacOS 10.15
69
+ imageName: 'macos-10.15'
@@ -29,49 +29,52 @@ def libv8_gem_name
29
29
  'libv8-node'
30
30
  end
31
31
 
32
- def libv8_version
33
- '14.14.0.0.beta2'
32
+ def libv8_requirement
33
+ '~> 14.14.0.0.beta1'
34
34
  end
35
35
 
36
- def libv8_basename
37
- "#{libv8_gem_name}-#{libv8_version}-#{ruby_platform}"
36
+ def libv8_basename(version)
37
+ "#{libv8_gem_name}-#{version}-#{ruby_platform}"
38
38
  end
39
39
 
40
- def libv8_gemspec_no_libc
41
- platform_no_libc = ruby_platform.to_s.split('-')[0..1].join('-')
42
- "#{libv8_gem_name}-#{libv8_version}-#{platform_no_libc}.gemspec"
43
- end
44
-
45
- def libv8_gemspec
46
- "#{libv8_basename}.gemspec"
40
+ def libv8_gemspec(version)
41
+ "#{libv8_basename(version)}.gemspec"
47
42
  end
48
43
 
49
44
  def libv8_local_path(path=Gem.path)
50
- gemspecs = [libv8_gemspec, libv8_gemspec_no_libc].uniq
51
- puts "looking for #{gemspecs.join(', ')} in installed gems"
52
- candidates = path.product(gemspecs)
53
- .map { |(p, gemspec)| File.join(p, 'specifications', gemspec) }
54
- p candidates
55
- found = candidates.select { |f| File.exist?(f) }.first
56
-
57
- unless found
58
- puts "#{gemspecs.join(', ')} not found in installed gems"
45
+ name_glob = "#{libv8_gem_name}-*-#{ruby_platform}"
46
+
47
+ puts "looking for #{name_glob} in #{path.inspect}"
48
+
49
+ paths = path.map { |p| Dir.glob(File.join(p, 'specifications', name_glob + '.gemspec')) }.flatten
50
+
51
+ if paths.empty?
52
+ puts "#{name_glob} not found in #{path.inspect}"
53
+ return
54
+ end
55
+
56
+ specs = paths.map { |p| [p, eval(File.read(p))] }
57
+ .select { |_, spec| Gem::Requirement.new(libv8_requirement).satisfied_by?(spec.version) }
58
+ found_path, found_spec = specs.sort_by { |_, spec| spec.version }.last
59
+
60
+ unless found_path && found_spec
61
+ puts "not found in specs: no '#{libv8_requirement}' in #{paths.inspect}"
59
62
  return
60
63
  end
61
64
 
62
- puts "found in installed specs: #{found}"
65
+ puts "found in specs: #{found_path}"
63
66
 
64
- gemdir = File.basename(found, '.gemspec')
65
- dir = File.expand_path(File.join(found, '..', '..', 'gems', gemdir))
67
+ gemdir = File.basename(found_path, '.gemspec')
68
+ dir = File.expand_path(File.join(found_path, '..', '..', 'gems', gemdir))
66
69
 
67
70
  unless Dir.exist?(dir)
68
- puts "not found in installed gems: #{dir}"
71
+ puts "not found in gems: #{dir}"
69
72
  return
70
73
  end
71
74
 
72
- puts "found in installed gems: #{dir}"
75
+ puts "found in gems: #{dir}"
73
76
 
74
- dir
77
+ [dir, found_spec]
75
78
  end
76
79
 
77
80
  def vendor_path
@@ -79,25 +82,12 @@ def vendor_path
79
82
  end
80
83
 
81
84
  def libv8_vendor_path
82
- puts "looking for #{libv8_basename} in #{vendor_path}"
83
- path = Dir.glob("#{vendor_path}/#{libv8_basename}").first
84
-
85
- unless path
86
- puts "#{libv8_basename} not found in #{vendor_path}"
87
- return
88
- end
89
-
90
- puts "looking for #{libv8_basename}/lib/libv8-node.rb in #{vendor_path}"
91
- unless Dir.glob(File.join(vendor_path, libv8_basename, 'lib', 'libv8-node.rb')).first
92
- puts "#{libv8_basename}/lib/libv8.rb not found in #{vendor_path}"
93
- return
94
- end
95
-
96
- path
85
+ libv8_local_path([vendor_path])
97
86
  end
98
87
 
99
88
  def parse_platform(str)
100
89
  Gem::Platform.new(str).tap do |p|
90
+ p.instance_eval { @version = 'musl' } if str =~ /-musl/ && p.version.nil?
101
91
  p.instance_eval { @cpu = 'x86_64' } if str =~ /universal.*darwin/
102
92
  end
103
93
  end
@@ -121,21 +111,23 @@ def libv8_remote_search
121
111
  json = JSON.parse(body)
122
112
 
123
113
  versions = json.select do |v|
124
- Gem::Version.new(v['number']) == Gem::Version.new(libv8_version)
114
+ Gem::Requirement.new(libv8_requirement).satisfied_by?(Gem::Version.new(v['number']))
125
115
  end
126
116
  abort(<<-ERROR) if versions.empty?
127
- ERROR: could not find #{libv8_gem_name} (version #{libv8_version}) in rubygems.org
117
+ ERROR: could not find #{libv8_gem_name} (requirement #{libv8_requirement}) in rubygems.org
128
118
  ERROR
129
119
 
130
120
  platform_versions = versions.select do |v|
131
121
  parse_platform(v['platform']) == ruby_platform unless v['platform'] =~ /universal.*darwin/
132
122
  end
133
123
  abort(<<-ERROR) if platform_versions.empty?
134
- ERROR: found #{libv8_gem_name}-#{libv8_version}, but no binary for #{ruby_platform}
135
- try "gem install #{libv8_gem_name} -v '#{libv8_version}'" to attempt to build libv8 from source
124
+ ERROR: found gems matching #{libv8_gem_name}:'#{libv8_requirement}', but no binary for #{ruby_platform}
125
+ try "gem install #{libv8_gem_name}:'#{libv8_requirement}'" to attempt to build #{libv8_gem_name} from source
136
126
  ERROR
137
127
 
138
- platform_versions.first
128
+ puts "found #{libv8_gem_name} for #{ruby_platform} on rubygems: #{platform_versions.map { |v| v['number'] }.join(', ')}"
129
+
130
+ platform_versions.sort_by { |v| Gem::Version.new(v['number']) }.last
139
131
  end
140
132
 
141
133
  def libv8_download_uri(name, version, platform)
@@ -147,19 +139,19 @@ def libv8_downloaded_gem(name, version, platform)
147
139
  end
148
140
 
149
141
  def libv8_download(name, version, platform)
150
- FileUtils.mkdir_p(vendor_path)
142
+ FileUtils.mkdir_p(File.join(vendor_path, 'cache'))
151
143
  body = http_get(libv8_download_uri(name, version, platform))
152
- File.open(File.join(vendor_path, libv8_downloaded_gem(name, version, platform)), 'wb') { |f| f.write(body) }
144
+ File.open(File.join(vendor_path, 'cache', libv8_downloaded_gem(name, version, platform)), 'wb') { |f| f.write(body) }
153
145
  end
154
146
 
155
147
  def libv8_install!
156
- cmd = "gem install #{libv8_gem_name} --version '#{libv8_version}' --install-dir '#{vendor_path}'"
148
+ cmd = "gem install #{libv8_gem_name} --version '#{libv8_requirement}' --install-dir '#{vendor_path}'"
157
149
  puts "installing #{libv8_gem_name} using `#{cmd}`"
158
150
  rc = system(cmd)
159
151
 
160
152
  abort(<<-ERROR) unless rc
161
- ERROR: could not install #{libv8_gem_name} #{libv8_version}
162
- try "gem install #{libv8_gem_name} -v '#{libv8_version}'" to attempt to build libv8 from source
153
+ ERROR: could not install #{libv8_gem_name}:#{libv8_requirement}
154
+ try "gem install #{libv8_gem_name} -v '#{libv8_requirement}'" to attempt to build libv8 from source
163
155
  ERROR
164
156
 
165
157
  libv8_local_path([vendor_path])
@@ -173,18 +165,20 @@ def libv8_vendor!
173
165
  puts "downloading #{libv8_downloaded_gem(libv8_gem_name, version['number'], version['platform'])} to #{vendor_path}"
174
166
  libv8_download(libv8_gem_name, version['number'], version['platform'])
175
167
 
176
- package = Gem::Package.new(File.join(vendor_path, libv8_downloaded_gem(libv8_gem_name, version['number'], version['platform'])))
177
- package.extract_files(File.join(vendor_path, File.basename(libv8_downloaded_gem(libv8_gem_name, version['number'], version['platform']), '.gem')))
168
+ package = Gem::Package.new(File.join(vendor_path, 'cache', libv8_downloaded_gem(libv8_gem_name, version['number'], version['platform'])))
169
+ package.extract_files(File.join(vendor_path, 'gems', File.basename(libv8_downloaded_gem(libv8_gem_name, version['number'], version['platform']), '.gem')))
170
+ FileUtils.mkdir_p(File.join(vendor_path, 'specifications'))
171
+ File.open(File.join(vendor_path, 'specifications', File.basename(libv8_downloaded_gem(libv8_gem_name, version['number'], version['platform']), '.gem') + '.gemspec'), 'wb') { |f| f.write(package.spec.to_ruby) }
178
172
 
179
173
  libv8_vendor_path
180
174
  end
181
175
 
182
176
  def ensure_libv8_load_path
183
- puts "detected platform #{RUBY_PLATFORM} => #{ruby_platform}"
177
+ puts "platform ruby:#{RUBY_PLATFORM} rubygems:#{Gem::Platform.new(RUBY_PLATFORM)} detected:#{ruby_platform}"
184
178
 
185
- libv8_path = libv8_local_path
186
- unless ENV['ONLY_INSTALLED_LIBV8_GEM']
187
- libv8_path ||= libv8_vendor_path || libv8_vendor!
179
+ libv8_path, spec = libv8_local_path
180
+ if !ENV['ONLY_INSTALLED_LIBV8_GEM'] && !libv8_path
181
+ libv8_path, spec = libv8_vendor_path || libv8_vendor!
188
182
  end
189
183
 
190
184
  abort(<<-ERROR) unless libv8_path
@@ -2,6 +2,6 @@ module Sqreen
2
2
  module MiniRacer
3
3
  # first three numbers is the upstream version
4
4
  # that we last merged with
5
- VERSION = "0.3.1.0.0"
5
+ VERSION = "0.3.1.0.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sq_mini_racer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1.0.0
4
+ version: 0.3.1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Saffron
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-02 00:00:00.000000000 Z
11
+ date: 2020-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -138,10 +138,10 @@ licenses:
138
138
  - MIT
139
139
  metadata:
140
140
  bug_tracker_uri: https://github.com/discourse/mini_racer/issues
141
- changelog_uri: https://github.com/discourse/mini_racer/blob/v0.3.1.0.0/CHANGELOG
142
- documentation_uri: https://www.rubydoc.info/gems/mini_racer/0.3.1.0.0
143
- source_code_uri: https://github.com/discourse/mini_racer/tree/v0.3.1.0.0
144
- post_install_message:
141
+ changelog_uri: https://github.com/discourse/mini_racer/blob/v0.3.1.0.1/CHANGELOG
142
+ documentation_uri: https://www.rubydoc.info/gems/mini_racer/0.3.1.0.1
143
+ source_code_uri: https://github.com/discourse/mini_racer/tree/v0.3.1.0.1
144
+ post_install_message:
145
145
  rdoc_options: []
146
146
  require_paths:
147
147
  - lib
@@ -157,8 +157,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0'
159
159
  requirements: []
160
- rubygems_version: 3.1.2
161
- signing_key:
160
+ rubygems_version: 3.1.3
161
+ signing_key:
162
162
  specification_version: 4
163
163
  summary: Minimal embedded v8 for Ruby
164
164
  test_files: []