activegroonga-fabrication 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +1 -0
- data/NEWS.ja.rdoc +5 -0
- data/NEWS.rdoc +5 -0
- data/README.ja.rdoc +46 -0
- data/README.rdoc +46 -0
- data/Rakefile +201 -0
- data/lib/active_groonga_fabrication.rb +18 -0
- data/lib/active_groonga_fabrication/version.rb +24 -0
- data/lib/fabrication/generator/active_groonga.rb +24 -0
- data/test/active-groonga-fabrication-test-utils.rb +79 -0
- data/test/fabricators/user_fabricator.rb +21 -0
- data/test/models/user.rb +17 -0
- data/test/run-test.rb +66 -0
- data/test/test-generate.rb +23 -0
- metadata +132 -0
data/AUTHORS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Kouhei Sutou <kou@clear-code.com>
|
data/NEWS.rdoc
ADDED
data/README.ja.rdoc
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
= はじめに
|
2
|
+
|
3
|
+
== 名前
|
4
|
+
|
5
|
+
ActiveGroonga Fabrication
|
6
|
+
|
7
|
+
== 説明
|
8
|
+
|
9
|
+
FabricationのActiveGroongaジェネレータです。
|
10
|
+
|
11
|
+
* ActiveGroonga: http://groonga.rubyforge.org/
|
12
|
+
* Fabrication: https://github.com/paulelliott/fabrication
|
13
|
+
|
14
|
+
== 作者
|
15
|
+
|
16
|
+
Kouhei Sutou <tt><kou@clear-code.com></tt>
|
17
|
+
|
18
|
+
== ライセンス
|
19
|
+
|
20
|
+
LGPL 2.1です。詳しくはlicense/LGPLを見てください。
|
21
|
+
|
22
|
+
(コントリビュートされたパッチなども含み、Kouhei Sutouがライ
|
23
|
+
センスを変更する権利を持ちます。)
|
24
|
+
|
25
|
+
== 依存ソフトウェア
|
26
|
+
|
27
|
+
* ActiveGroonga
|
28
|
+
* Fabrication
|
29
|
+
|
30
|
+
== インストール
|
31
|
+
|
32
|
+
% sudo gem install activegroonga-fabrication
|
33
|
+
|
34
|
+
== ドキュメント
|
35
|
+
|
36
|
+
http://groonga.rubyforge.org/activegroonga-fabrication/
|
37
|
+
|
38
|
+
== メーリングリスト
|
39
|
+
|
40
|
+
質問、要望、バグ報告などはgroongaのMLにお願いします。
|
41
|
+
|
42
|
+
http://lists.sourceforge.jp/mailman/listinfo/groonga-dev
|
43
|
+
|
44
|
+
== 感謝
|
45
|
+
|
46
|
+
* ...
|
data/README.rdoc
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
= README
|
2
|
+
|
3
|
+
== Name
|
4
|
+
|
5
|
+
ActiveGroonga Fabrication
|
6
|
+
|
7
|
+
== Description
|
8
|
+
|
9
|
+
A ActiveGroonga generator for Fabrication.
|
10
|
+
|
11
|
+
* ActiveGroonga: http://groonga.rubyforge.org/
|
12
|
+
* Fabrication: https://github.com/paulelliott/fabrication
|
13
|
+
|
14
|
+
== Author
|
15
|
+
|
16
|
+
Kouhei Sutou <tt><kou@clear-code.com></tt>
|
17
|
+
|
18
|
+
== License
|
19
|
+
|
20
|
+
LGPL 2.1. See license/LGPL for details.
|
21
|
+
|
22
|
+
(Kouhei Sutou has a right to change license including
|
23
|
+
contributed patches.)
|
24
|
+
|
25
|
+
== Dependencies
|
26
|
+
|
27
|
+
* ActiveGroonga
|
28
|
+
* Fabrication
|
29
|
+
|
30
|
+
== Install
|
31
|
+
|
32
|
+
% sudo gem install activegroonga-fabrication
|
33
|
+
|
34
|
+
== Documents
|
35
|
+
|
36
|
+
Japanese only. Sorry.
|
37
|
+
|
38
|
+
http://groonga.rubyforge.org/activegroonga-fabrication/
|
39
|
+
|
40
|
+
== Mailing list
|
41
|
+
|
42
|
+
http://rubyforge.org/mailman/listinfo/groonga-users-en
|
43
|
+
|
44
|
+
== Thanks
|
45
|
+
|
46
|
+
* ...
|
data/Rakefile
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
# -*- coding: utf-8; mode: ruby -*-
|
2
|
+
#
|
3
|
+
# Copyright (C) 2011 Kouhei Sutou <kou@clear-code.com>
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License version 2.1 as published by the Free Software Foundation.
|
8
|
+
#
|
9
|
+
# This library is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this library; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
17
|
+
|
18
|
+
require 'English'
|
19
|
+
|
20
|
+
require 'find'
|
21
|
+
require 'fileutils'
|
22
|
+
require 'pathname'
|
23
|
+
require 'erb'
|
24
|
+
require 'rubygems'
|
25
|
+
if RUBY_VERSION < "1.9"
|
26
|
+
gem 'rdoc'
|
27
|
+
end
|
28
|
+
require 'hoe'
|
29
|
+
|
30
|
+
ENV["NODOT"] = "yes"
|
31
|
+
|
32
|
+
base_dir = File.join(File.dirname(__FILE__))
|
33
|
+
truncate_base_dir = Proc.new do |x|
|
34
|
+
x.gsub(/^#{Regexp.escape(base_dir + File::SEPARATOR)}/, '')
|
35
|
+
end
|
36
|
+
|
37
|
+
@rroonga_base_dir = File.expand_path(File.join(base_dir, '..', 'rroonga'))
|
38
|
+
rroonga_ext_dir = File.join(@rroonga_base_dir, 'ext', "groonga")
|
39
|
+
rroonga_lib_dir = File.join(@rroonga_base_dir, 'lib')
|
40
|
+
$LOAD_PATH.unshift(rroonga_ext_dir)
|
41
|
+
$LOAD_PATH.unshift(rroonga_lib_dir)
|
42
|
+
ENV["RUBYLIB"] = "#{rroonga_lib_dir}:#{rroonga_ext_dir}:#{ENV['RUBYLIB']}"
|
43
|
+
|
44
|
+
@active_groonga_base_dir = File.expand_path(File.join(base_dir, '..', 'activegroonga'))
|
45
|
+
active_groonga_lib_dir = File.join(@active_groonga_base_dir, 'lib')
|
46
|
+
ENV["RUBYLIB"] = "#{active_groonga_lib_dir}:#{ENV['RUBYLIB']}"
|
47
|
+
|
48
|
+
active_groonga_fabrication_lib_dir = File.join(base_dir, "lib")
|
49
|
+
$LOAD_PATH.unshift(active_groonga_fabrication_lib_dir)
|
50
|
+
|
51
|
+
def guess_version
|
52
|
+
require 'active_groonga_fabrication/version'
|
53
|
+
ActiveGroongaFabrication::VERSION::STRING
|
54
|
+
end
|
55
|
+
|
56
|
+
manifest = File.join(base_dir, "Manifest.txt")
|
57
|
+
manifest_contents = []
|
58
|
+
base_dir_included_components = %w(AUTHORS
|
59
|
+
NEWS.rdoc NEWS.ja.rdoc
|
60
|
+
README.rdoc README.ja.rdoc
|
61
|
+
Rakefile)
|
62
|
+
excluded_components = %w(.cvsignore .gdb_history CVS depend Makefile pkg
|
63
|
+
.git .svn doc vendor .test-result)
|
64
|
+
excluded_suffixes = %w(.png .ps .pdf .o .so .a .txt .~)
|
65
|
+
Find.find(base_dir) do |target|
|
66
|
+
target = truncate_base_dir[target]
|
67
|
+
components = target.split(File::SEPARATOR)
|
68
|
+
if components.size == 1 and !File.directory?(target)
|
69
|
+
next unless base_dir_included_components.include?(components[0])
|
70
|
+
end
|
71
|
+
Find.prune if (excluded_components - components) != excluded_components
|
72
|
+
next if excluded_suffixes.include?(File.extname(target))
|
73
|
+
manifest_contents << target if File.file?(target)
|
74
|
+
end
|
75
|
+
|
76
|
+
File.open(manifest, "w") do |f|
|
77
|
+
f.puts manifest_contents.sort.join("\n")
|
78
|
+
end
|
79
|
+
|
80
|
+
# For Hoe's no user friendly default behavior. :<
|
81
|
+
File.open("README.txt", "w") {|file| file << "= Dummy README\n== XXX\n"}
|
82
|
+
FileUtils.cp("NEWS.rdoc", "History.txt")
|
83
|
+
at_exit do
|
84
|
+
FileUtils.rm_f("README.txt")
|
85
|
+
FileUtils.rm_f("History.txt")
|
86
|
+
FileUtils.rm_f(manifest)
|
87
|
+
end
|
88
|
+
|
89
|
+
def cleanup_white_space(entry)
|
90
|
+
entry.gsub(/(\A\n+|\n+\z)/, '') + "\n"
|
91
|
+
end
|
92
|
+
|
93
|
+
ENV["VERSION"] ||= guess_version
|
94
|
+
version = ENV["VERSION"].dup
|
95
|
+
project = nil
|
96
|
+
Hoe.spec('activegroonga-fabrication') do |_project|
|
97
|
+
Hoe::Test::SUPPORTED_TEST_FRAMEWORKS[:testunit2] = "test/run-test.rb"
|
98
|
+
project = _project
|
99
|
+
project.version = version
|
100
|
+
project.rubyforge_name = 'groonga'
|
101
|
+
authors = File.join(base_dir, "AUTHORS")
|
102
|
+
project.author = File.readlines(authors).collect do |line|
|
103
|
+
if /\s*<[^<>]*>$/ =~ line
|
104
|
+
$PREMATCH
|
105
|
+
else
|
106
|
+
nil
|
107
|
+
end
|
108
|
+
end.compact
|
109
|
+
project.email = ['groonga-users-en@rubyforge.org',
|
110
|
+
'groonga-dev@lists.sourceforge.jp']
|
111
|
+
project.url = 'http://groonga.rubyforge.org/'
|
112
|
+
project.testlib = :testunit2
|
113
|
+
project.test_globs = ["test/run-test.rb"]
|
114
|
+
project.spec_extras = {
|
115
|
+
:extra_rdoc_files => Dir.glob("*.rdoc"),
|
116
|
+
}
|
117
|
+
project.readme_file = "README.ja.rdoc"
|
118
|
+
project.extra_deps = [["activegroonga", ">= 0"],
|
119
|
+
["fabrication", ">= 0"]]
|
120
|
+
|
121
|
+
news_of_current_release = File.read("NEWS.rdoc").split(/^==\s.*$/)[1]
|
122
|
+
project.changes = cleanup_white_space(news_of_current_release)
|
123
|
+
|
124
|
+
entries = File.read("README.rdoc").split(/^==\s(.*)$/)
|
125
|
+
description = cleanup_white_space(entries[entries.index("Description") + 1])
|
126
|
+
project.summary, project.description, = description.split(/\n\n+/, 3)
|
127
|
+
|
128
|
+
project.remote_rdoc_dir = "activegroonga-fabrication"
|
129
|
+
end
|
130
|
+
|
131
|
+
project.spec.dependencies.delete_if {|dependency| dependency.name == "hoe"}
|
132
|
+
|
133
|
+
ObjectSpace.each_object(Rake::RDocTask) do |rdoc_task|
|
134
|
+
options = rdoc_task.options
|
135
|
+
t_option_index = options.index("-t") || options.index("--title")
|
136
|
+
rdoc_task.options[t_option_index, 2] = nil
|
137
|
+
rdoc_task.title = "ActiveGroonga Fabrication - #{version}"
|
138
|
+
rdoc_task.rdoc_files = Dir.glob("lib/**/*.rb")
|
139
|
+
rdoc_task.rdoc_files += Dir.glob("*.rdoc")
|
140
|
+
end
|
141
|
+
|
142
|
+
task :publish_docs => [:prepare_docs_for_publishing]
|
143
|
+
|
144
|
+
|
145
|
+
include ERB::Util
|
146
|
+
|
147
|
+
def apply_template(file, head, header, footer)
|
148
|
+
content = File.read(file)
|
149
|
+
content = content.sub(/lang="en"/, 'lang="ja"')
|
150
|
+
|
151
|
+
title = nil
|
152
|
+
content = content.sub(/<title>(.+?)<\/title>/) do
|
153
|
+
title = $1
|
154
|
+
head.result(binding)
|
155
|
+
end
|
156
|
+
|
157
|
+
content = content.sub(/<body(?:.*?)>/) do |body_start|
|
158
|
+
"#{body_start}\n#{header.result(binding)}\n"
|
159
|
+
end
|
160
|
+
|
161
|
+
content = content.sub(/<\/body/) do |body_end|
|
162
|
+
"\n#{footer.result(binding)}\n#{body_end}"
|
163
|
+
end
|
164
|
+
|
165
|
+
File.open(file, "w") do |file|
|
166
|
+
file.print(content)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
def erb_template(name)
|
171
|
+
file = File.join(@rroonga_base_dir, "html", "#{name}.html.erb")
|
172
|
+
template = File.read(file)
|
173
|
+
erb = ERB.new(template, nil, "-")
|
174
|
+
erb.filename = file
|
175
|
+
erb
|
176
|
+
end
|
177
|
+
|
178
|
+
task :prepare_docs_for_publishing do
|
179
|
+
head = erb_template("head")
|
180
|
+
header = erb_template("header")
|
181
|
+
footer = erb_template("footer")
|
182
|
+
Find.find("doc") do |file|
|
183
|
+
if /\.html\z/ =~ file and /_(?:c|rb)\.html\z/ !~ file
|
184
|
+
apply_template(file, head, header, footer)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
desc "Tag the current revision."
|
190
|
+
task :tag do
|
191
|
+
sh("git tag -a #{version} -m 'release #{version}!!!'")
|
192
|
+
end
|
193
|
+
|
194
|
+
desc "generate activegroonga-fabrication.gemspec"
|
195
|
+
task :generate_gemspec do
|
196
|
+
spec = project.spec
|
197
|
+
spec_name = File.join(base_dir, project.spec.spec_name)
|
198
|
+
File.open(spec_name, "w") do |spec_file|
|
199
|
+
spec_file.puts(spec.to_ruby)
|
200
|
+
end
|
201
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Copyright (C) 2011 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License version 2.1 as published by the Free Software Foundation.
|
6
|
+
#
|
7
|
+
# This library is distributed in the hope that it will be useful,
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
10
|
+
# Lesser General Public License for more details.
|
11
|
+
#
|
12
|
+
# You should have received a copy of the GNU Lesser General Public
|
13
|
+
# License along with this library; if not, write to the Free Software
|
14
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
15
|
+
|
16
|
+
require 'active_groonga'
|
17
|
+
require 'active_groonga_fabrication/version'
|
18
|
+
require 'fabrication/generator/active_groonga'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Copyright (C) 2011 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License version 2.1 as published by the Free Software Foundation.
|
6
|
+
#
|
7
|
+
# This library is distributed in the hope that it will be useful,
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
10
|
+
# Lesser General Public License for more details.
|
11
|
+
#
|
12
|
+
# You should have received a copy of the GNU Lesser General Public
|
13
|
+
# License along with this library; if not, write to the Free Software
|
14
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
15
|
+
|
16
|
+
module ActiveGroongaFabrication
|
17
|
+
module VERSION
|
18
|
+
MAJOR = 1
|
19
|
+
MINOR = 0
|
20
|
+
TINY = 0
|
21
|
+
|
22
|
+
STRING = [MAJOR, MINOR, TINY].join(".")
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Copyright (C) 2011 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License version 2.1 as published by the Free Software Foundation.
|
6
|
+
#
|
7
|
+
# This library is distributed in the hope that it will be useful,
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
10
|
+
# Lesser General Public License for more details.
|
11
|
+
#
|
12
|
+
# You should have received a copy of the GNU Lesser General Public
|
13
|
+
# License along with this library; if not, write to the Free Software
|
14
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
15
|
+
|
16
|
+
require 'fabrication'
|
17
|
+
|
18
|
+
class Fabrication::Generator::ActiveGroonga < Fabrication::Generator::Base
|
19
|
+
def self.supports?(klass)
|
20
|
+
klass < ::ActiveGroonga::Base
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
Fabrication::Schematic::GENERATORS.unshift(Fabrication::Generator::ActiveGroonga)
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# Copyright (C) 2011 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License version 2.1 as published by the Free Software Foundation.
|
6
|
+
#
|
7
|
+
# This library is distributed in the hope that it will be useful,
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
10
|
+
# Lesser General Public License for more details.
|
11
|
+
#
|
12
|
+
# You should have received a copy of the GNU Lesser General Public
|
13
|
+
# License along with this library; if not, write to the Free Software
|
14
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
15
|
+
|
16
|
+
require 'fileutils'
|
17
|
+
require 'pathname'
|
18
|
+
|
19
|
+
require 'active_groonga_fabrication'
|
20
|
+
|
21
|
+
module ActiveGroongaFabricationTestUtils
|
22
|
+
class << self
|
23
|
+
def included(base)
|
24
|
+
base.setup :setup_sand_box, :before => :prepend
|
25
|
+
base.teardown :teardown_sand_box, :after => :append
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def setup_sand_box
|
30
|
+
Groonga::Context.default = nil
|
31
|
+
@context = Groonga::Context.default
|
32
|
+
|
33
|
+
setup_tmp_directory
|
34
|
+
setup_database_directory
|
35
|
+
setup_database
|
36
|
+
|
37
|
+
setup_users_table
|
38
|
+
end
|
39
|
+
|
40
|
+
def setup_tmp_directory
|
41
|
+
@tmp_dir = Pathname(File.dirname(__FILE__)) + "tmp"
|
42
|
+
FileUtils.rm_rf(@tmp_dir.to_s)
|
43
|
+
FileUtils.mkdir_p(@tmp_dir.to_s)
|
44
|
+
end
|
45
|
+
|
46
|
+
def setup_database_directory
|
47
|
+
@database_dir = @tmp_dir + "groonga"
|
48
|
+
FileUtils.mkdir_p(@database_dir.to_s)
|
49
|
+
end
|
50
|
+
|
51
|
+
def setup_database
|
52
|
+
@database_path = @database_dir + "database"
|
53
|
+
@database = Groonga::Database.create(:path => @database_path.to_s)
|
54
|
+
ActiveGroonga::Base.database_path = @database_path.to_s
|
55
|
+
end
|
56
|
+
|
57
|
+
def setup_tables_directory
|
58
|
+
@tables_dir = Pathname("#{@database_path}.tables")
|
59
|
+
FileUtils.mkdir_p(@tables_dir.to_s)
|
60
|
+
end
|
61
|
+
|
62
|
+
def setup_users_table
|
63
|
+
ActiveGroonga::Schema.define do |schema|
|
64
|
+
schema.create_table(:users) do |table|
|
65
|
+
table.short_text :name
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def teardown_sand_box
|
71
|
+
teardown_tmp_directory
|
72
|
+
end
|
73
|
+
|
74
|
+
def teardown_tmp_directory
|
75
|
+
FileUtils.rm_rf(@tmp_dir.to_s)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
require 'models/user'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Copyright (C) 2011 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License version 2.1 as published by the Free Software Foundation.
|
6
|
+
#
|
7
|
+
# This library is distributed in the hope that it will be useful,
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
10
|
+
# Lesser General Public License for more details.
|
11
|
+
#
|
12
|
+
# You should have received a copy of the GNU Lesser General Public
|
13
|
+
# License along with this library; if not, write to the Free Software
|
14
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
15
|
+
|
16
|
+
Fabricator(:user) do
|
17
|
+
end
|
18
|
+
|
19
|
+
Fabricator(:bob, :from => :user) do
|
20
|
+
name "bob"
|
21
|
+
end
|
data/test/models/user.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Copyright (C) 2011 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License version 2.1 as published by the Free Software Foundation.
|
6
|
+
#
|
7
|
+
# This library is distributed in the hope that it will be useful,
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
10
|
+
# Lesser General Public License for more details.
|
11
|
+
#
|
12
|
+
# You should have received a copy of the GNU Lesser General Public
|
13
|
+
# License along with this library; if not, write to the Free Software
|
14
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
15
|
+
|
16
|
+
class User < ActiveGroonga::Base
|
17
|
+
end
|
data/test/run-test.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Copyright (C) 2011 Kouhei Sutou <kou@clear-code.com>
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License version 2.1 as published by the Free Software Foundation.
|
8
|
+
#
|
9
|
+
# This library is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this library; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
17
|
+
|
18
|
+
$VERBOSE = true
|
19
|
+
|
20
|
+
require 'pathname'
|
21
|
+
require 'shellwords'
|
22
|
+
|
23
|
+
base_dir = Pathname(__FILE__).dirname.parent.expand_path
|
24
|
+
|
25
|
+
rroonga_dir = base_dir.parent + "rroonga"
|
26
|
+
lib_dir = base_dir + "lib"
|
27
|
+
test_dir = base_dir + "test"
|
28
|
+
|
29
|
+
if rroonga_dir.exist?
|
30
|
+
make = nil
|
31
|
+
if system("which gmake > /dev/null")
|
32
|
+
make = "gmake"
|
33
|
+
elsif system("which make > /dev/null")
|
34
|
+
make = "make"
|
35
|
+
end
|
36
|
+
if make
|
37
|
+
escaped_rroonga_dir = Shellwords.escape(rroonga_dir.to_s)
|
38
|
+
system("cd #{escaped_rroonga_dir} && #{make} > /dev/null") or exit(false)
|
39
|
+
end
|
40
|
+
$LOAD_PATH.unshift(rroonga_dir + "ext" + "groonga")
|
41
|
+
$LOAD_PATH.unshift(rroonga_dir + "lib")
|
42
|
+
end
|
43
|
+
|
44
|
+
active_groonga_dir = base_dir.parent + "activegroonga"
|
45
|
+
if active_groonga_dir.exist?
|
46
|
+
$LOAD_PATH.unshift(active_groonga_dir + "lib")
|
47
|
+
end
|
48
|
+
|
49
|
+
ENV["TEST_UNIT_MAX_DIFF_TARGET_STRING_SIZE"] = "10000"
|
50
|
+
|
51
|
+
gem 'test-unit-notify'
|
52
|
+
require 'test/unit'
|
53
|
+
require 'test/unit/notify'
|
54
|
+
Test::Unit::Priority.enable
|
55
|
+
Test::Unit::Notify.enable = true
|
56
|
+
|
57
|
+
$LOAD_PATH.unshift(lib_dir)
|
58
|
+
|
59
|
+
$LOAD_PATH.unshift(test_dir)
|
60
|
+
require 'active-groonga-fabrication-test-utils'
|
61
|
+
|
62
|
+
Dir.glob("test/**/test{_,-}*.rb") do |file|
|
63
|
+
require file.sub(/\.rb$/, '')
|
64
|
+
end
|
65
|
+
|
66
|
+
exit Test::Unit::AutoRunner.run(false)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Copyright (C) 2011 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
16
|
+
|
17
|
+
class TestGenerate < Test::Unit::TestCase
|
18
|
+
include ActiveGroongaFabricationTestUtils
|
19
|
+
|
20
|
+
def test_short_text
|
21
|
+
assert_equal("bob", Fabricate(:bob).name)
|
22
|
+
end
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: activegroonga-fabrication
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Kouhei Sutou
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-03-31 00:00:00 +09:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: activegroonga
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: fabrication
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: rubyforge
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 7
|
58
|
+
segments:
|
59
|
+
- 2
|
60
|
+
- 0
|
61
|
+
- 4
|
62
|
+
version: 2.0.4
|
63
|
+
type: :development
|
64
|
+
version_requirements: *id003
|
65
|
+
description: |
|
66
|
+
* ActiveGroonga: http://groonga.rubyforge.org/
|
67
|
+
* Fabrication: https://github.com/paulelliott/fabrication
|
68
|
+
|
69
|
+
email:
|
70
|
+
- groonga-users-en@rubyforge.org
|
71
|
+
- groonga-dev@lists.sourceforge.jp
|
72
|
+
executables: []
|
73
|
+
|
74
|
+
extensions: []
|
75
|
+
|
76
|
+
extra_rdoc_files:
|
77
|
+
- NEWS.rdoc
|
78
|
+
- README.rdoc
|
79
|
+
- README.ja.rdoc
|
80
|
+
- NEWS.ja.rdoc
|
81
|
+
files:
|
82
|
+
- AUTHORS
|
83
|
+
- NEWS.ja.rdoc
|
84
|
+
- NEWS.rdoc
|
85
|
+
- README.ja.rdoc
|
86
|
+
- README.rdoc
|
87
|
+
- Rakefile
|
88
|
+
- lib/active_groonga_fabrication.rb
|
89
|
+
- lib/active_groonga_fabrication/version.rb
|
90
|
+
- lib/fabrication/generator/active_groonga.rb
|
91
|
+
- test/active-groonga-fabrication-test-utils.rb
|
92
|
+
- test/fabricators/user_fabricator.rb
|
93
|
+
- test/models/user.rb
|
94
|
+
- test/run-test.rb
|
95
|
+
- test/test-generate.rb
|
96
|
+
has_rdoc: true
|
97
|
+
homepage: http://groonga.rubyforge.org/
|
98
|
+
licenses: []
|
99
|
+
|
100
|
+
post_install_message:
|
101
|
+
rdoc_options:
|
102
|
+
- --main
|
103
|
+
- README.ja.rdoc
|
104
|
+
require_paths:
|
105
|
+
- lib
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
hash: 3
|
112
|
+
segments:
|
113
|
+
- 0
|
114
|
+
version: "0"
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
hash: 3
|
121
|
+
segments:
|
122
|
+
- 0
|
123
|
+
version: "0"
|
124
|
+
requirements: []
|
125
|
+
|
126
|
+
rubyforge_project: groonga
|
127
|
+
rubygems_version: 1.6.2
|
128
|
+
signing_key:
|
129
|
+
specification_version: 3
|
130
|
+
summary: A ActiveGroonga generator for Fabrication.
|
131
|
+
test_files:
|
132
|
+
- test/run-test.rb
|