chuparuby 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
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.
@@ -0,0 +1,105 @@
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('chuparuby') 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 << ['glib2', '>= 0']
87
+ project.extra_deps << ['nokogiri', '>= 0']
88
+ news = File.join(base_dir, "NEWS")
89
+ project.changes = File.read(news).gsub(/\n+^Release(?m:.*)/, '')
90
+ project.description = 'Ruby bindings for ChupaText'
91
+ project.remote_rdoc_dir = "doc"
92
+ end
93
+
94
+ project.spec.dependencies.delete_if {|dependency| dependency.name == "hoe"}
95
+
96
+ # fix Hoe's incorrect guess.
97
+ project.spec.executables.clear
98
+
99
+ task(:release).prerequisites.reject! {|name| name == "clean"}
100
+ task(:release_to_rubyforge).prerequisites.reject! {|name| name == "clean"}
101
+
102
+ # for releasing
103
+ task :dist => [:docs] do
104
+ sh "./dist.sh", version
105
+ 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, 5, 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)
@@ -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,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"
@@ -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, 5, 0]
20
+ BINDINGS_VERSION_STRING = BINDINGS_VERSION.join(".")
21
+ end
metadata ADDED
@@ -0,0 +1,121 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chuparuby
3
+ version: !ruby/object:Gem::Version
4
+ hash: 11
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 5
9
+ - 0
10
+ version: 0.5.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-08 00:00:00 +09:00
20
+ default_executable:
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: glib2
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
+ - !ruby/object:Gem::Dependency
37
+ name: nokogiri
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ type: :runtime
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: rubyforge
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 7
59
+ segments:
60
+ - 2
61
+ - 0
62
+ - 4
63
+ version: 2.0.4
64
+ type: :development
65
+ version_requirements: *id003
66
+ description: Ruby bindings for ChupaText
67
+ email:
68
+ - groonga-users-en@rubyforge.com
69
+ - groonga-dev@lists.sourcefoge.jp
70
+ executables: []
71
+
72
+ extensions:
73
+ - ext/chupatext/extconf.rb
74
+ extra_rdoc_files: []
75
+
76
+ files:
77
+ - AUTHORS
78
+ - NEWS
79
+ - Rakefile
80
+ - ext/chupatext/chupatext.c
81
+ - ext/chupatext/extconf.rb
82
+ - extconf.rb
83
+ - lib/chupatext.rb
84
+ - lib/chupatext/version.rb
85
+ has_rdoc: true
86
+ homepage: http://groonga.rubyforge.org/
87
+ licenses: []
88
+
89
+ post_install_message:
90
+ rdoc_options:
91
+ - --main
92
+ - README.txt
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ hash: 3
101
+ segments:
102
+ - 0
103
+ version: "0"
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ hash: 3
110
+ segments:
111
+ - 0
112
+ version: "0"
113
+ requirements: []
114
+
115
+ rubyforge_project: groonga
116
+ rubygems_version: 1.3.7
117
+ signing_key:
118
+ specification_version: 3
119
+ summary: Ruby bindings for ChupaText
120
+ test_files: []
121
+