Class: Licensed::Source::Bundler
- Inherits:
-
Object
- Object
- Licensed::Source::Bundler
- Defined in:
- lib/licensed/source/bundler.rb
Instance Method Summary collapse
-
#definition ⇒ Object
Build the bundler definition.
- #dependencies ⇒ Object
- #enabled? ⇒ Boolean
- #gemfile_path ⇒ Object
- #groups ⇒ Object
-
#initialize(config) ⇒ Bundler
constructor
A new instance of Bundler.
- #lockfile_path ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(config) ⇒ Bundler
Returns a new instance of Bundler.
6 7 8 |
# File 'lib/licensed/source/bundler.rb', line 6 def initialize(config) @config = config end |
Instance Method Details
#definition ⇒ Object
Build the bundler definition
31 32 33 |
# File 'lib/licensed/source/bundler.rb', line 31 def definition @definition ||= ::Bundler::Definition.build(gemfile_path, lockfile_path, nil) end |
#dependencies ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/licensed/source/bundler.rb', line 18 def dependencies @dependencies ||= definition.specs_for(groups).map do |spec| Dependency.new(spec.gem_dir, { "type" => type, "name" => spec.name, "version" => spec.version.to_s, "summary" => spec.summary, "homepage" => spec.homepage }) end end |
#enabled? ⇒ Boolean
10 11 12 |
# File 'lib/licensed/source/bundler.rb', line 10 def enabled? @config.enabled?(type) && File.exist?(lockfile_path) end |
#gemfile_path ⇒ Object
39 40 41 |
# File 'lib/licensed/source/bundler.rb', line 39 def gemfile_path @config.pwd.join ::Bundler.default_gemfile.basename.to_s end |
#groups ⇒ Object
35 36 37 |
# File 'lib/licensed/source/bundler.rb', line 35 def groups definition.groups - [:test, :development] end |
#lockfile_path ⇒ Object
43 44 45 |
# File 'lib/licensed/source/bundler.rb', line 43 def lockfile_path @config.pwd.join ::Bundler.default_lockfile.basename.to_s end |
#type ⇒ Object
14 15 16 |
# File 'lib/licensed/source/bundler.rb', line 14 def type "rubygem" end |