chupatext 0.4.0

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.
data/AUTHORS ADDED
@@ -0,0 +1,2 @@
1
+ Kouhei Sutou <kou@cozmixng.org>
2
+ Yuto Hayamizu <y.hayamizu@gmail.com>
data/NEWS ADDED
@@ -0,0 +1,5 @@
1
+ = NEWS
2
+
3
+ == Release 0.4.0 (2010-11-01) - Kouhei Sutou <kou@clear-code.com>
4
+
5
+ * Initial release.
data/Rakefile ADDED
@@ -0,0 +1,107 @@
1
+ # -*- coding: utf-8; mode: ruby -*-
2
+
3
+ require 'English'
4
+
5
+ require 'find'
6
+ require 'fileutils'
7
+ require 'rubygems'
8
+ require 'hoe'
9
+ require 'rake/extensiontask'
10
+
11
+ base_dir = File.join(File.dirname(__FILE__))
12
+ truncate_base_dir = Proc.new do |x|
13
+ x.gsub(/^#{Regexp.escape(base_dir + File::SEPARATOR)}/o, '')
14
+ end
15
+
16
+ chupatext_ext_dir = File.join(base_dir, 'ext', 'chupatext')
17
+ chupatext_lib_dir = File.join(base_dir, 'lib')
18
+ $LOAD_PATH.unshift(chupatext_ext_dir)
19
+ $LOAD_PATH.unshift(chupatext_lib_dir)
20
+ ENV["RUBYLIB"] = "#{chupatext_lib_dir}:#{chupatext_ext_dir}:#{ENV['RUBYLIB']}"
21
+
22
+ def guess_chuparuby_version
23
+ require 'chupatext/version'
24
+ Chupa::BINDINGS_VERSION_STRING
25
+ end
26
+
27
+ manifest = File.join(base_dir, "Manifest.txt")
28
+ manifest_contents = []
29
+ base_dir_included_components = %w(AUTHORS COPYING ChangeLog GPL
30
+ NEWS README.doc Rakefile
31
+ extconf.rb pkg-config.rb)
32
+ excluded_components = %w(.cvsignore .gdb_history CVS depend Makefile pkg
33
+ .test-result .gitignore .git vendor)
34
+ excluded_suffixes = %w(.png .ps .pdf .o .so .a .txt .~ .log)
35
+ Find.find(base_dir) do |target|
36
+ target = truncate_base_dir[target]
37
+ components = target.split(File::SEPARATOR)
38
+ if components.size == 1 and !File.directory?(target)
39
+ next unless base_dir_included_components.include?(components[0])
40
+ end
41
+ Find.prune if (excluded_components - components) != excluded_components
42
+ next if excluded_suffixes.include?(File.extname(target))
43
+ manifest_contents << target if File.file?(target)
44
+ end
45
+
46
+ File.open(manifest, "w") do |f|
47
+ f.puts manifest_contents.sort.join("\n")
48
+ end
49
+
50
+ # For Hoe's no user friendly default behavior. :<
51
+ File.open("README.txt", "w") {|file| file << "= Dummy README\n== XXX\n"}
52
+ FileUtils.cp("NEWS", "History.txt")
53
+ at_exit do
54
+ FileUtils.rm_f("README.txt")
55
+ FileUtils.rm_f("History.txt")
56
+ FileUtils.rm_f(manifest)
57
+ end
58
+
59
+ version = ENV["VERSION"]
60
+ if version
61
+ version = version.dup
62
+ else
63
+ ENV["VERSION"] = version = guess_chuparuby_version
64
+ end
65
+ project = Hoe.spec('chupatext') do |project|
66
+ project.version = version
67
+ project.rubyforge_name = 'groonga'
68
+ authors = File.join(base_dir, "AUTHORS")
69
+ project.author = File.readlines(authors).collect do |line|
70
+ if /\s*<[^<>]*>$/ =~ line
71
+ $PREMATCH
72
+ else
73
+ nil
74
+ end
75
+ end.compact
76
+ project.email = ['groonga-users-en@rubyforge.com',
77
+ 'groonga-dev@lists.sourcefoge.jp']
78
+ project.summary = 'Ruby bindings for ChupaText'
79
+ project.url = 'http://groonga.rubyforge.org/'
80
+ project.test_globs = []
81
+ project.spec_extras = {
82
+ :extensions => ['ext/chupatext/extconf.rb'],
83
+ :require_paths => ['lib'],
84
+ :has_rdoc => false,
85
+ }
86
+ project.extra_deps << ['pkg-config', '>= 0']
87
+ platform = ENV["FORCE_PLATFORM"]
88
+ project.spec_extras[:platform] = platform if platform
89
+ news = File.join(base_dir, "NEWS")
90
+ project.changes = File.read(news).gsub(/\n+^Release(?m:.*)/, '')
91
+ project.description = 'Ruby bindings for ChupaText'
92
+ project.need_tar = false
93
+ project.remote_rdoc_dir = "doc"
94
+ end
95
+
96
+ project.spec.dependencies.delete_if {|dependency| dependency.name == "hoe"}
97
+
98
+ # fix Hoe's incorrect guess.
99
+ project.spec.executables.clear
100
+
101
+ task(:release).prerequisites.reject! {|name| name == "clean"}
102
+ task(:release_to_rubyforge).prerequisites.reject! {|name| name == "clean"}
103
+
104
+ # for releasing
105
+ task :dist => [:docs] do
106
+ sh "./dist.sh", version
107
+ end
@@ -0,0 +1,43 @@
1
+ /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
+ /*
3
+ * Copyright (C) 2010 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 as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include <chupatext.h>
22
+ #include <ruby.h>
23
+
24
+ static void
25
+ quit_chupatext (VALUE data)
26
+ {
27
+ chupa_quit();
28
+ }
29
+
30
+ void
31
+ Init_chupatext (void)
32
+ {
33
+ int address;
34
+ VALUE mChupa;
35
+
36
+ chupa_init(&address);
37
+ mChupa = rb_define_module("Chupa");
38
+ rb_iv_set(mChupa, "quit", Data_Wrap_Struct(0, 0, quit_chupatext, (void *)1));
39
+ }
40
+
41
+ /*
42
+ vi:ts=4:nowrap:ai:expandtab:sw=4
43
+ */
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pathname'
4
+ require 'English'
5
+ require 'mkmf'
6
+ require 'fileutils'
7
+
8
+ begin
9
+ require 'pkg-config'
10
+ rescue LoadError
11
+ require 'rubygems'
12
+ require 'pkg-config'
13
+ end
14
+
15
+ checking_for(checking_message("GCC")) do
16
+ if macro_defined?("__GNUC__", "")
17
+ $CFLAGS += ' -Wall'
18
+ true
19
+ else
20
+ false
21
+ end
22
+ end
23
+
24
+ package = "chupatext"
25
+ module_name = "chupatext"
26
+ major, minor, micro = 0, 4, 0
27
+
28
+ base_dir = Pathname(__FILE__).dirname.parent.parent
29
+ checking_for(checking_message("Win32 OS")) do
30
+ case RUBY_PLATFORM
31
+ when /cygwin|mingw|mswin32/
32
+ $defs << "-DRUBY_CHUPA_PLATFORM_WIN32"
33
+ import_library_name = "libruby-#{module_name}.a"
34
+ $DLDFLAGS << " -Wl,--out-implib=#{import_library_name}"
35
+ $cleanfiles << import_library_name
36
+ binary_base_dir = base_dir + "vendor" + "local"
37
+ $CFLAGS += " -I#{binary_base_dir}/include"
38
+ pkg_config_dir = binary_base_dir + "lib" + "pkgconfig"
39
+ PKGConfig.add_path(pkg_config_dir.to_s)
40
+ PKGConfig.set_override_variable("prefix", binary_base_dir.to_s)
41
+ true
42
+ else
43
+ false
44
+ end
45
+ end
46
+
47
+ PKGConfig.have_package(package, major, minor, micro) or exit 1
48
+
49
+ $defs << "-DRB_CHUPA_COMPILATION"
50
+
51
+ create_makefile(module_name)
data/extconf.rb ADDED
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pathname'
4
+ require 'mkmf'
5
+ require 'rbconfig'
6
+ require 'fileutils'
7
+
8
+ package_name = "chupatext"
9
+
10
+ base_dir = Pathname(__FILE__).dirname.expand_path
11
+ ext_dir = base_dir + "ext" + package_name
12
+
13
+ ruby = File.join(RbConfig::CONFIG['bindir'],
14
+ RbConfig::CONFIG['ruby_install_name'] +
15
+ RbConfig::CONFIG["EXEEXT"])
16
+
17
+ Dir.chdir(ext_dir.to_s) do
18
+ system(ruby, "extconf.rb", *ARGV) || exit(false)
19
+ end
20
+
21
+ create_makefile(package_name)
22
+ FileUtils.mv("Makefile", "Makefile.lib")
23
+
24
+ File.open("Makefile", "w") do |makefile|
25
+ makefile.puts(<<-EOM)
26
+ all:
27
+ (cd ext/#{package_name} && $(MAKE))
28
+ $(MAKE) -f Makefile.lib
29
+
30
+ install:
31
+ (cd ext/#{package_name} && $(MAKE) install)
32
+ $(MAKE) -f Makefile.lib install
33
+
34
+ site-install:
35
+ (cd ext/#{package_name} && $(MAKE) site-install)
36
+ $(MAKE) -f Makefile.lib site-install
37
+
38
+ clean:
39
+ (cd ext/#{package_name} && $(MAKE) clean)
40
+ $(MAKE) -f Makefile.lib clean
41
+
42
+ distclean:
43
+ (cd ext/#{package_name} && $(MAKE) distclean)
44
+ $(MAKE) -f Makefile.lib distclean
45
+ @rm -f Makefile.lib
46
+ EOM
47
+ end
@@ -0,0 +1,21 @@
1
+ # Copyright (C) 2010 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, or (at your option) any later version.
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., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ module Chupa
19
+ BINDINGS_VERSION = [0, 4, 0]
20
+ BINDINGS_VERSION_STRING = BINDINGS_VERSION.join(".")
21
+ end
data/lib/chupatext.rb ADDED
@@ -0,0 +1,18 @@
1
+ # Copyright (C) 2010 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, or (at your option) any later version.
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., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ require "chupatext.so"
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chupatext
3
+ version: !ruby/object:Gem::Version
4
+ hash: 15
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 4
9
+ - 0
10
+ version: 0.4.0
11
+ platform: ruby
12
+ authors:
13
+ - Kouhei Sutou
14
+ - Yuto Hayamizu
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2010-11-01 00:00:00 +09:00
20
+ default_executable:
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: pkg-config
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 0
33
+ version: "0"
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ description: Ruby bindings for ChupaText
37
+ email:
38
+ - groonga-users-en@rubyforge.com
39
+ - groonga-dev@lists.sourcefoge.jp
40
+ executables: []
41
+
42
+ extensions:
43
+ - ext/chupatext/extconf.rb
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - AUTHORS
48
+ - NEWS
49
+ - Rakefile
50
+ - ext/chupatext/chupatext.c
51
+ - ext/chupatext/extconf.rb
52
+ - extconf.rb
53
+ - lib/chupatext.rb
54
+ - lib/chupatext/version.rb
55
+ has_rdoc: true
56
+ homepage: http://groonga.rubyforge.org/
57
+ licenses: []
58
+
59
+ post_install_message:
60
+ rdoc_options:
61
+ - --main
62
+ - README.txt
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ hash: 3
71
+ segments:
72
+ - 0
73
+ version: "0"
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ hash: 3
80
+ segments:
81
+ - 0
82
+ version: "0"
83
+ requirements: []
84
+
85
+ rubyforge_project: groonga
86
+ rubygems_version: 1.3.7
87
+ signing_key:
88
+ specification_version: 3
89
+ summary: Ruby bindings for ChupaText
90
+ test_files: []
91
+