Skip to content

Commit 9251310

Browse files
byroothsbt
authored andcommitted
Merge json and json-java gemspecs
1 parent fc9f0cb commit 9251310

File tree

2 files changed

+39
-52
lines changed

2 files changed

+39
-52
lines changed

ext/json/extconf.rb

Lines changed: 0 additions & 3 deletions
This file was deleted.

ext/json/json.gemspec

Lines changed: 39 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,70 +2,60 @@ version = File.foreach(File.join(__dir__, "lib/json/version.rb")) do |line|
22
/^\s*VERSION\s*=\s*'(.*)'/ =~ line and break $1
33
end rescue nil
44

5-
Gem::Specification.new do |s|
5+
spec = Gem::Specification.new do |s|
6+
java_ext = Gem::Platform === s.platform && s.platform =~ 'java' || RUBY_ENGINE == 'jruby'
7+
68
s.name = "json"
79
s.version = version
810

911
s.summary = "JSON Implementation for Ruby"
10-
s.description = "This is a JSON implementation as a Ruby extension in C."
12+
s.homepage = "https://ruby.github.io/json"
13+
s.metadata = {
14+
'bug_tracker_uri' => 'https://github.com/ruby/json/issues',
15+
'changelog_uri' => 'https://github.com/ruby/json/blob/master/CHANGES.md',
16+
'documentation_uri' => 'https://ruby.github.io/json/doc/index.html',
17+
'homepage_uri' => s.homepage,
18+
'source_code_uri' => 'https://github.com/ruby/json',
19+
'wiki_uri' => 'https://github.com/ruby/json/wiki'
20+
}
21+
22+
s.required_ruby_version = Gem::Requirement.new(">= 2.3")
23+
24+
if java_ext
25+
s.description = "A JSON implementation as a JRuby extension."
26+
s.author = "Daniel Luz"
27+
s.email = "[email protected]"
28+
else
29+
s.description = "This is a JSON implementation as a Ruby extension in C."
30+
s.authors = ["Florian Frank"]
31+
s.email = "[email protected]"
32+
end
33+
1134
s.licenses = ["Ruby"]
12-
s.authors = ["Florian Frank"]
13-
s.email = "[email protected]"
1435

15-
s.extensions = ["ext/json/ext/generator/extconf.rb", "ext/json/ext/parser/extconf.rb", "ext/json/extconf.rb"]
1636
s.extra_rdoc_files = ["README.md"]
1737
s.rdoc_options = ["--title", "JSON implementation for Ruby", "--main", "README.md"]
38+
1839
s.files = [
1940
"CHANGES.md",
2041
"COPYING",
2142
"BSDL",
2243
"LEGAL",
2344
"README.md",
24-
"ext/json/ext/fbuffer/fbuffer.h",
25-
"ext/json/ext/generator/depend",
26-
"ext/json/ext/generator/extconf.rb",
27-
"ext/json/ext/generator/generator.c",
28-
"ext/json/ext/generator/generator.h",
29-
"ext/json/ext/parser/depend",
30-
"ext/json/ext/parser/extconf.rb",
31-
"ext/json/ext/parser/parser.c",
32-
"ext/json/ext/parser/parser.h",
33-
"ext/json/ext/parser/parser.rl",
34-
"ext/json/extconf.rb",
3545
"json.gemspec",
36-
"lib/json.rb",
37-
"lib/json/add/bigdecimal.rb",
38-
"lib/json/add/complex.rb",
39-
"lib/json/add/core.rb",
40-
"lib/json/add/date.rb",
41-
"lib/json/add/date_time.rb",
42-
"lib/json/add/exception.rb",
43-
"lib/json/add/ostruct.rb",
44-
"lib/json/add/range.rb",
45-
"lib/json/add/rational.rb",
46-
"lib/json/add/regexp.rb",
47-
"lib/json/add/set.rb",
48-
"lib/json/add/struct.rb",
49-
"lib/json/add/symbol.rb",
50-
"lib/json/add/time.rb",
51-
"lib/json/common.rb",
52-
"lib/json/ext.rb",
53-
"lib/json/ext/generator/state.rb",
54-
"lib/json/generic_object.rb",
55-
"lib/json/pure.rb",
56-
"lib/json/pure/generator.rb",
57-
"lib/json/pure/parser.rb",
58-
"lib/json/version.rb",
46+
*Dir["lib/**/*.rb"],
5947
]
60-
s.homepage = "https://ruby.github.io/json"
61-
s.metadata = {
62-
'bug_tracker_uri' => 'https://github.com/ruby/json/issues',
63-
'changelog_uri' => 'https://github.com/ruby/json/blob/master/CHANGES.md',
64-
'documentation_uri' => 'https://ruby.github.io/json/doc/index.html',
65-
'homepage_uri' => s.homepage,
66-
'source_code_uri' => 'https://github.com/ruby/json',
67-
'wiki_uri' => 'https://github.com/ruby/json/wiki'
68-
}
6948

70-
s.required_ruby_version = Gem::Requirement.new(">= 2.3")
49+
if java_ext
50+
s.platform = 'java'
51+
else
52+
s.extensions = Dir["ext/json/**/extconf.rb"]
53+
s.files += Dir["ext/json/**/*.{c,h,rl}"]
54+
end
55+
end
56+
57+
if RUBY_ENGINE == 'jruby' && $0 == __FILE__
58+
Gem::Builder.new(spec).build
59+
else
60+
spec
7161
end

0 commit comments

Comments
 (0)