Class: Freely::Options

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

Defined Under Namespace

Classes: BinaryInfo

Constant Summary collapse

SYSTEM_LIBS =
'/usr/lib/'
SYSTEM_FRAMEWORKS =
'/System/Library/Frameworks/'
VIEW_UTILITY =
'otool -L'
EDIT_UTILITY =
'install_name_tool -change'
DEFAULT_PREFIX =
'lib'
DEFAULT_ROOT =
'.'
DEFAULT_VERBOSE =
true

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Options

Returns a new instance of Options.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/freely/options.rb', line 24

def initialize argv
  @prefix = DEFAULT_PREFIX
  @verbose = DEFAULT_VERBOSE

  parse argv # parse the given options

  @binaries = []

  argv.each do |arg|
    @binaries << BinaryInfo.new do |my|
      if arg =~ /(\S+)\/([^\/]+$)/
        my.root = if ['/', '.', '..'].include? $1[0] then $1 else './' + $1 end
        my.name = $2
      else
        my.root = DEFAULT_ROOT
        my.name = arg
      end
    end
  end
end

Instance Attribute Details

#binariesObject (readonly)

Returns the value of attribute binaries.



13
14
15
# File 'lib/freely/options.rb', line 13

def binaries
  @binaries
end

#prefixObject (readonly)

Returns the value of attribute prefix.



15
16
17
# File 'lib/freely/options.rb', line 15

def prefix
  @prefix
end

#verboseObject (readonly)

Returns the value of attribute verbose.



14
15
16
# File 'lib/freely/options.rb', line 14

def verbose
  @verbose
end