Merge pull request #895 from matthiasbeyer/redo-ruby-build-setup
Redo ruby build setup
This commit is contained in:
commit
6fa281a1a4
11 changed files with 44 additions and 150 deletions
11
Makefile
11
Makefile
|
@ -47,15 +47,18 @@ bin: $(BIN_TARGETS) imag-bin
|
||||||
|
|
||||||
bin-test: $(BIN_TARGET_TESTS) imag-bin
|
bin-test: $(BIN_TARGET_TESTS) imag-bin
|
||||||
|
|
||||||
lib: $(LIB_TARGETS)
|
lib: $(LIB_TARGETS) lib-imag-ruby-tarball
|
||||||
@$(ECHO) "\t[ALLLIB ]"
|
@$(ECHO) "\t[ALLLIB ]"
|
||||||
|
|
||||||
lib-test: $(LIB_TARGETS_TEST)
|
lib-test: $(LIB_TARGETS_TEST)
|
||||||
|
|
||||||
lib-imag-ruby-test:
|
lib-imag-ruby-tarball:
|
||||||
@$(MAKE) -C libimagruby
|
@$(MAKE) -C libimagruby tarball
|
||||||
|
|
||||||
test: bin-test lib-test
|
lib-imag-ruby-test:
|
||||||
|
@$(MAKE) -C libimagruby 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:
|
tarball: bundle
|
||||||
$(MAKE) -C .. libimagruby-release
|
@$(ECHO) "[RAKE ][thermite]"
|
||||||
|
@CARGO_TARGET=debug $(BUNDLE) exec rake thermite:tarball
|
||||||
|
|
||||||
test: lib $(RUBY_TEST_TARGETS)
|
test: tarball
|
||||||
|
@$(ECHO) "[TEST ] Not yet implemented. :-("
|
||||||
$(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
|
||||||
|
|
|
@ -36,37 +36,37 @@ module Imag
|
||||||
debug = !!cfg[:debug]
|
debug = !!cfg[:debug]
|
||||||
verbose = !!cfg[:verbose]
|
verbose = !!cfg[:verbose]
|
||||||
color = !!cfg[:color]
|
color = !!cfg[:color]
|
||||||
RImag.init_logger debug, verbose, color
|
::RImag.init_logger debug, verbose, color
|
||||||
end
|
end
|
||||||
|
|
||||||
# Log text with "trace" level in imag
|
# Log text with "trace" level in imag
|
||||||
def self.trace msg
|
def self.trace msg
|
||||||
RImag.trace msg
|
::RImag.trace msg
|
||||||
end
|
end
|
||||||
|
|
||||||
# Log text with "debug" level in imag
|
# Log text with "debug" level in imag
|
||||||
def self.dbg msg
|
def self.dbg msg
|
||||||
RImag.dbg msg
|
::RImag.dbg msg
|
||||||
end
|
end
|
||||||
|
|
||||||
# Log text with "debug" level in imag (alias for Imag::Logger::dbg)
|
# Log text with "debug" level in imag (alias for Imag::Logger::dbg)
|
||||||
def self.debug msg
|
def self.debug msg
|
||||||
RImag.debug msg
|
::RImag.debug msg
|
||||||
end
|
end
|
||||||
|
|
||||||
# Log text with "info" level in imag
|
# Log text with "info" level in imag
|
||||||
def self.info msg
|
def self.info msg
|
||||||
RImag.info msg
|
::RImag.info msg
|
||||||
end
|
end
|
||||||
|
|
||||||
# Log text with "warning" level in imag
|
# Log text with "warning" level in imag
|
||||||
def self.warn msg
|
def self.warn msg
|
||||||
RImag.warn msg
|
::RImag.warn msg
|
||||||
end
|
end
|
||||||
|
|
||||||
# Log text with "error" level in imag
|
# Log text with "error" level in imag
|
||||||
def self.error msg
|
def self.error msg
|
||||||
RImag.error msg
|
::RImag.error msg
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -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,83 +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 "---"
|
|
||||||
|
|
||||||
[
|
|
||||||
:RImag,
|
|
||||||
:RStoreId,
|
|
||||||
:RStoreHandle,
|
|
||||||
:RFileLockEntryHandle,
|
|
||||||
:REntryHeader,
|
|
||||||
:REntryContent,
|
|
||||||
:RImagError,
|
|
||||||
:RImagObjDoesNotExistError,
|
|
||||||
:RImagStoreError,
|
|
||||||
:RImagStoreWriteError,
|
|
||||||
:RImagStoreReadError,
|
|
||||||
:RImagEntryError,
|
|
||||||
:RImagEntryHeaderError,
|
|
||||||
:RImagEntryHeaderReadError,
|
|
||||||
:RImagEntryHeaderWriteError,
|
|
||||||
:RImagTypeError,
|
|
||||||
].each do |sym|
|
|
||||||
if Kernel.const_defined? sym
|
|
||||||
RImag.info "Exists: #{sym}"
|
|
||||||
else
|
|
||||||
RImag.error "#{sym} not defined"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
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