Class: Bake::Options

Inherits:
Parser show all
Defined in:
lib/bake/options/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Parser

#add_option, #get_block, #num_parameter?, #parse_internal, #valid?

Constructor Details

#initialize(argv) ⇒ Options



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/bake/options/options.rb', line 33

def initialize(argv)
  super(argv)

  @caseSensitivityCheck = Bake::Utils::OS.windows?
  @skipBuildingLine = false
  @debug_threads = false
  @dry = false
  @filelist = nil
  @qac = false
  @projectPaths = false
  @wparse = false
  @dot = false
  @dotFilename = nil
  @prebuild = false
  @printTime = false
  @buildDirDelimiter = "/"
  @conversion_info = false
  @analyze = false
  @eclipseOrder = false
  @showConfigs = false
  @abs_path_in = false
  @abs_path_out = false
  @prepro = false
  @stopOnFirstError = false
  @verbose = 1
  @vars = {}
  @build_config = ""
  @main_dir = nil
  @project = nil
  @filename = nil
  @cc2j_filename = nil
  @json = false
  @clean = false
  @clobber = false
  @docu = false
  @debug = false
  @rebuild = false
  @nocache = false
  @show_includes = false
  @show_includes_and_defines = false
  @linkOnly = false
  @compileOnly = false
  @no_autodir = false
  if RUBY_VERSION.split(".")[0].to_i > 2 || RUBY_VERSION.split(".")[1].to_i >= 2
    require 'etc'
    @threads = Etc.nprocessors
  else
    @threads = 8
  end
  @roots = []
  @socket = 0
  @include_filter = []
  @include_filter_args = {}
  @exclude_filter = []
  @main_project_name = ""
  @adapt = []
  @syncedOutput = false
  @profiling = false
  @diabCaseCheck = false
  @defines = []
  @fileCmd = false
  @dotAndCompile = false
  @show_roots = false
  @dev_features = []
  @dotShowProjOnly = false

  add_option(["-b",                   ""                     ], lambda { |x| set_build_config(x)                     })
  add_option(["-m"                                           ], lambda { |x| @main_dir = x                           })
  add_option(["-p"                                           ], lambda { |x| @project = x                            })
  add_option(["-f"                                           ], lambda { |x| @filename = x.gsub(/[\\]/,'/')          })
  add_option(["-c"                                           ], lambda {     @clean = true                           })
  add_option(["-a"                                           ], lambda { |x| Bake.formatter.setColorScheme(x.to_sym) })
  add_option(["-w"                                           ], lambda { |x| set_root(x)                             })
  add_option(["-r"                                           ], lambda {     @stopOnFirstError = true                })
  add_option(["-O"                                           ], lambda {     @syncedOutput = true                    })
  add_option(["--rebuild"                                    ], lambda {     @rebuild = true                         })
  add_option(["--profiling"                                  ], lambda {     @profiling = true                         })
  add_option(["--prepro"                                     ], lambda {     @prepro = true                          })
  add_option(["--link-only",          "--link_only"          ], lambda {     @linkOnly = true;                       })
  add_option(["--compile-only",       "--compile_only"       ], lambda {     @compileOnly = true;                    })
  add_option(["--no-autodir",         "--no_autodir"         ], lambda {     @no_autodir = true                      })

  add_option(["--create"                                     ], lambda { |x| Bake::Create.proj(x)                    })
  add_option(["--conversion-info",    "--conversion_info"    ], lambda {     @conversion_info = true; @syncedOutput = true })
  add_option(["--file-list",          "--file_list"          ], lambda {     @filelist = Set.new                     })
  add_option(["--filter-paths"                               ], lambda {     @projectPaths = true                    })
  add_option(["--qac"                                        ], lambda {     @qac = true                             })
  add_option(["-Z"                                           ], lambda { |x| @dev_features <<  x                     })

  add_option(["--generate-doc",       "--docu"               ], lambda {     @docu = true                            })

  add_option(["--adapt"                                      ], lambda { |x| set_adapt(x)                            })

  add_option(["-v"                                           ], lambda { |x, dummy1, dummy2| set_verbose(x)          })

  add_option(["--debug"                                      ], lambda {     @debug = true                           })
  add_option(["--debug-threads"                              ], lambda {     @debug_threads = true                   })
  add_option(["--set"                                        ], lambda { |x| set_set(x)                              })
  add_option(["-nb"                                          ], lambda {     @skipBuildingLine = true                })
  add_option(["--no-case-check"                              ], lambda {     @caseSensitivityCheck = false           })
  add_option(["--file-cmd"                                   ], lambda {     @fileCmd = true                         })
  add_option(["--clobber"                                    ], lambda {     @clobber = true; @clean = true          })
  add_option(["--ignore-cache",       "--ignore_cache"       ], lambda {     @nocache = true                         })
  add_option(["-j",                   "--threads"            ], lambda { |x, dummy1, dummy2| set_threads(x)          })
  add_option(["--socket"                                     ], lambda { |x| @socket = String === x ? x.to_i : x     })
  add_option(["--toolchain-info",     "--toolchain_info"     ], lambda { |x| ToolchainInfo.showToolchain(x)          })
  add_option(["--toolchain-names",    "--toolchain_names"    ], lambda {     ToolchainInfo.showToolchainList         })
  add_option(["--dot",                                       ], lambda { |x,dummy| @dot = true; @dotFilename = x; @dotAndCompile = false        })
  add_option(["--dotc",                                      ], lambda { |x,dummy| @dot = true; @dotFilename = x; @dotAndCompile = true         })
  add_option(["--dot-project-level",                         ], lambda { @dot = true; @dotShowProjOnly = true        })
  add_option(["--do",                 "--include_filter"     ], lambda { |x| set_filter(x)                           })
  add_option(["--omit",               "--exclude_filter"     ], lambda { |x| @exclude_filter << x                    })
  add_option(["--abs-paths",          "--show_abs_paths"     ], lambda {     @abs_path_in = @abs_path_out = true     })
  add_option(["--abs-paths-in",       "--show_abs_paths"     ], lambda {     @abs_path_in = true                     })
  add_option(["--abs-paths-out",      "--show_abs_paths"     ], lambda {     @abs_path_out = true                    })
  add_option(["--prebuild"                                   ], lambda {     @prebuild = true                        })
  add_option(["--Wparse"                                     ], lambda {     @wparse = true                          })

  add_option(["-h",                   "--help"               ], lambda {     Bake::Usage.show                        })
  add_option(["--time",                                      ], lambda {     @printTime = true                       })

  add_option(["--incs-and-defs",      "--show_incs_and_defs" ], lambda {     @show_includes_and_defines = true       })
  add_option(["--incs-and-defs=bake",                        ], lambda {     @show_includes_and_defines = true       })
  add_option(["--incs-and-defs=json"                         ], lambda { @show_includes_and_defines=true; @json=true })
  add_option(["--license",            "--show_license"       ], lambda {     License.show                            })
  add_option(["--doc",                "--show_doc"           ], lambda {     Doc.show                                })
  add_option(["--install-doc",        "--install_doc"        ], lambda {     Doc.install                             })

  add_option(["-D"                                           ], lambda { |x| @defines << x                           })

  add_option(["--dry"                                        ], lambda {     @dry = true                             })

  add_option(["--crc32"                                      ], lambda { |x| CRC32.printAndExit(x)                   })

  add_option(["--diab-case-check"                            ], lambda {  @diabCaseCheck = true; @compileOnly = true })

  add_option(["--version"                                    ], lambda {     Bake::Usage.version                     })
  add_option(["--list",               "--show_configs"       ], lambda {     @showConfigs = true                     })
  add_option(["--compilation-db"                             ], lambda { |x,dummy| @cc2j_filename = (x ? x : "compile_commands.json" )})
  add_option(["--build_",                                    ], lambda {     @buildDirDelimiter = "_"                })

  # deprecated and not replaced by new command

  add_option(["--show_include_paths"                         ], lambda {     @show_includes = true                   })
    
  add_option(["--roots"                                      ], lambda {     @show_roots = true                      })

