Class: Gemfiler::BundlerShim
- Inherits:
-
Object
- Object
- Gemfiler::BundlerShim
- Defined in:
- lib/gemfiler/bundler_shim.rb
Instance Attribute Summary collapse
-
#cabinet ⇒ Object
readonly
Returns the value of attribute cabinet.
-
#gems ⇒ Object
Returns the value of attribute gems.
-
#has_gemspec ⇒ Object
Returns the value of attribute has_gemspec.
-
#ruby_version ⇒ Object
Returns the value of attribute ruby_version.
-
#sources ⇒ Object
Returns the value of attribute sources.
Instance Method Summary collapse
- #gather(source) ⇒ Object
- #gem(name, *args) ⇒ Object
- #gemspec ⇒ Object
- #gemspec? ⇒ Boolean
- #git(url, options = {}, &block) ⇒ Object
- #group(*names, &block) ⇒ Object
-
#initialize ⇒ BundlerShim
constructor
A new instance of BundlerShim.
- #platforms(*names, &block) ⇒ Object
- #ruby(version, engine = {}) ⇒ Object
- #source(source) ⇒ Object
Constructor Details
#initialize ⇒ BundlerShim
Returns a new instance of BundlerShim.
6 7 8 9 10 11 |
# File 'lib/gemfiler/bundler_shim.rb', line 6 def initialize @gems = [] @sources = [] @ruby_version = nil @has_gemspec = false end |
Instance Attribute Details
#cabinet ⇒ Object (readonly)
Returns the value of attribute cabinet.
4 5 6 |
# File 'lib/gemfiler/bundler_shim.rb', line 4 def cabinet @cabinet end |
#gems ⇒ Object
Returns the value of attribute gems.
3 4 5 |
# File 'lib/gemfiler/bundler_shim.rb', line 3 def gems @gems end |
#has_gemspec ⇒ Object
Returns the value of attribute has_gemspec.
3 4 5 |
# File 'lib/gemfiler/bundler_shim.rb', line 3 def has_gemspec @has_gemspec end |
#ruby_version ⇒ Object
Returns the value of attribute ruby_version.
3 4 5 |
# File 'lib/gemfiler/bundler_shim.rb', line 3 def ruby_version @ruby_version end |
#sources ⇒ Object
Returns the value of attribute sources.
3 4 5 |
# File 'lib/gemfiler/bundler_shim.rb', line 3 def sources @sources end |
Instance Method Details
#gather(source) ⇒ Object
13 14 15 16 |
# File 'lib/gemfiler/bundler_shim.rb', line 13 def gather(source) source = source.gsub /source[\s]+\:([\w_]+)/, "source(:\\1)" instance_eval(source) end |
#gem(name, *args) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/gemfiler/bundler_shim.rb', line 22 def gem(name, *args) return unless name.length > 0 gem = {name: name} case args.first when String gem[:version] = args.first when Hash gem.merge! args.first end gem[:groups] = @groups.map(&:to_s) if @groups gem[:platforms] = @platforms.map(&:to_s) if @platforms if @git gem[:git] = @git gem.merge! end if gem[:group] gem[:groups] ||= [] gem[:groups] << gem.delete(:group) end @gems << gem gem end |
#gemspec ⇒ Object
51 52 53 |
# File 'lib/gemfiler/bundler_shim.rb', line 51 def gemspec @has_gemspec = true end |
#gemspec? ⇒ Boolean
18 19 20 |
# File 'lib/gemfiler/bundler_shim.rb', line 18 def gemspec? @has_gemspec end |
#git(url, options = {}, &block) ⇒ Object
75 76 77 78 79 80 81 82 83 |
# File 'lib/gemfiler/bundler_shim.rb', line 75 def git(url, ={}, &block) @git = url = self.instance_eval(&block) @git = nil = nil end |
#group(*names, &block) ⇒ Object
63 64 65 66 67 |
# File 'lib/gemfiler/bundler_shim.rb', line 63 def group(*names, &block) @groups = names.uniq self.instance_eval(&block) @groups = nil end |
#platforms(*names, &block) ⇒ Object
69 70 71 72 73 |
# File 'lib/gemfiler/bundler_shim.rb', line 69 def platforms(*names, &block) @platforms = names.uniq self.instance_eval(&block) @platforms = nil end |
#ruby(version, engine = {}) ⇒ Object
55 56 57 |
# File 'lib/gemfiler/bundler_shim.rb', line 55 def ruby(version, engine={}) @ruby_version = {version: version}.merge(engine) end |
#source(source) ⇒ Object
59 60 61 |
# File 'lib/gemfiler/bundler_shim.rb', line 59 def source(source) @sources << source end |