Class: Noodle::Noodler

Inherits:
Object
  • Object
show all
Defined in:
lib/noodle.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNoodler

Returns a new instance of Noodler.



35
36
37
38
39
# File 'lib/noodle.rb', line 35

def initialize
  @groups = []
  @outdir = 'lib'
  @merge  = false
end

Instance Attribute Details

#groupsArray

An array of bundler groups that reference the required dlls. Use an empty array for all groups.

Defaults to all groups.

Returns:

  • (Array)


12
13
14
# File 'lib/noodle.rb', line 12

def groups
  @groups
end

#mergeBoolean

Whether to copy everything into one directory or not. If this is true, all gem lib directories will be combined in #outdir. If this is false, each gem lib will be stored in a separate subdirectory of #outdir. You can also set this by calling ‘merge!`

Defaults to false.

Returns:

  • (Boolean)


27
28
29
# File 'lib/noodle.rb', line 27

def merge
  @merge
end

#outdirString

The destination directory.

Defaults to ‘lib’.

Returns:

  • (String)


18
19
20
# File 'lib/noodle.rb', line 18

def outdir
  @outdir
end

Instance Method Details

#installObject



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/noodle.rb', line 41

def install
  specs = groups.any? ? Bundler.definition.specs_for(groups) : Bundler.environment.requested_specs
  specs.each do |spec|
    next if spec.name == 'bundler'
    spec.load_paths.each do |path|
      dest_path = dest_for(spec)
      FileUtils.mkdir_p dest_path
      FileUtils.cp_r "#{path}/.", dest_path, :verbose => true
    end
  end
end

#merge!void

This method returns an undefined value.

Sets #merge to true.



31
32
33
# File 'lib/noodle.rb', line 31

def merge!
  @merge = true
end