end

Instance Attribute Details

#abs_path_inObject (readonly)

Returns the value of attribute abs_path_in.



25
26
27
# File 'lib/bake/options/options.rb', line 25

def abs_path_in
  @abs_path_in
end

#abs_path_outObject (readonly)

Returns the value of attribute abs_path_out.



25
26
27
# File 'lib/bake/options/options.rb', line 25

def abs_path_out
  @abs_path_out
end

#adaptObject (readonly)

String List



17
18
19
# File 'lib/bake/options/options.rb', line 17

def adapt
  @adapt
end

#analyzeObject

Returns the value of attribute analyze.



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

def analyze
  @analyze
end

#build_configObject

Returns the value of attribute build_config.



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

def build_config
  @build_config
end

#buildDirDelimiterObject (readonly)

String



16
17
18
# File 'lib/bake/options/options.rb', line 16

def buildDirDelimiter
  @buildDirDelimiter
end

#caseSensitivityCheckObject (readonly)

Boolean



19
20
21
# File 'lib/bake/options/options.rb', line 19

def caseSensitivityCheck
  @caseSensitivityCheck
end

#cc2j_filenameObject

Returns the value of attribute cc2j_filename.



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

def cc2j_filename
  @cc2j_filename
end

#cleanObject (readonly)

Boolean



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

def clean
  @clean
end

#clobberObject (readonly)

Boolean



19
20
21
# File 'lib/bake/options/options.rb', line 19

def clobber
  @clobber
end

#compileOnlyObject (readonly)

Boolean



19
20
21
# File 'lib/bake/options/options.rb', line 19

def compileOnly
  @compileOnly
end

#conversion_infoObject (readonly)

Boolean



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

def conversion_info
  @conversion_info
end

#debugObject (readonly)

Boolean



19
20
21
# File 'lib/bake/options/options.rb', line 19

def debug
  @debug
end

#debug_threadsObject (readonly)

Boolean



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

def debug_threads
  @debug_threads
end

#definesObject (readonly)

Returns the value of attribute defines.



28
29
30
# File 'lib/bake/options/options.rb', line 28

def defines
  @defines
end

#dev_featuresObject (readonly)

Returns the value of attribute dev_features.



29
30
31
# File 'lib/bake/options/options.rb', line 29

def dev_features
  @dev_features
end

#diabCaseCheckObject (readonly)

Returns the value of attribute diabCaseCheck.



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

def diabCaseCheck
  @diabCaseCheck
end

#docuObject (readonly)

Boolean



19
20
21
# File 'lib/bake/options/options.rb', line 19

def docu
  @docu
end

#dotObject (readonly)

String



16
17
18
# File 'lib/bake/options/options.rb', line 16

def dot
  @dot
end

#dotAndCompileObject (readonly)

Returns the value of attribute dotAndCompile.



20
21
22
# File 'lib/bake/options/options.rb', line 20

def dotAndCompile
  @dotAndCompile
end

#dotFilenameObject (readonly)

String



16
17
18
# File 'lib/bake/options/options.rb', line 16

def dotFilename
  @dotFilename
end

#dotShowProjOnlyObject (readonly)

Returns the value of attribute dotShowProjOnly.



30
31
32
# File 'lib/bake/options/options.rb', line 30

def dotShowProjOnly
  @dotShowProjOnly
end

#dryObject (readonly)

Boolean



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

def dry
  @dry
end

#eclipseOrderObject

Returns the value of attribute eclipseOrder.



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

def eclipseOrder
  @eclipseOrder
end

#exclude_filterObject (readonly)

String List



17
18
19
# File 'lib/bake/options/options.rb', line 17

def exclude_filter
  @exclude_filter
end

#fileCmdObject (readonly)

Boolean



19
20
21
# File 'lib/bake/options/options.rb', line 19

def fileCmd
  @fileCmd
end

#filelistObject (readonly)

set



24
25
26
# File 'lib/bake/options/options.rb', line 24

def filelist
  @filelist
end

#filenameObject (readonly)

String



16
17
18
# File 'lib/bake/options/options.rb', line 16

def filename
  @filename
end

#include_filterObject (readonly)

String List



17
18
19
# File 'lib/bake/options/options.rb', line 17

def include_filter
  @include_filter
end

#include_filter_argsObject (readonly)

map



22
23
24
# File 'lib/bake/options/options.rb', line 22

def include_filter_args
  @include_filter_args
end

#jsonObject (readonly)

Boolean



19
20
21
# File 'lib/bake/options/options.rb', line 19

def json
  @json
end

#linkOnlyObject (readonly)

Boolean



19
20
21
# File 'lib/bake/options/options.rb', line 19

def linkOnly
  @linkOnly
end

#main_dirObject (readonly)

String



16
17
18
# File 'lib/bake/options/options.rb', line 16

def main_dir
  @main_dir
end

#main_project_nameObject (readonly)

String



16
17
18
# File 'lib/bake/options/options.rb', line 16

def main_project_name
  @main_project_name
end

#no_autodirObject (readonly)

Boolean



19
20
21
# File 'lib/bake/options/options.rb', line 19

def no_autodir
  @no_autodir
end

#nocacheObject

Returns the value of attribute nocache.



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

def nocache
  @nocache
end

#prebuildObject (readonly)

Boolean



19
20
21
# File 'lib/bake/options/options.rb', line 19

def prebuild
  @prebuild
end

#preproObject (readonly)

Boolean



19
20
21
# File 'lib/bake/options/options.rb', line 19

def prepro
  @prepro
end

#printTimeObject (readonly)

Boolean



19
20
21
# File 'lib/bake/options/options.rb', line 19

def printTime
  @printTime
end

#profilingObject (readonly)

Boolean



19
20
21
# File 'lib/bake/options/options.rb', line 19

def profiling
  @profiling
end

#projectObject (readonly)

String



16
17
18
# File 'lib/bake/options/options.rb', line 16

def project
  @project
end

#projectPathsObject (readonly)

Boolean



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

def projectPaths
  @projectPaths
end

#qacObject (readonly)

Boolean



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

def qac
  @qac
end

#rebuildObject (readonly)

Boolean



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

def rebuild
  @rebuild
end

#rootsObject (readonly)

Root array



26
27
28
# File 'lib/bake/options/options.rb', line 26

def roots
  @roots
end

#show_includesObject (readonly)

Boolean



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

def show_includes
  @show_includes
end

#show_includes_and_definesObject (readonly)

Boolean



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

def show_includes_and_defines
  @show_includes_and_defines
end

#show_rootsObject (readonly)

Returns the value of attribute show_roots.



20
21
22
# File 'lib/bake/options/options.rb', line 20

def show_roots
  @show_roots
end

#showConfigsObject

Returns the value of attribute showConfigs.



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

def showConfigs
  @showConfigs
end

#skipBuildingLineObject (readonly)

Boolean



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

def skipBuildingLine
  @skipBuildingLine
end

#socketObject (readonly)

Fixnum



21
22
23
# File 'lib/bake/options/options.rb', line 21

def socket
  @socket
end

#stopOnFirstErrorObject (readonly)

Boolean



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

def stopOnFirstError
  @stopOnFirstError
end

#syncedOutputObject (readonly)

Boolean



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

def syncedOutput
  @syncedOutput
end

#threadsObject (readonly)

Fixnum



21
22
23
# File 'lib/bake/options/options.rb', line 21

def threads
  @threads
end

#varsObject (readonly)

map



22
23
24
# File 'lib/bake/options/options.rb', line 22

def vars
  @vars
end

#verboseObject (readonly)

Returns the value of attribute verbose.



23
24
25
# File 'lib/bake/options/options.rb', line 23

def verbose
  @verbose
end

#working_dirObject (readonly)

String



16
17
18
# File 'lib/bake/options/options.rb', line 16

