Switch gem API to constants only
authorSeba Gamboa <[email protected]>
Sun, 6 Sep 2015 15:57:31 +0000 (6 12:57 -0300)
committerSeba Gamboa <[email protected]>
Sun, 6 Sep 2015 15:57:31 +0000 (6 12:57 -0300)
lib/mruby/source.rb [moved from lib/mruby/source/version.rb with 81% similarity]
lib/mruby/source/path.rb [deleted file]
mruby-source.gemspec

similarity index 81%
rename from lib/mruby/source/version.rb
rename to lib/mruby/source.rb
index 5554d26..b69ca6e 100644 (file)
@@ -1,9 +1,12 @@
-require "mruby/source/path"
+require "pathname"
 
 module MRuby
   module Source
+    # MRuby's source root directory
+    ROOT = Pathname.new(File.expand_path('../../../',__FILE__))
+
     # Reads a constant defined at version.h
-    MRUBY_READ_VERSION_CONSTANT = -> (name) { Source.path.join('include','mruby','version.h').read.match(/^#define #{name} +"?([\w\. ]+)"?$/)[1] }
+    MRUBY_READ_VERSION_CONSTANT = -> (name) { ROOT.join('include','mruby','version.h').read.match(/^#define #{name} +"?([\w\. ]+)"?$/)[1] }
 
     MRUBY_RUBY_VERSION = MRUBY_READ_VERSION_CONSTANT['MRUBY_RUBY_VERSION']
     MRUBY_RUBY_ENGINE = MRUBY_READ_VERSION_CONSTANT['MRUBY_RUBY_ENGINE']
diff --git a/lib/mruby/source/path.rb b/lib/mruby/source/path.rb
deleted file mode 100644 (file)
index dbeaef5..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-require "pathname"
-
-module MRuby
-  module Source
-    def self.path
-      Pathname.new(File.expand_path('../../../../',__FILE__))
-    end
-  end
-end
index 07103c9..62d4c0d 100644 (file)
@@ -1,7 +1,7 @@
 # coding: utf-8
 lib = File.expand_path('../lib', __FILE__)
 $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
-require 'mruby/source/version'
+require 'mruby/source'
 
 Gem::Specification.new do |spec|
   spec.name          = "mruby-source"