Merge pull request #871 from matthiasbeyer/ruby-build-setup
Ruby build setup
This commit is contained in:
commit
c43538d517
12 changed files with 78 additions and 123 deletions
44
.travis.yml
44
.travis.yml
|
@ -1,14 +1,40 @@
|
||||||
sudo: false
|
sudo: false
|
||||||
|
os:
|
||||||
|
- linux
|
||||||
|
|
||||||
|
dist:
|
||||||
|
- trusty
|
||||||
|
|
||||||
language: rust
|
language: rust
|
||||||
rust:
|
|
||||||
- 1.13.0
|
matrix:
|
||||||
- beta
|
include:
|
||||||
- stable
|
- rust: 1.13.0
|
||||||
cache: cargo
|
env: IMAG_RUBY_VERSION=2.3.3
|
||||||
|
- rust: beta
|
||||||
|
env: IMAG_RUBY_VERSION=2.3.3
|
||||||
|
- rust: stable
|
||||||
|
env: IMAG_RUBY_VERSION=2.3.3
|
||||||
|
|
||||||
|
cache:
|
||||||
|
cargo: true
|
||||||
|
directories:
|
||||||
|
- $TRAVIS_BUILD_DIR/libimagruby/vendor/bundle
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- |
|
||||||
|
rvm install "$IMAG_RUBY_VERSION"
|
||||||
|
rvm use "$IMAG_RUBY_VERSION"
|
||||||
|
ruby --version
|
||||||
|
pushd libimagruby
|
||||||
|
bundle install --jobs=3 --retry=3 --path=$TRAVIS_BUILD_DIR/libimagruby/vendor/bundle
|
||||||
|
popd
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- |
|
- |
|
||||||
pip install 'travis-cargo<0.2' --user &&
|
pip install 'travis-cargo<0.2' --user &&
|
||||||
export PATH=$HOME/.local/bin:$PATH
|
export PATH=$HOME/.local/bin:$PATH
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- |
|
- |
|
||||||
make all test
|
make all test
|
||||||
|
@ -25,12 +51,14 @@ addons:
|
||||||
- tree
|
- tree
|
||||||
sources:
|
sources:
|
||||||
- kalakris-cmake
|
- kalakris-cmake
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
- |
|
- |
|
||||||
pushd .imag-documentation &&
|
pushd .imag-documentation &&
|
||||||
travis-cargo --only stable doc &&
|
travis-cargo --only stable doc &&
|
||||||
travis-cargo --only stable doc-upload
|
travis-cargo --only stable doc-upload
|
||||||
popd
|
popd
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
on_success: never
|
on_success: never
|
||||||
|
@ -39,7 +67,11 @@ notifications:
|
||||||
- chat.freenode.net#imag
|
- chat.freenode.net#imag
|
||||||
template:
|
template:
|
||||||
- "%{repository_name} (%{branch} @ %{commit} by %{author}): %{result}"
|
- "%{repository_name} (%{branch} @ %{commit} by %{author}): %{result}"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- TRAVIS_CARGO_NIGHTLY_FEATURE=dev
|
- THERMITE_DEBUG_FILENAME=/tmp/thermite-debug.log
|
||||||
- secure: D+3exBnbvzFvk7fvLOxkF7UotCc4gBbvvOW4xGr9u6dDjEjV5y6CdDy/OQAkhfKhvSou+lIC22g5MuCBQXFEf/ua7A1XzwBAFeVLK4cWZSa7+ql6LdHKqOg3oF6pQlh095WeWr8S2PYJFFJFg8RGUPnbjqdu1J4KSXqe/7GoZ3lYS69mx7D5Hb93KEN084/KGfBuvyJtMjO1fK3spltL2zV8oqegFpv0gLG5GY4LsJ/7ij4Mc6wepXSyyQbaiA1eKMMwQZDvoi4V1mCulo/jeC3pucGxvgnMV5DZs8aa8R7votltGvSpHCgU78LW19dg8oZqwShQQ+XUYw27H+QK5V1lz1l1MaJLbwS3ySyZBPGH8qUuOzQ3bLp9xhAIRgCui3kX/UDhmeME7nJI6k3UZydh+/ydNB1BZHTKn76XS/yFj0Gcibxg7f5fcAYA6Ge5Sg+YPozuwbcKnKe6IpN2M7qNgWa+6MCSXJ1v4BgPb7kN74EynJUM8+yWEFN7MZtWEUQ4ZsHdCs8Pub4C/zHpYGV8qGenZwQzosAFq56YwoGCvJezz35yg4BDd3IMKenOzNnXLBrdxxqX8ySgwt5B3zBqwve/64Lx6OXjae2m8wZKlsmeqad/s6K7nx0zG15/qqRIzyvgcLXq3jwBaHkteq49FRFWvHQFpBQcsPZ2uH4=
|
- secure: D+3exBnbvzFvk7fvLOxkF7UotCc4gBbvvOW4xGr9u6dDjEjV5y6CdDy/OQAkhfKhvSou+lIC22g5MuCBQXFEf/ua7A1XzwBAFeVLK4cWZSa7+ql6LdHKqOg3oF6pQlh095WeWr8S2PYJFFJFg8RGUPnbjqdu1J4KSXqe/7GoZ3lYS69mx7D5Hb93KEN084/KGfBuvyJtMjO1fK3spltL2zV8oqegFpv0gLG5GY4LsJ/7ij4Mc6wepXSyyQbaiA1eKMMwQZDvoi4V1mCulo/jeC3pucGxvgnMV5DZs8aa8R7votltGvSpHCgU78LW19dg8oZqwShQQ+XUYw27H+QK5V1lz1l1MaJLbwS3ySyZBPGH8qUuOzQ3bLp9xhAIRgCui3kX/UDhmeME7nJI6k3UZydh+/ydNB1BZHTKn76XS/yFj0Gcibxg7f5fcAYA6Ge5Sg+YPozuwbcKnKe6IpN2M7qNgWa+6MCSXJ1v4BgPb7kN74EynJUM8+yWEFN7MZtWEUQ4ZsHdCs8Pub4C/zHpYGV8qGenZwQzosAFq56YwoGCvJezz35yg4BDd3IMKenOzNnXLBrdxxqX8ySgwt5B3zBqwve/64Lx6OXjae2m8wZKlsmeqad/s6K7nx0zG15/qqRIzyvgcLXq3jwBaHkteq49FRFWvHQFpBQcsPZ2uH4=
|
||||||
|
matrix:
|
||||||
|
- IMAG_RUBY_VERSION=2.3.3
|
||||||
|
- IMAG_RUBY_VERSION=2.4.0
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -68,9 +68,9 @@ lib: $(LIB_TARGETS)
|
||||||
lib-test: $(LIB_TARGETS_TEST)
|
lib-test: $(LIB_TARGETS_TEST)
|
||||||
|
|
||||||
lib-imag-ruby-test:
|
lib-imag-ruby-test:
|
||||||
@$(MAKE) -C libimagruby
|
@$(MAKE) -C libimagruby test
|
||||||
|
|
||||||
test: bin-test lib-test
|
test: bin-test lib-test lib-imag-ruby-test
|
||||||
|
|
||||||
install: $(INSTALL_TARGETS) imag-bin-install
|
install: $(INSTALL_TARGETS) imag-bin-install
|
||||||
@$(ECHO) "\t[INSTALL]"
|
@$(ECHO) "\t[INSTALL]"
|
||||||
|
|
|
@ -7,6 +7,8 @@ let
|
||||||
];
|
];
|
||||||
|
|
||||||
dependencies = with pkgs; [
|
dependencies = with pkgs; [
|
||||||
|
ruby
|
||||||
|
bundler
|
||||||
cmake
|
cmake
|
||||||
curl
|
curl
|
||||||
gcc
|
gcc
|
||||||
|
|
2
libimagruby/.gitignore
vendored
2
libimagruby/.gitignore
vendored
|
@ -1,3 +1,5 @@
|
||||||
.bundle
|
.bundle
|
||||||
Gemfile.lock
|
Gemfile.lock
|
||||||
|
lib/liblibimagruby.so
|
||||||
vendor/bundle
|
vendor/bundle
|
||||||
|
libimagruby*.tar.gz
|
||||||
|
|
|
@ -1,20 +1,22 @@
|
||||||
ECHO=$(shell which echo) -e
|
ECHO=$(shell which echo) -e
|
||||||
RUBY=$(shell which ruby)
|
RUBY=$(shell which ruby)
|
||||||
RUBY_TESTS=$(shell find ./test -maxdepth 1 -name "*.rb" -type f)
|
BUNDLE=$(shell which bundle)
|
||||||
RUBY_TEST_TARGETS=$(foreach x,$(subst ,,$(RUBY_TESTS)),$(x))
|
|
||||||
|
|
||||||
all: lib
|
all:
|
||||||
|
@$(ECHO) "There is no default target here"
|
||||||
|
|
||||||
lib:
|
bundle:
|
||||||
$(MAKE) -C .. libimagruby
|
@$(ECHO) "[BUNDLE]"
|
||||||
|
@$(BUNDLE) install --path vendor/bundle
|
||||||
|
|
||||||
lib-release:
|
bundle-rake-thermite-test:
|
||||||
$(MAKE) -C .. libimagruby-release
|
@$(ECHO) "[RAKE ][thermite]"
|
||||||
|
@CARGO_TARGET=debug $(BUNDLE) exec rake thermite:tarball
|
||||||
|
|
||||||
test: lib $(RUBY_TEST_TARGETS)
|
test: lib bundle-rake-thermite-test
|
||||||
|
@$(ECHO) "[TEST ]"
|
||||||
$(RUBY_TEST_TARGETS): %: lib .FORCE
|
|
||||||
@$(ECHO) "\t[TEST ]:\t$@"
|
|
||||||
@$(RUBY) $(subst -test,,$@)
|
|
||||||
|
|
||||||
.FORCE:
|
.FORCE:
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,5 @@
|
||||||
require "bundler/gem_tasks"
|
require "bundler/gem_tasks"
|
||||||
task :default => :spec
|
require 'thermite/tasks'
|
||||||
|
|
||||||
|
Thermite::Tasks.new(cargo_project_path: "..", cargo_workspace_member: "libimagruby")
|
||||||
|
|
||||||
|
|
5
libimagruby/ext/Rakefile
Normal file
5
libimagruby/ext/Rakefile
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
require 'thermite/tasks'
|
||||||
|
|
||||||
|
Thermite::Tasks.new(cargo_project_path: "..", cargo_workspace_member: "libimagruby")
|
||||||
|
task default: %w(thermite:build)
|
||||||
|
|
|
@ -23,4 +23,7 @@ Gem::Specification.new do |spec|
|
||||||
|
|
||||||
spec.add_development_dependency "bundler", "~> 1.13"
|
spec.add_development_dependency "bundler", "~> 1.13"
|
||||||
spec.add_development_dependency "rake", "~> 10.0"
|
spec.add_development_dependency "rake", "~> 10.0"
|
||||||
|
spec.add_development_dependency 'thermite', "~> 0.11", ">= 0.11.1"
|
||||||
|
|
||||||
|
spec.extensions << 'ext/Rakefile'
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
require 'thermite/fiddle'
|
||||||
|
|
||||||
|
toplevel_dir = File.dirname(File.dirname(__FILE__))
|
||||||
|
Thermite::Fiddle.load_module('init_imag',
|
||||||
|
cargo_project_path: toplevel_dir,
|
||||||
|
ruby_project_path: toplevel_dir)
|
||||||
|
|
||||||
module Imag
|
module Imag
|
||||||
|
|
||||||
IMAG_INIT_FN_NAME = 'imag_ruby_initialize'
|
IMAG_INIT_FN_NAME = 'imag_ruby_initialize'
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
#!/usr/bin/env ruby
|
|
||||||
|
|
||||||
require "../target/debug/liblibimagruby.so"
|
|
||||||
|
|
||||||
color = true
|
|
||||||
verbose = true
|
|
||||||
debug = false
|
|
||||||
|
|
||||||
RImag.init_logger debug, verbose, color
|
|
||||||
|
|
||||||
store_handle = RStoreHandle::new(false, "/tmp/store")
|
|
||||||
id = RStoreId::new_baseless("test")
|
|
||||||
test_handle = store_handle.retrieve(id)
|
|
||||||
puts "Header: #{test_handle.header.to_s}"
|
|
||||||
puts "Content: '#{test_handle.content}'"
|
|
||||||
|
|
||||||
test_handle.content = "Foo"
|
|
||||||
test_handle.header = {
|
|
||||||
"imag" => {
|
|
||||||
"links" => [],
|
|
||||||
"version" => "0.2.0"
|
|
||||||
},
|
|
||||||
"example" => {
|
|
||||||
"test" => "foo"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
#!/usr/bin/env ruby
|
|
||||||
|
|
||||||
require "../target/debug/liblibimagruby.so"
|
|
||||||
|
|
||||||
color = true
|
|
||||||
verbose = true
|
|
||||||
debug = true
|
|
||||||
|
|
||||||
RImag.init_logger debug, verbose, color
|
|
||||||
|
|
||||||
RImag.trace "Trace-Hello from Ruby"
|
|
||||||
RImag.dbg "Debug-Hello from Ruby"
|
|
||||||
RImag.debug "Debug-Hello from Ruby"
|
|
||||||
RImag.info "Info-Hello from Ruby"
|
|
||||||
RImag.warn "Warn-Hello from Ruby"
|
|
||||||
RImag.error "Error-Hello from Ruby"
|
|
||||||
|
|
||||||
def works name, b
|
|
||||||
if b
|
|
||||||
RImag.info "Works: #{name}"
|
|
||||||
else
|
|
||||||
RImag.error "Fails: #{name}"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def has_instance_method klass, meth
|
|
||||||
works "#{klass}.instance_methods.include? #{meth}",
|
|
||||||
(klass.instance_methods.include? meth)
|
|
||||||
end
|
|
||||||
|
|
||||||
puts "---"
|
|
||||||
|
|
||||||
works "RStoreId.new_baseless", (not RStoreId.new_baseless("test").nil?)
|
|
||||||
|
|
||||||
works "RStoreHandle.respond_to? :new", (RStoreHandle.respond_to? :new)
|
|
||||||
|
|
||||||
has_instance_method RStoreHandle, :create
|
|
||||||
has_instance_method RStoreHandle, :get
|
|
||||||
has_instance_method RStoreHandle, :retrieve
|
|
||||||
has_instance_method RStoreHandle, :delete
|
|
||||||
has_instance_method RStoreHandle, :update
|
|
||||||
has_instance_method RStoreHandle, :move_by_id
|
|
||||||
has_instance_method RStoreHandle, :save_as
|
|
||||||
has_instance_method RStoreHandle, :save_to
|
|
||||||
|
|
||||||
has_instance_method RFileLockEntryHandle, :content
|
|
||||||
has_instance_method RFileLockEntryHandle, :content=
|
|
||||||
has_instance_method RFileLockEntryHandle, :header
|
|
||||||
has_instance_method RFileLockEntryHandle, :header=
|
|
||||||
|
|
||||||
has_instance_method REntryHeader, :read
|
|
||||||
has_instance_method REntryHeader, :[]
|
|
||||||
has_instance_method REntryHeader, :set
|
|
||||||
has_instance_method REntryHeader, :[]=
|
|
||||||
has_instance_method REntryHeader, :insert
|
|
||||||
|
|
||||||
works "REntryContent.superclass == String", (REntryContent.superclass == String)
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
#!/usr/bin/env ruby
|
|
||||||
|
|
||||||
require "../target/debug/liblibimagruby.so"
|
|
||||||
|
|
||||||
color = true
|
|
||||||
verbose = true
|
|
||||||
debug = true
|
|
||||||
|
|
||||||
RImag.init_logger debug, verbose, color
|
|
||||||
|
|
||||||
store_handle = RStoreHandle::new(false, "/tmp/store")
|
|
||||||
id = RStoreId::new_baseless("test")
|
|
||||||
test_handle = store_handle.create(id)
|
|
||||||
|
|
||||||
RImag.info "Created #{test_handle.location.to_str} from Ruby"
|
|
||||||
|
|
Loading…
Reference in a new issue