Class: Jenkins::Plugin::Tools::Loadpath

Inherits:
Object
  • Object
show all
Defined in:
lib/jenkins/plugin/tools/loadpath.rb

Instance Method Summary collapse

Constructor Details

#initialize(*groups) ⇒ Loadpath

Returns a new instance of Loadpath.



5
6
7
8
# File 'lib/jenkins/plugin/tools/loadpath.rb', line 5

def initialize(*groups)
  require 'bundler'
  @groups = groups.empty? ? [:default] : groups
end

Instance Method Details

#to_aObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/jenkins/plugin/tools/loadpath.rb', line 14

def to_a
  [].tap do |paths|
    specs = Bundler.definition.specs_for @groups.map {|g| g.to_sym}
    for spec in specs
      next if spec.name == "bundler"
      for path in spec.require_paths
        paths << File.join(spec.full_gem_path, path)
      end
    end
  end
end

#to_pathObject



10
11
12
# File 'lib/jenkins/plugin/tools/loadpath.rb', line 10

def to_path
  to_a.join(File::PATH_SEPARATOR)
end