ucc 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/ucc.rb +16 -4
  2. data/lib/ucc/version.rb +1 -1
  3. metadata +2 -2
data/lib/ucc.rb CHANGED
@@ -23,10 +23,15 @@ module Ucc
23
23
  opts.banner = "Usage: #{CURRENT_EXECUTABLE} [options] file..."
24
24
 
25
25
  options[:runopts] = nil
26
- opts.on( '-r', '--runopts "STRING"', 'Pass STRING as the command line arguments to the app' ) do |s|
26
+ opts.on( '-r', '--runopts "STRING"', 'Pass STRING as the command line argument to the compiled app' ) do |s|
27
27
  options[:runopts] = s
28
28
  end
29
29
 
30
+ options[:compileopts] = nil
31
+ opts.on( '-c', '--compileopts "STRING"', 'Pass STRING as the command line argument to the compiler' ) do |s|
32
+ options[:compileopts] = s
33
+ end
34
+
30
35
  options[:memcheck] = false
31
36
  opts.on( '-V', '--valgrind', 'Run the app in valgrind' ) do
32
37
  options[:memcheck] = true
@@ -58,7 +63,12 @@ module Ucc
58
63
  # ==========
59
64
 
60
65
  def parse_options
61
- optparse.parse!
66
+ begin
67
+ optparse.parse!
68
+ rescue OptionParser::InvalidOption=> e
69
+ puts "#{CURRENT_EXECUTABLE}: #{e}"
70
+ exit(1)
71
+ end
62
72
 
63
73
  # Here we have already parsed ARGV
64
74
  @source_files = ARGV
@@ -70,9 +80,11 @@ module Ucc
70
80
  end
71
81
 
72
82
  def work
73
- exit unless system(%Q[#{@compiler} -Wall -o "#{app_filename}" #{source_files.map{ |f| '"'+f+'"' }.join(" ")}])
83
+ compilation_params = %Q[#{@compiler} -Wall -o "#{app_filename}" #{source_files.map{ |f| '"'+f+'"' }.join(" ")}]
84
+ compilation_params = "#{compilation_params} #{options[:compileopts]}" if options[:compileopts]
85
+ exit unless system compilation_params
74
86
 
75
- exec_params = app_filename
87
+ exec_params = %Q["#{app_filename}"]
76
88
  exec_params = "./#{exec_params}" unless WINDOWS
77
89
  exec_params = "#{exec_params} #{options[:runopts]}" if options[:runopts]
78
90
  exec_params = "valgrind #{exec_params}" if options[:memcheck]
@@ -1,3 +1,3 @@
1
1
  module Ucc
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ucc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-18 00:00:00.000000000Z
12
+ date: 2011-10-19 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: This gem makes it easy to compile small apps using gcc or g++, you even
15
15
  don't need a makefile!