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
Returns the expected path to the Bundler Gemfile.
-
#groups ⇒ Object
Returns the bundle definition groups, excluding test and development.
-
#initialize(config) ⇒ Bundler
constructor
A new instance of Bundler.
-
#lockfile_path ⇒ Object
Returns the expected path to the Bundler Gemfile.lock.
- #type ⇒ Object
Constructor Details
#initialize(config) ⇒ Bundler
Returns a new instance of Bundler.
7 8 9 |
# File 'lib/licensed/source/bundler.rb', line 7 def initialize(config) @config = config end |
Instance Method Details
#definition ⇒ Object
Build the bundler definition
32 33 34 |
# File 'lib/licensed/source/bundler.rb', line 32 def definition @definition ||= ::Bundler::Definition.build(gemfile_path, lockfile_path, nil) end |
#dependencies ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/licensed/source/bundler.rb', line 19 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
11 12 13 |
# File 'lib/licensed/source/bundler.rb', line 11 def enabled? @config.enabled?(type) && File.exist?(lockfile_path) end |
#gemfile_path ⇒ Object
Returns the expected path to the Bundler Gemfile
42 43 44 |
# File 'lib/licensed/source/bundler.rb', line 42 def gemfile_path @config.pwd.join ::Bundler.default_gemfile.basename.to_s end |
#groups ⇒ Object
Returns the bundle definition groups, excluding test and development
37 38 39 |
# File 'lib/licensed/source/bundler.rb', line 37 def groups definition.groups - [:test, :development] end |
#lockfile_path ⇒ Object
Returns the expected path to the Bundler Gemfile.lock
47 48 49 |
# File 'lib/licensed/source/bundler.rb', line 47 def lockfile_path @config.pwd.join ::Bundler.default_lockfile.basename.to_s end |
#type ⇒ Object
15 16 17 |
# File 'lib/licensed/source/bundler.rb', line 15 def type "rubygem" end |