gem_box 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # GemBox
2
+
3
+ A Ruby gem loading library to help with workflow when developing with multiple git repos
@@ -0,0 +1,3 @@
1
+ module GemBox
2
+ VERSION = '0.0.1'
3
+ end
data/lib/gem_box.rb ADDED
@@ -0,0 +1,42 @@
1
+ module GemBox
2
+ def self.load(&block)
3
+ if !block_given?
4
+ raise "GemBox: expecting a block."
5
+ end
6
+
7
+ gem_box = block.call
8
+ if !gem_box.is_a?(String) && !gem_box.is_a?(Array)
9
+ raise "GemBox: expecting a block that returns a string or array or strings."
10
+ end
11
+
12
+ # Path to the app trying to liad the lib via GemBox
13
+ caller_file = Kernel.eval('__FILE__', block.binding)
14
+
15
+ # Let's reverse traverse and find the root path (aka where the Gemfile is located)
16
+ seek_filepath = Proc.new do |filename, level|
17
+ path = File.expand_path("../"*level, caller_file)
18
+ if path != '/'
19
+ f = Dir[path+"/#{filename}"].first
20
+ f.nil? ? seek_filepath.call(filename, level+1) : f
21
+ end
22
+ end
23
+ gemfile_path = seek_filepath.call('Gemfile', 1)
24
+
25
+ if gemfile_path.nil?
26
+ raise "GemBox cannot find the projects Gemfile"
27
+ end
28
+
29
+ # Got it...
30
+ root_dir = File.expand_path('../..', gemfile_path)
31
+
32
+ # Load libs..
33
+ [gem_box].flatten.each do |gem_lib|
34
+ gem_lib_dir = root_dir+"/"+gem_lib+"/lib"
35
+ if File.exists?(gem_lib_dir)
36
+ $:.unshift gem_lib_dir
37
+ require gem_lib
38
+ end
39
+ end
40
+ end
41
+
42
+ end
data/lib/gembox.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'gem_box'
2
+ Gembox = GemBox
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gem_box
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Peter Kieltyka
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-30 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Gem loading library to help with workflow when developing with multiple
15
+ git repos
16
+ email:
17
+ - info@nulayer.com
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - lib/gem_box/version.rb
23
+ - lib/gem_box.rb
24
+ - lib/gembox.rb
25
+ - README.md
26
+ homepage: http://github.com/nulayer/gem_box
27
+ licenses: []
28
+ post_install_message:
29
+ rdoc_options: []
30
+ require_paths:
31
+ - lib
32
+ required_ruby_version: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ required_rubygems_version: !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: 1.3.6
44
+ requirements: []
45
+ rubyforge_project:
46
+ rubygems_version: 1.8.24
47
+ signing_key:
48
+ specification_version: 3
49
+ summary: Gem loading library to help with workflow when developing with multiple git
50
+ repos
51
+ test_files: []
52
+ has_rdoc: