Class: Kompo::Option

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/kompo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir = Dir.getwd, opt = OptionParser.new) ⇒ Option

Returns a new instance of Option.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/kompo.rb', line 18

def initialize(dir = Dir.getwd, opt = OptionParser.new)
  @entrypoint = File.join(dir, 'main.rb')
  @output = File.basename(dir)
  @gemfile = true
  @stdlib = true
  @dest_dir = dir
  @ruby_src_path = nil
  @cache_bundle_path = nil
  @ruby_version = "v#{RUBY_VERSION.gsub('.', '_')}"
  @compress = false

  @context = dir
  @opt = opt
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



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

def args
  @args
end

#cache_bundle_pathObject

Returns the value of attribute cache_bundle_path.



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

def cache_bundle_path
  @cache_bundle_path
end

#compressObject

Returns the value of attribute compress.



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

def compress
  @compress
end

#contextObject

Returns the value of attribute context.



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

def context
  @context
end

#dest_dirObject

Returns the value of attribute dest_dir.



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

def dest_dir
  @dest_dir
end

#entrypointObject

Returns the value of attribute entrypoint.



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

def entrypoint
  @entrypoint
end

#gemfileObject

Returns the value of attribute gemfile.



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

def gemfile
  @gemfile
end

#outputObject

Returns the value of attribute output.



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

def output
  @output
end

#ruby_src_pathObject

Returns the value of attribute ruby_src_path.



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

def ruby_src_path
  @ruby_src_path
end

#ruby_versionObject

Returns the value of attribute ruby_version.



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

def ruby_version
  @ruby_version
end

#stdlibObject

Returns the value of attribute stdlib.



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

def stdlib
  @stdlib
end

Instance Method Details

#buildObject



33
34
35
36
37
38
39
# File 'lib/kompo.rb', line 33

def build
  @opt.parse!(ARGV)

  @args = convert_absolute_path_for ARGV

  self
end