def working_dir
  @working_dir
end

#wparseObject (readonly)

Boolean



19
20
21
# File 'lib/bake/options/options.rb', line 19

def wparse
  @wparse
end

Instance Method Details

#check_valid_dir(dir) ⇒ Object



298
299
300
301
302
303
304
305
306
307
# File 'lib/bake/options/options.rb', line 298

def check_valid_dir(dir)
 if not File.exist?(dir)
    Bake.formatter.printError("Error: Directory #{dir} does not exist")
    ExitHelper.exit(1)
  end
  if not File.directory?(dir)
    Bake.formatter.printError("Error: #{dir} is not a directory")
    ExitHelper.exit(1)
  end
end

#checkNum(num, quite = false) ⇒ Object



344
345
346
347
348
349
350
351
352
353
354
# File 'lib/bake/options/options.rb', line 344

def checkNum(num, quite = false)
  if String === num && !/\A\d+\z/.match(num)
    if !quite
      Bake.formatter.printError("Error: #{num} is not a positive number")
      ExitHelper.exit(1)
    else
      return false
    end
  end
  return true
end

#parse_optionsObject



181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
# File 'lib/bake/options/options.rb', line 181

def parse_options()
  parse_internal(false)

  searchDir = @main_dir.nil? ? Dir.pwd : @main_dir
  dir = Bake.findDirOfFileToRoot(searchDir,"Project.meta")
  if dir
    set_main_dir(dir)
  else
    Bake.formatter.printError("Error: Project.meta not found in #{searchDir} or upwards")
    ExitHelper.exit(1)
  end
  set_working_dir()

  def_roots = Root.calc_roots_bake(@main_dir)
  @roots += def_roots

  if @roots.empty?
    @roots = []
    @roots = Root.calc_def_roots(@main_dir)
  end

  @roots = Root.uniq(@roots)
  
  if @show_roots
    puts @roots.map {|r| r.dir }
    ExitHelper.exit(0)
  end

  @adapt.uniq!

  if @project
    ar = @project.split(",")
    if ar.length > 2
      Bake.formatter.printError("Error: only one comma allowed for -p")
      ExitHelper.exit(1)
    end
    ar[0] = File::basename(Dir.pwd) if ar[0] == "."
    @project = ar.join(",")
  end

  if @conversion_info
    if @rebuild
      Bake.formatter.printError("Error: --conversion-info and --rebuild not allowed at the same time")
      ExitHelper.exit(1)
    end
    if @clean
      Bake.formatter.printError("Error: --conversion-info and -c not allowed at the same time")
      ExitHelper.exit(1)
    end
    if @prepro
      Bake.formatter.printError("Error: --conversion-info and --prepro not allowed at the same time")
      ExitHelper.exit(1)
    end
    if @linkOnly
      Bake.formatter.printError("Error: --conversion-info and --linkOnly not allowed at the same time")
      ExitHelper.exit(1)
    end
    if @compileOnly
      Bake.formatter.printError("Error: --conversion-info and --compileOnly not allowed at the same time")
      ExitHelper.exit(1)
    end
    if @docu
      Bake.formatter.printError("Error: --conversion-info and --docu not allowed at the same time")
      ExitHelper.exit(1)
    end
  end

  if @linkOnly
    if @rebuild
      Bake.formatter.printError("Error: --link-only and --rebuild not allowed at the same time")
      ExitHelper.exit(1)
    end
    if @clean
      Bake.formatter.printError("Error: --link-only and -c not allowed at the same time")
      ExitHelper.exit(1)
    end
    if @prepro
      Bake.formatter.printError("Error: --link-only and --prepro not allowed at the same time")
      ExitHelper.exit(1)
    end
    if @filename
      Bake.formatter.printError("Error: --link-only and --filename not allowed at the same time")
      ExitHelper.exit(1)
    end
  end

  if @compileOnly
    if @linkOnly
      Bake.formatter.printError("Error: --compile-only and --link-only not allowed at the same time")
      ExitHelper.exit(1)
    end
    if @filename
      Bake.formatter.printError("Error: --compile-only and --filename not allowed at the same time")
      ExitHelper.exit(1)
    end
  end

  if @prepro
    if @rebuild
      Bake.formatter.printError("Error: --prepro and --rebuild not allowed at the same time")
      ExitHelper.exit(1)
    end
    if @clean
      Bake.formatter.printError("Error: --prepro and -c not allowed at the same time")
      ExitHelper.exit(1)
    end
  end

  if @caseSensitivityCheck == false && @diabCaseCheck == true
    Bake.formatter.printError("Error: --no-case-check and --diab-case-check not allowed at the same time")
    ExitHelper.exit(1)
  end

  @filename = "." if @compileOnly

