@@ -2,70 +2,60 @@ version = File.foreach(File.join(__dir__, "lib/json/version.rb")) do |line|
2
2
/^\s *VERSION\s *=\s *'(.*)'/ =~ line and break $1
3
3
end rescue nil
4
4
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
+
6
8
s . name = "json"
7
9
s . version = version
8
10
9
11
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
+
28
+ else
29
+ s . description = "This is a JSON implementation as a Ruby extension in C."
30
+ s . authors = [ "Florian Frank" ]
31
+
32
+ end
33
+
11
34
s . licenses = [ "Ruby" ]
12
- s . authors = [ "Florian Frank" ]
13
-
14
35
15
- s . extensions = [ "ext/json/ext/generator/extconf.rb" , "ext/json/ext/parser/extconf.rb" , "ext/json/extconf.rb" ]
16
36
s . extra_rdoc_files = [ "README.md" ]
17
37
s . rdoc_options = [ "--title" , "JSON implementation for Ruby" , "--main" , "README.md" ]
38
+
18
39
s . files = [
19
40
"CHANGES.md" ,
20
41
"COPYING" ,
21
42
"BSDL" ,
22
43
"LEGAL" ,
23
44
"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" ,
35
45
"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" ] ,
59
47
]
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
- }
69
48
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
71
61
end
0 commit comments