rcee_system 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a7c664ec9bf7164bf409808c01388459d95b09eb9612b71c68297d930ea9d350
4
+ data.tar.gz: 3a8f12c1501e564f82d9c263cf4945c8bb689c8955b09b5dd9b1ead95358cf45
5
+ SHA512:
6
+ metadata.gz: a68f4616208fb9d39417fc8bca4568fd15b39e6b809756c21be58dc127e4109b48a7377b9f64b8a5e149fdc47df0712f4b03ab508c3d4f8e0fa94f0c33ac08b2
7
+ data.tar.gz: 38b2296af87d4182f66a2926191c1858fcb5c0c95cb9521f15f7845c69b2a2c3fc79fe8356e8e399e6ce7be23aa88fc8e226a0a72d1b089a58f0354681c6f3fa
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.bundle
10
+ *.so
11
+ *.o
12
+ *.a
13
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in system.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rake-compiler"
11
+
12
+ gem "minitest", "~> 5.0"
data/README.md ADDED
@@ -0,0 +1,2 @@
1
+
2
+ This gem is part of the Ruby C Extensions Explained project at https://github.com/flavorjones/ruby-c-extensions-explained
data/Rakefile ADDED
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+ require "rubygems/package_task"
6
+
7
+ rcee_system_spec = Bundler.load_gemspec("rcee_system.gemspec")
8
+ Gem::PackageTask.new(rcee_system_spec).define
9
+
10
+ Rake::TestTask.new(:test) do |t|
11
+ t.libs << "test"
12
+ t.libs << "lib"
13
+ t.test_files = FileList["test/**/*_test.rb"]
14
+ end
15
+
16
+ require "rake/extensiontask"
17
+
18
+ task build: :compile
19
+
20
+ Rake::ExtensionTask.new("system") do |ext|
21
+ ext.lib_dir = "lib/rcee/system"
22
+ end
23
+
24
+ task default: %i[clobber compile test]
25
+
26
+ CLEAN.add("{ext,lib}/**/*.{o,so}")
@@ -0,0 +1,7 @@
1
+ require "mkmf"
2
+
3
+ unless find_header("yaml.h") && find_library("yaml", "yaml_get_version")
4
+ abort("\nERROR: *** could not find libyaml development environment ***\n\n")
5
+ end
6
+
7
+ create_makefile("rcee/system/system")
@@ -0,0 +1,26 @@
1
+ #include "system.h"
2
+
3
+ VALUE rb_mRCEE;
4
+ VALUE rb_mSystem;
5
+ VALUE rb_cSystemExtension;
6
+
7
+ static VALUE
8
+ rb_system_extension_class_do_something(VALUE self)
9
+ {
10
+ int major, minor, patch;
11
+
12
+ yaml_get_version(&major, &minor, &patch);
13
+
14
+ return rb_sprintf("libyaml version %d.%d.%d", major, minor, patch);
15
+ }
16
+
17
+
18
+ void
19
+ Init_system(void)
20
+ {
21
+ rb_mRCEE = rb_define_module("RCEE");
22
+ rb_mSystem = rb_define_module_under(rb_mRCEE, "System");
23
+ rb_cSystemExtension = rb_define_class_under(rb_mSystem, "Extension", rb_cObject);
24
+ rb_define_singleton_method(rb_cSystemExtension, "do_something",
25
+ rb_system_extension_class_do_something, 0);
26
+ }
@@ -0,0 +1,7 @@
1
+ #ifndef SYSTEM_H
2
+ #define SYSTEM_H 1
3
+
4
+ #include "ruby.h"
5
+ #include "yaml.h"
6
+
7
+ #endif /* SYSTEM_H */
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RCEE
4
+ module System
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "system/version"
4
+ require_relative "system/system"
5
+
6
+ module RCEE
7
+ module System
8
+ class Error < StandardError; end
9
+ # Your code goes here...
10
+ end
11
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/rcee/system/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "rcee_system"
7
+ spec.version = RCEE::System::VERSION
8
+ spec.authors = ["Mike Dalessio"]
9
+ spec.email = ["mike.dalessio@gmail.com"]
10
+
11
+ spec.summary = "Example gem demonstrating a basic C extension."
12
+ spec.description = "Part of a project to explain how Ruby C extensions work."
13
+ spec.homepage = "https://github.com/flavorjones/ruby-c-extensions-explained"
14
+ spec.required_ruby_version = ">= 2.4.0"
15
+ spec.license = "MIT"
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+ spec.extensions = ["ext/system/extconf.rb"]
26
+
27
+ # Uncomment to register a new dependency of your gem
28
+ # spec.add_dependency "example-gem", "~> 1.0"
29
+
30
+ # For more information and examples about making a new gem, checkout our
31
+ # guide at: https://bundler.io/guides/creating_gem.html
32
+ end
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rcee_system
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Mike Dalessio
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-09-02 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Part of a project to explain how Ruby C extensions work.
14
+ email:
15
+ - mike.dalessio@gmail.com
16
+ executables: []
17
+ extensions:
18
+ - ext/system/extconf.rb
19
+ extra_rdoc_files: []
20
+ files:
21
+ - ".gitignore"
22
+ - Gemfile
23
+ - README.md
24
+ - Rakefile
25
+ - ext/system/extconf.rb
26
+ - ext/system/system.c
27
+ - ext/system/system.h
28
+ - lib/rcee/system.rb
29
+ - lib/rcee/system/version.rb
30
+ - rcee_system.gemspec
31
+ homepage: https://github.com/flavorjones/ruby-c-extensions-explained
32
+ licenses:
33
+ - MIT
34
+ metadata: {}
35
+ post_install_message:
36
+ rdoc_options: []
37
+ require_paths:
38
+ - lib
39
+ required_ruby_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 2.4.0
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ requirements: []
50
+ rubygems_version: 3.2.15
51
+ signing_key:
52
+ specification_version: 4
53
+ summary: Example gem demonstrating a basic C extension.
54
+ test_files: []