end

#set_adapt(name) ⇒ Object



338
339
340
341
342
# File 'lib/bake/options/options.rb', line 338

def set_adapt(name)
  name.split(",").each do |n|
    @adapt << n if not @adapt.include?n
  end
end

#set_build_config(config) ⇒ Object



309
310
311
312
313
314
315
# File 'lib/bake/options/options.rb', line 309

def set_build_config(config)
  if not @build_config.empty?
    Bake.formatter.printError("Error: Cannot set build config '#{config}', because build config is already set to '#{@build_config}'")
    ExitHelper.exit(1)
  end
  @build_config = config
end

#set_filter(f) ⇒ Object



388
389
390
391
392
# File 'lib/bake/options/options.rb', line 388

def set_filter(f)
  splitted = f.split("=", 2)
  @include_filter << splitted[0]
  @include_filter_args[splitted[0]] = splitted[1] if splitted.length == 2
end

#set_main_dir(dir) ⇒ Object



317
318
319
320
321
# File 'lib/bake/options/options.rb', line 317

def set_main_dir(dir)
  check_valid_dir(dir)
  @main_dir = File.expand_path(dir.gsub(/[\\]/,'/'))
  @main_project_name = File::basename(@main_dir)
end

#set_root(dir) ⇒ Object



327
328
329
330
331
332
333
334
335
336
# File 'lib/bake/options/options.rb', line 327

def set_root(dir)
  if File.file?(dir)
    @roots += Root.calc_roots_bake(dir)
  else
    root = Root.extract_depth(dir)
    check_valid_dir(root.dir)
    root.dir  = File.expand_path(root.dir.gsub(/[\\]/,'/'))
    @roots << root
  end
end

#set_set(str) ⇒ Object



379
380
381
382
383
384
385
386
# File 'lib/bake/options/options.rb', line 379

def set_set(str)
  ar = str.split("=")
  if not str.include?"=" or ar[0].length == 0
    Bake.formatter.printError("Error: --set must be followed by key=value")
    ExitHelper.exit(1)
  end
  @vars[ar[0]] = ar[1..-1].join("=")
end

#set_threads(num) ⇒ Object



356
357
358
359
360
361
362
363
364
# File 'lib/bake/options/options.rb', line 356

def set_threads(num)
  return if num == nil # -j without number shall behave the same as not set

  return :ignore if !checkNum(num, true)
  @threads = String === num ? num.to_i : num
  if @threads <= 0
    Bake.formatter.printError("Error: number of threads must be > 0")
    ExitHelper.exit(1)
  end
end

#set_verbose(num) ⇒ Object



366
367
368
369
370
371
372
373
374
375
376
377
# File 'lib/bake/options/options.rb', line 366

def set_verbose(num)
  if num.nil?
    Bake.formatter.printError("Error: verbose must be between 0 and 3")
    ExitHelper.exit(1)
  end
  checkNum(num)
  @verbose = String === num ? num.to_i : num
  if @verbose < 0 || verbose > 3
    Bake.formatter.printError("Error: verbose must be between 0 and 3")
    ExitHelper.exit(1)
  end
end

#set_working_dirObject



323
324
325
# File 'lib/bake/options/options.rb', line 323

def set_working_dir()
  @working_dir = File.expand_path(Dir.pwd.gsub(/[\\]/,'/'))
end