Rename: Imag -> RImag (class)
This commit is contained in:
parent
916d647a24
commit
e929a0ccf1
9 changed files with 66 additions and 30 deletions
1
libimagruby/.gitignore
vendored
Normal file
1
libimagruby/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
vendor/bundle
|
4
libimagruby/Gemfile
Normal file
4
libimagruby/Gemfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec
|
2
libimagruby/Rakefile
Normal file
2
libimagruby/Rakefile
Normal file
|
@ -0,0 +1,2 @@
|
|||
require "bundler/gem_tasks"
|
||||
task :default => :spec
|
26
libimagruby/imag.gemspec
Normal file
26
libimagruby/imag.gemspec
Normal file
|
@ -0,0 +1,26 @@
|
|||
# coding: utf-8
|
||||
lib = File.expand_path('../lib', __FILE__)
|
||||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
||||
require 'imag/version'
|
||||
|
||||
Gem::Specification.new do |spec|
|
||||
spec.name = "imag"
|
||||
spec.version = Imag::VERSION
|
||||
spec.authors = ["Matthias Beyer"]
|
||||
spec.email = ["mail@beyermatthias.de"]
|
||||
|
||||
spec.summary = %q{A Ruby gem to script imag.}
|
||||
spec.description = %q{A Ruby gem to script imag, the personal information management suite for the commandline}
|
||||
spec.homepage = "http://imag-pim.org"
|
||||
|
||||
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
||||
f.match(%r{^(test|spec|features)/})
|
||||
end
|
||||
|
||||
spec.bindir = "exe"
|
||||
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
||||
spec.require_paths = ["lib"]
|
||||
|
||||
spec.add_development_dependency "bundler", "~> 1.13"
|
||||
spec.add_development_dependency "rake", "~> 10.0"
|
||||
end
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
module RubyImag
|
||||
module Imag
|
||||
|
||||
IMAG_INIT_FN_NAME = 'imag_ruby_initialize'
|
||||
|
||||
|
@ -14,31 +14,31 @@ module RubyImag
|
|||
module Logger
|
||||
|
||||
def self.init debug, verbose, color
|
||||
Imag.init_logger debug, verbose, color
|
||||
RImag.init_logger debug, verbose, color
|
||||
end
|
||||
|
||||
def self.trace msg
|
||||
Imag.trace msg
|
||||
RImag.trace msg
|
||||
end
|
||||
|
||||
def self.dbg msg
|
||||
Imag.dbg msg
|
||||
RImag.dbg msg
|
||||
end
|
||||
|
||||
def self.debug msg
|
||||
Imag.debug msg
|
||||
RImag.debug msg
|
||||
end
|
||||
|
||||
def self.info msg
|
||||
Imag.info msg
|
||||
RImag.info msg
|
||||
end
|
||||
|
||||
def self.warn msg
|
||||
Imag.warn msg
|
||||
RImag.warn msg
|
||||
end
|
||||
|
||||
def self.error msg
|
||||
Imag.error msg
|
||||
RImag.error msg
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -57,7 +57,7 @@ module RubyImag
|
|||
|
||||
def self.core_setup
|
||||
self.class_names.map {|n| [n, "R#{n}".to_sym ] }.each do |elem|
|
||||
RubyImag.const_set elem.first, Kernel.const_get(elem.last)
|
||||
Imag.const_set elem.first, Kernel.const_get(elem.last)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -66,7 +66,7 @@ module RubyImag
|
|||
end
|
||||
|
||||
def self.class_storeid_setup
|
||||
RubyImag::StoreId.class_exec do
|
||||
Imag::StoreId.class_exec do
|
||||
def to_s
|
||||
self.to_str
|
||||
end
|
||||
|
@ -79,18 +79,18 @@ if __FILE__ == $0
|
|||
puts "Running some tests..."
|
||||
puts "I hope you passed the library object as first argument..."
|
||||
begin
|
||||
RubyImag.setup ARGV.first
|
||||
Imag.setup ARGV.first
|
||||
rescue Exception => e
|
||||
puts "Seems not to be the case... or something else went wrong..."
|
||||
puts e
|
||||
exit 1
|
||||
end
|
||||
|
||||
RubyImag::Logger.init true, true, true
|
||||
RubyImag::Logger.info "The Logger should work now"
|
||||
Imag::Logger.init true, true, true
|
||||
Imag::Logger.info "The Logger should work now"
|
||||
|
||||
RubyImag::Logger.info "Lets see whether we have properly setup StoreId"
|
||||
RubyImag::Logger.info RubyImag::StoreId::new_baseless("baselessId").to_s
|
||||
RubyImag::Logger.info "Seems good."
|
||||
Imag::Logger.info "Lets see whether we have properly setup StoreId"
|
||||
Imag::Logger.info Imag::StoreId::new_baseless("baselessId").to_s
|
||||
Imag::Logger.info "Seems good."
|
||||
end
|
||||
|
3
libimagruby/lib/imag/version.rb
Normal file
3
libimagruby/lib/imag/version.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
module Imag
|
||||
VERSION = "0.1.0"
|
||||
end
|
|
@ -24,10 +24,10 @@ use ruru::{Class, Boolean, RString, NilClass, VM, Object};
|
|||
|
||||
use libimagrt::logger::ImagLogger;
|
||||
|
||||
class!(Imag);
|
||||
class!(RImag);
|
||||
|
||||
methods!(
|
||||
Imag,
|
||||
RImag,
|
||||
itself,
|
||||
|
||||
fn r_initialize_logger(debug: Boolean, verbose: Boolean, colored: Boolean) -> NilClass {
|
||||
|
@ -133,7 +133,7 @@ methods!(
|
|||
);
|
||||
|
||||
pub fn setup() -> Class {
|
||||
let mut class = Class::new("Imag", None);
|
||||
let mut class = Class::new("RImag", None);
|
||||
class.define(|itself| {
|
||||
itself.def_self("init_logger", r_initialize_logger);
|
||||
itself.def_self("trace", r_log_trace);
|
||||
|
|
|
@ -6,20 +6,20 @@ color = true
|
|||
verbose = true
|
||||
debug = true
|
||||
|
||||
Imag.init_logger debug, verbose, color
|
||||
RImag.init_logger debug, verbose, color
|
||||
|
||||
Imag.trace "Trace-Hello from Ruby"
|
||||
Imag.dbg "Debug-Hello from Ruby"
|
||||
Imag.debug "Debug-Hello from Ruby"
|
||||
Imag.info "Info-Hello from Ruby"
|
||||
Imag.warn "Warn-Hello from Ruby"
|
||||
Imag.error "Error-Hello from Ruby"
|
||||
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
|
||||
Imag.info "Works: #{name}"
|
||||
RImag.info "Works: #{name}"
|
||||
else
|
||||
Imag.error "Fails: #{name}"
|
||||
RImag.error "Fails: #{name}"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -6,11 +6,11 @@ color = true
|
|||
verbose = true
|
||||
debug = true
|
||||
|
||||
Imag.init_logger debug, verbose, color
|
||||
RImag.init_logger debug, verbose, color
|
||||
|
||||
store_handle = RStoreHandle::new(false, "/tmp/store")
|
||||
id = RStoreId::new_baseless("test")
|
||||
test_handle = store_handle.create(id)
|
||||
|
||||
Imag.info "Created #{test_handle.location.to_str} from Ruby"
|
||||
RImag.info "Created #{test_handle.location.to_str} from Ruby"
|
||||
|
||||
|
|
Loading…
Reference in a new issue