rcee_packaged_tarball 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: 94aff18604fd7cea4d81c63e7a9d0e0b2033e54033eb0f31dd0e872eac402cf7
4
+ data.tar.gz: 575d01f6a28b27dc8aed8ea3d2e72407b84c0157ec5045c41ec3d4de56c8a739
5
+ SHA512:
6
+ metadata.gz: cbe2df47548769b59d5ae37783285d842e3c5cca5a8dfd1a34c5e0bc3a150d1f98792acec9603da482e99674f76888242d89d4882329c2d7dc030a676fc122dc
7
+ data.tar.gz: 51a64ecd816d0efd538ff654961a67af87cc6703c347a2bae8fe0080bf980abb9006cc4f1ddfa1b61c0b8b0c6a2e789ad5f9cbc8d3260fce21deff8901c19820
data/.gitignore ADDED
@@ -0,0 +1,14 @@
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
14
+ ports
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 packaged_tarball.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,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+ require "rubygems/package_task"
6
+
7
+ rcee_packaged_tarball_spec = Bundler.load_gemspec("rcee_packaged_tarball.gemspec")
8
+ Gem::PackageTask.new(rcee_packaged_tarball_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("packaged_tarball") do |ext|
21
+ ext.lib_dir = "lib/rcee/packaged_tarball"
22
+ end
23
+
24
+ task default: %i[clobber compile test]
25
+
26
+ CLOBBER.add("ports")
27
+ CLEAN.add("{ext,lib}/**/*.{o,so}")
@@ -0,0 +1,24 @@
1
+ require "mkmf"
2
+ require "mini_portile2"
3
+
4
+ package_root_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))
5
+
6
+ MiniPortile.new("yaml", "0.2.5").tap do |recipe|
7
+ recipe.files = [{
8
+ url: "https://github.com/yaml/libyaml/releases/download/0.2.5/yaml-0.2.5.tar.gz",
9
+ sha256: "c642ae9b75fee120b2d96c712538bd2cf283228d2337df2cf2988e3c02678ef4",
10
+ }]
11
+
12
+ recipe.target = File.join(package_root_dir, "ports")
13
+ unless File.exist?(File.join(recipe.target, recipe.host, recipe.name, recipe.version))
14
+ recipe.cook
15
+ end
16
+ recipe.activate
17
+ pkg_config(File.join(recipe.path, "lib", "pkgconfig", "yaml-0.1.pc"))
18
+ end
19
+
20
+ unless have_library("yaml", "yaml_get_version", "yaml.h")
21
+ abort("\nERROR: *** could not find libyaml development environment ***\n\n")
22
+ end
23
+
24
+ create_makefile("rcee/packaged_tarball/packaged_tarball")
@@ -0,0 +1,25 @@
1
+ #include "packaged_tarball.h"
2
+
3
+ VALUE rb_mRCEE;
4
+ VALUE rb_mPackagedTarball;
5
+ VALUE rb_cPackagedTarballExtension;
6
+
7
+ static VALUE
8
+ rb_packaged_tarball_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
+ void
18
+ Init_packaged_tarball(void)
19
+ {
20
+ rb_mRCEE = rb_define_module("RCEE");
21
+ rb_mPackagedTarball = rb_define_module_under(rb_mRCEE, "PackagedTarball");
22
+ rb_cPackagedTarballExtension = rb_define_class_under(rb_mPackagedTarball, "Extension", rb_cObject);
23
+ rb_define_singleton_method(rb_cPackagedTarballExtension, "do_something",
24
+ rb_packaged_tarball_extension_class_do_something, 0);
25
+ }
@@ -0,0 +1,7 @@
1
+ #ifndef PACKAGED_TARBALL_H
2
+ #define PACKAGED_TARBALL_H 1
3
+
4
+ #include "ruby.h"
5
+ #include "yaml.h"
6
+
7
+ #endif /* PACKAGED_TARBALL_H */
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RCEE
4
+ module PackagedTarball
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "packaged_tarball/version"
4
+ require_relative "packaged_tarball/packaged_tarball"
5
+
6
+ module RCEE
7
+ module PackagedTarball
8
+ class Error < StandardError; end
9
+ # Your code goes here...
10
+ end
11
+ end
Binary file
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/rcee/packaged_tarball/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "rcee_packaged_tarball"
7
+ spec.version = RCEE::PackagedTarball::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.files << "ports/archives/yaml-0.2.5.tar.gz"
23
+
24
+ spec.bindir = "exe"
25
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ["lib"]
27
+ spec.extensions = ["ext/packaged_tarball/extconf.rb"]
28
+
29
+ spec.add_dependency "mini_portile2"
30
+
31
+ # For more information and examples about making a new gem, checkout our
32
+ # guide at: https://bundler.io/guides/creating_gem.html
33
+ end
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rcee_packaged_tarball
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
+ - !ruby/object:Gem::Dependency
14
+ name: mini_portile2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: Part of a project to explain how Ruby C extensions work.
28
+ email:
29
+ - mike.dalessio@gmail.com
30
+ executables: []
31
+ extensions:
32
+ - ext/packaged_tarball/extconf.rb
33
+ extra_rdoc_files: []
34
+ files:
35
+ - ".gitignore"
36
+ - Gemfile
37
+ - README.md
38
+ - Rakefile
39
+ - ext/packaged_tarball/extconf.rb
40
+ - ext/packaged_tarball/packaged_tarball.c
41
+ - ext/packaged_tarball/packaged_tarball.h
42
+ - lib/rcee/packaged_tarball.rb
43
+ - lib/rcee/packaged_tarball/version.rb
44
+ - ports/archives/yaml-0.2.5.tar.gz
45
+ - rcee_packaged_tarball.gemspec
46
+ homepage: https://github.com/flavorjones/ruby-c-extensions-explained
47
+ licenses:
48
+ - MIT
49
+ metadata: {}
50
+ post_install_message:
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: 2.4.0
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubygems_version: 3.2.15
66
+ signing_key:
67
+ specification_version: 4
68
+ summary: Example gem demonstrating a basic C extension.
69
+ test_files: []