-
Notifications
You must be signed in to change notification settings - Fork 26
/
rroonga.gemspec
100 lines (86 loc) · 3.26 KB
/
rroonga.gemspec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# -*- ruby -*-
#
# Copyright (C) 2012-2020 Sutou Kouhei <[email protected]>
# Copyright (C) 2017 Masafumi Yokoyama <[email protected]>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1 as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
require "English"
require_relative "rroonga-build"
base_dir = File.dirname(__FILE__)
ext_dir = File.join(base_dir, "ext", "groonga")
guess_version = lambda do |ext_dir|
version = {}
File.open(File.join(ext_dir, "rb-grn.h")) do |rb_grn_h|
rb_grn_h.each_line do |line|
case line
when /\A#define RB_GRN_([A-Z]+)_VERSION (\d+)/
version[$1.downcase] = $2
end
end
end
[version["major"], version["minor"], version["micro"]].join(".")
end
clean_white_space = lambda do |entry|
entry.gsub(/(\A\n+|\n+\z)/, '') + "\n"
end
Gem::Specification.new do |s|
s.name = "rroonga"
s.version = guess_version.call(ext_dir)
authors_path = File.join(base_dir, "AUTHORS")
authors = []
emails = []
File.readlines(authors_path).each do |line|
if /\s*<([^<>]*)>$/ =~ line
authors << $PREMATCH
emails << $1
end
end
s.authors = authors
s.email = emails
readme_path = File.join(base_dir, "README.md")
entries = File.read(readme_path).split(/^##\s(.*)$/)
description = clean_white_space.call(entries[entries.index("Description") + 1])
s.summary, s.description, = description.split(/\n\n+/, 3)
s.files = ["README.md", "AUTHORS", "Rakefile", "Gemfile", ".yardopts"]
s.files += Dir.glob("doc/text/*.md")
s.files += Dir.glob("doc/images/*")
s.files += ["#{s.name}.gemspec"]
s.files += ["rroonga-build.rb", "extconf.rb"]
Dir.chdir(base_dir) do
s.files += Dir.glob("{lib,benchmark,misc,example}/**/*.rb")
s.files += Dir.glob("ext/**/*.{c,h,rb,def}")
s.extensions = ["ext/groonga/extconf.rb"]
s.extra_rdoc_files = ["README.md"]
s.test_files = Dir.glob("test/**/*.rb")
Dir.chdir("bin") do
s.executables = Dir.glob("*")
end
end
s.homepage = "http://ranguba.org/#about-rroonga"
s.licenses = ["LGPL-2.1"]
s.require_paths = ["lib", "ext/groonga"]
s.required_ruby_version = ">= 1.9.3"
s.add_runtime_dependency("groonga-client", ">= 0.0.3")
s.add_runtime_dependency("json")
s.add_runtime_dependency("native-package-installer")
s.add_runtime_dependency("pkg-config")
s.add_development_dependency("test-unit", [">= 3.0.0"])
s.add_development_dependency("rake")
s.add_development_dependency("bundler")
s.add_development_dependency("yard")
s.add_development_dependency("packnga", [">= 1.0.0"])
s.add_development_dependency("kramdown")
required_groonga_version = RroongaBuild::RequiredGroongaVersion::STRING
s.metadata["msys2_mingw_dependencies"] = "groonga>=#{required_groonga_version}"
end