Class: Kompo::Option
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#cache_bundle_path ⇒ Object
Returns the value of attribute cache_bundle_path.
-
#compress ⇒ Object
Returns the value of attribute compress.
-
#context ⇒ Object
Returns the value of attribute context.
-
#dest_dir ⇒ Object
Returns the value of attribute dest_dir.
-
#dyn_link_lib ⇒ Object
Returns the value of attribute dyn_link_lib.
-
#entrypoint ⇒ Object
Returns the value of attribute entrypoint.
-
#gemfile ⇒ Object
Returns the value of attribute gemfile.
-
#ignore_stdlib ⇒ Object
Returns the value of attribute ignore_stdlib.
-
#output ⇒ Object
Returns the value of attribute output.
-
#ruby_src_path ⇒ Object
Returns the value of attribute ruby_src_path.
-
#ruby_version ⇒ Object
Returns the value of attribute ruby_version.
-
#use_group ⇒ Object
Returns the value of attribute use_group.
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(dir = Dir.getwd, opt = OptionParser.new) ⇒ Option
constructor
A new instance of Option.
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 32 33 |
# 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 = File.exist?(File.join(Dir.getwd, 'Gemfile')) @ignore_stdlib = [] @dyn_link_lib = [] @dest_dir = dir @ruby_src_path = nil @cache_bundle_path = nil @ruby_version = "v#{RUBY_VERSION.gsub('.', '_')}" @compress = false @use_group = 'default' @context = dir @opt = opt end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
15 16 17 |
# File 'lib/kompo.rb', line 15 def args @args end |
#cache_bundle_path ⇒ Object
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 |
#compress ⇒ Object
Returns the value of attribute compress.
15 16 17 |
# File 'lib/kompo.rb', line 15 def compress @compress end |
#context ⇒ Object
Returns the value of attribute context.
15 16 17 |
# File 'lib/kompo.rb', line 15 def context @context end |
#dest_dir ⇒ Object
Returns the value of attribute dest_dir.
15 16 17 |
# File 'lib/kompo.rb', line 15 def dest_dir @dest_dir end |
#dyn_link_lib ⇒ Object
Returns the value of attribute dyn_link_lib.
15 16 17 |
# File 'lib/kompo.rb', line 15 def dyn_link_lib @dyn_link_lib end |
#entrypoint ⇒ Object
Returns the value of attribute entrypoint.
15 16 17 |
# File 'lib/kompo.rb', line 15 def entrypoint @entrypoint end |
#gemfile ⇒ Object
Returns the value of attribute gemfile.
15 16 17 |
# File 'lib/kompo.rb', line 15 def gemfile @gemfile end |
#ignore_stdlib ⇒ Object
Returns the value of attribute ignore_stdlib.
15 16 17 |
# File 'lib/kompo.rb', line 15 def ignore_stdlib @ignore_stdlib end |
#output ⇒ Object
Returns the value of attribute output.
15 16 17 |
# File 'lib/kompo.rb', line 15 def output @output end |
#ruby_src_path ⇒ Object
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_version ⇒ Object
Returns the value of attribute ruby_version.
15 16 17 |
# File 'lib/kompo.rb', line 15 def ruby_version @ruby_version end |
#use_group ⇒ Object
Returns the value of attribute use_group.
15 16 17 |
# File 'lib/kompo.rb', line 15 def use_group @use_group end |
Class Method Details
.default ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/kompo.rb', line 35 def self.default option = new option.on('-e VAL', '--entrypoint=VAL', "File path to use for entry point. (default: \'./main.rb\')") { |v| option.entrypoint = v } option.on('-o VAL', '--output=VAL', 'Name of the generated file. (default: current dir name)') { |v| option.output = v } option.on('-g VAL', '--use-group=VAL', "Group name to use with \'bundle install\'. (default: \'default\')") { |v| option.use_group = v } option.on('--[no-]gemfile', "Use gem in Gemfile. (default: automatically true if Gemfile is present)") { |v| option.gemfile = v } option.on('--ignore-stdlib=VAL', Array, "Specify stdlibs not to include, separated by commas.") { |v| option.ignore_stdlib = v } option.on('--dyn-link-lib=VAL', Array, "Specify libraries to be dynamic link, separated by commas.") { |v| option.dyn_link_lib = v } option.on('--dest-dir=VAL', "Output directry path. (default: current dir)") { |v| option.dest_dir = v } option.on('--ruby-src-path=VAL', "Your Ruby source directry. Must be compiled with \'--with-static-linked-ext\'.") { |v| option.ruby_src_path = v } option.on('--cache-bundle-path=VAL', "Specify the directory created by \'bundle install --standalone\'.") { |v| option.cache_bundle_path = v } option.on('--ruby-version=VAL', "Specify Ruby version. (default: current Ruby version)") { |v| option.ruby_version = v } # option.on('--compress') { |v| option.compress = v } option end |
Instance Method Details
#build ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/kompo.rb', line 52 def build @opt.parse!(ARGV) @args = convert_absolute_path_for ARGV self end |