hello_ext 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.DS_Store ADDED
Binary file
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in hello_ext.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require 'bundler'
2
+ require "rake/extensiontask"
3
+
4
+ Rake::ExtensionTask.new("grammar")
5
+ #task :build => [:clean, :compile]
6
+
7
+ Bundler::GemHelper.install_tasks
data/ext/.DS_Store ADDED
Binary file
Binary file
@@ -0,0 +1,3 @@
1
+ require 'mkmf'
2
+
3
+ create_makefile('grammar')
@@ -0,0 +1,17 @@
1
+ #include "ruby.h"
2
+ #include "grammar.h"
3
+
4
+ void Init_grammar() {
5
+ VALUE Grammar = rb_define_module("Grammar");
6
+ rb_define_module_function(Grammar, "hello", hello, 1); //last int is for number of input args
7
+ rb_define_method(Grammar, "bye", bye, 1);
8
+ }
9
+
10
+ VALUE hello(const VALUE self, volatile VALUE name) {
11
+ char *r = StringValuePtr(name);
12
+ return rb_str_new2(r);
13
+ }
14
+
15
+ VALUE bye(const VALUE self, volatile VALUE name) {
16
+ return rb_str_new2("peace out");
17
+ }
@@ -0,0 +1,3 @@
1
+ VALUE hello(VALUE, VALUE);
2
+ VALUE bye(VALUE, VALUE);
3
+
data/hello_ext.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "hello_ext/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "hello_ext"
7
+ s.version = HelloExt::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.extensions = ["ext/grammar/extconf.rb"]
10
+ s.authors = ["Quan Nguyen"]
11
+ s.email = ["mquannie@gmail.com"]
12
+ s.homepage = ""
13
+ s.summary = %q{hello world C extension}
14
+ s.description = %q{a test to build C extension gem}
15
+
16
+ s.rubyforge_project = "hello_ext"
17
+
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
22
+
23
+ s.add_dependency(%q<rake-compiler>)
24
+ end
data/lib/.DS_Store ADDED
Binary file
data/lib/hello_ext.rb ADDED
@@ -0,0 +1,19 @@
1
+ $: << File.dirname(__FILE__)
2
+ require 'grammar'
3
+
4
+ module HelloExt
5
+ class Test
6
+ include Grammar
7
+
8
+ def hola(name)
9
+ "hola, " + hello(name)
10
+ end
11
+
12
+ def adios(name)
13
+ bye(name)
14
+ end
15
+ end
16
+ end
17
+
18
+ #puts HelloExt::Test.new.hola('quan')
19
+
@@ -0,0 +1,3 @@
1
+ module HelloExt
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hello_ext
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Quan Nguyen
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-05-06 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rake-compiler
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ description: a test to build C extension gem
27
+ email:
28
+ - mquannie@gmail.com
29
+ executables: []
30
+
31
+ extensions:
32
+ - ext/grammar/extconf.rb
33
+ extra_rdoc_files: []
34
+
35
+ files:
36
+ - .DS_Store
37
+ - .gitignore
38
+ - Gemfile
39
+ - Rakefile
40
+ - ext/.DS_Store
41
+ - ext/grammar/.DS_Store
42
+ - ext/grammar/extconf.rb
43
+ - ext/grammar/grammar.c
44
+ - ext/grammar/grammar.h
45
+ - hello_ext.gemspec
46
+ - lib/.DS_Store
47
+ - lib/hello_ext.rb
48
+ - lib/hello_ext/version.rb
49
+ homepage: ""
50
+ licenses: []
51
+
52
+ post_install_message:
53
+ rdoc_options: []
54
+
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: "0"
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: "0"
69
+ requirements: []
70
+
71
+ rubyforge_project: hello_ext
72
+ rubygems_version: 1.7.2
73
+ signing_key:
74
+ specification_version: 3
75
+ summary: hello world C extension
76
+ test_files: []
77
+