summaryrefslogtreecommitdiffhomepage
path: root/sample
diff options
context:
space:
mode:
authorSeba Gamboa <[email protected]>2015-09-22 17:50:26 -0300
committerSeba Gamboa <[email protected]>2015-09-22 17:50:26 -0300
commit2fb5a297afb868dbe7bbd54526c7bc11819c41cd (patch)
treecabc656c05660dc01afc67018cc9be8501b44cd0 /sample
parent80ab1e961810a6b571517ac9625e998194fbd57b (diff)
downloadyard-mruby-2fb5a297afb868dbe7bbd54526c7bc11819c41cd.tar.gz
yard-mruby-2fb5a297afb868dbe7bbd54526c7bc11819c41cd.zip
Add sample gem project to test documentation generation
Diffstat (limited to 'sample')
-rw-r--r--sample/.gitignore5
-rw-r--r--sample/.inch.yml3
-rw-r--r--sample/.travis.yml2
-rw-r--r--sample/.yardopts1
-rw-r--r--sample/CODE_OF_CONDUCT.md13
-rw-r--r--sample/Gemfile4
-rw-r--r--sample/LICENSE.txt21
-rw-r--r--sample/README.md12
-rw-r--r--sample/build_config.rb9
-rw-r--r--sample/include/sample.h37
-rw-r--r--sample/mrbgem.rake15
-rw-r--r--sample/mrblib/sample.rb14
-rw-r--r--sample/src/sample.c32
-rw-r--r--sample/test/sample_spec.rb11
14 files changed, 179 insertions, 0 deletions
diff --git a/sample/.gitignore b/sample/.gitignore
new file mode 100644
index 0000000..630c121
--- /dev/null
+++ b/sample/.gitignore
@@ -0,0 +1,5 @@
+build
+.bundle
+Gemfile.lock
+doc
+.yardoc
diff --git a/sample/.inch.yml b/sample/.inch.yml
new file mode 100644
index 0000000..ceb1eb0
--- /dev/null
+++ b/sample/.inch.yml
@@ -0,0 +1,3 @@
+files:
+ included:
+ - mrblib/**/*.rb
diff --git a/sample/.travis.yml b/sample/.travis.yml
new file mode 100644
index 0000000..4a104b2
--- /dev/null
+++ b/sample/.travis.yml
@@ -0,0 +1,2 @@
+install: bundle install
+script: bundle exec mrb test
diff --git a/sample/.yardopts b/sample/.yardopts
new file mode 100644
index 0000000..3b09c69
--- /dev/null
+++ b/sample/.yardopts
@@ -0,0 +1 @@
+mrblib/**/*.rb - README.md LICENSE.txt
diff --git a/sample/CODE_OF_CONDUCT.md b/sample/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..ce9bee7
--- /dev/null
+++ b/sample/CODE_OF_CONDUCT.md
@@ -0,0 +1,13 @@
+# Contributor Code of Conduct
+
+As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
+
+We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
+
+Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
+
+Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
+
+This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
diff --git a/sample/Gemfile b/sample/Gemfile
new file mode 100644
index 0000000..25e93cd
--- /dev/null
+++ b/sample/Gemfile
@@ -0,0 +1,4 @@
+source 'https://rubygems.org'
+
+gem 'mruby-cli'
+gem 'mruby-source', github: 'sagmor/mruby'
diff --git a/sample/LICENSE.txt b/sample/LICENSE.txt
new file mode 100644
index 0000000..e86398b
--- /dev/null
+++ b/sample/LICENSE.txt
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 [PUT YOUR NAME HERE]
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/sample/README.md b/sample/README.md
new file mode 100644
index 0000000..1dea126
--- /dev/null
+++ b/sample/README.md
@@ -0,0 +1,12 @@
+# sample
+
+TODO: Write your README
+
+## Contributing
+
+Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/sample. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
+
+
+## License
+
+The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
diff --git a/sample/build_config.rb b/sample/build_config.rb
new file mode 100644
index 0000000..64d5cc9
--- /dev/null
+++ b/sample/build_config.rb
@@ -0,0 +1,9 @@
+MRuby::Build.new do |conf|
+ toolchain :gcc
+ enable_debug
+
+ conf.gem '.'
+
+ conf.enable_test
+end
+
diff --git a/sample/include/sample.h b/sample/include/sample.h
new file mode 100644
index 0000000..0fbae1a
--- /dev/null
+++ b/sample/include/sample.h
@@ -0,0 +1,37 @@
+#include "mruby.h"
+
+#ifndef SAMPLE_H
+#define SAMPLE_H
+
+/**
+ * Sample C API module definition
+ */
+MRB_BEGIN_DECL
+
+/**
+ * A Sample C API method definition
+ *
+ * @param mrb The MRuby state.
+ * @return some ruby value
+ */
+MRB_API mrb_value sample_api_method(mrb_state *mrb);
+
+/**
+ * Another API method, now inlined.
+ *
+ * @param value some ruby value
+ * @return the same value
+ */
+MRB_INLINE mrb_value sample_inline_method(mrb_value value)
+{
+ return value;
+}
+
+/**
+ * A sample deprecated method
+ */
+MRB_API mrb_deprecated void sample_deprecated_method( void );
+
+MRB_END_DECL
+
+#endif /* SAMPLE_H */
diff --git a/sample/mrbgem.rake b/sample/mrbgem.rake
new file mode 100644
index 0000000..3c5a3da
--- /dev/null
+++ b/sample/mrbgem.rake
@@ -0,0 +1,15 @@
+MRuby::Gem::Specification.new('sample') do |spec|
+ spec.license = 'MIT'
+ spec.author = 'TODO: Put your name here'
+ spec.summary = %q{TODO: Write a short summary of your gem.}
+ spec.version = '0.1.0'
+
+ # Add your runtime dependencies here
+ # spec.add_dependency('mruby-math', :core => 'mruby-math')
+
+
+ # Add your test dependencies here
+ if build.test_enabled?
+ spec.add_dependency('mruby-spec', :github => 'sagmor/mruby-spec')
+ end
+end
diff --git a/sample/mrblib/sample.rb b/sample/mrblib/sample.rb
new file mode 100644
index 0000000..1846b9b
--- /dev/null
+++ b/sample/mrblib/sample.rb
@@ -0,0 +1,14 @@
+module Sample
+
+ # A Sample test class
+ class Test
+
+ # Foo returns bar
+ #
+ # @return [String] bar!
+ def foo
+ return "bar"
+ end
+ end
+
+end
diff --git a/sample/src/sample.c b/sample/src/sample.c
new file mode 100644
index 0000000..43a9e3a
--- /dev/null
+++ b/sample/src/sample.c
@@ -0,0 +1,32 @@
+#include "sample.h"
+
+mrb_value sample_api_method(mrb_state *mrb)
+{
+ return mrb_nil_value();
+}
+
+void sample_deprecated_method( void )
+{
+}
+
+/**
+ * A sample Ruby method defined from C
+ */
+mrb_value mrb_Sample_Hello__world(mrb_state *mrb, mrb_value self)
+{
+ return sample_inline_method( mrb_str_new_cstr(mrb, "Hello World!" ) );
+}
+
+void
+mrb_sample_gem_init(mrb_state *mrb)
+{
+ struct RClass *Sample = mrb_define_module(mrb, "Sample");
+ struct RClass *Sample_Hello = mrb_define_class_under(mrb, Sample, "Hello", mrb->object_class);
+ mrb_define_method(mrb,Sample_Hello, "world", mrb_Sample_Hello__world, MRB_ARGS_NONE() );
+}
+
+void
+mrb_sample_gem_final(mrb_state *mrb)
+{
+ // Your C finalization code goes here
+}
diff --git a/sample/test/sample_spec.rb b/sample/test/sample_spec.rb
new file mode 100644
index 0000000..8369b9c
--- /dev/null
+++ b/sample/test/sample_spec.rb
@@ -0,0 +1,11 @@
+describe Sample::Test do
+ it "foos" do
+ expect(subject.foo).to eq "bar"
+ end
+end
+
+describe Sample::Hello do
+ it "salutes" do
+ expect(subject.world).to eq "Hello World!"
+ end
+end