rubber-generate 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -1,6 +1,6 @@
1
1
  h1. Rubber Generate
2
2
 
3
- h2. v0.0.9
3
+ h2. v0.0.11
4
4
 
5
5
  Template language for generating Ruby bindings for C libraries
6
6
  by Geoff Youngs <g@intersect-uk.co.uk>
@@ -20,6 +20,9 @@ functions and some rudimentary understanding of C code.
20
20
 
21
21
  h3. Changes
22
22
 
23
+ * 0.0.11 - 27th Apr 2011
24
+ - Fix parsing of %min-version numbers
25
+
23
26
  * 0.0.10 - 27th Apr 2011
24
27
  - Add --install flag
25
28
 
@@ -50,7 +53,7 @@ Sample file:
50
53
 
51
54
  Usage:
52
55
  <pre>
53
- $ rubber-generate --generate --build vte.cr
56
+ $ rubber-generate --generate --build --install vte.cr
54
57
  </pre>
55
58
 
56
59
  Which should generate
data/bin/rubber-generate CHANGED
@@ -33,7 +33,7 @@ OptionParser.new { |opts|
33
33
  opts.on("--build-dir DIR", 'Directory for generating/building extension') do |dir|
34
34
  Args.build_dir = dir
35
35
  end
36
- opts.on('--configure', 'Run generated extconf.rb') do
36
+ opts.on('--configure', 'Run generated extconf.rb') do
37
37
  Args.configure = true
38
38
  end
39
39
  opts.on('--build', 'Build extension') do
@@ -76,7 +76,7 @@ OptionParser.new { |opts|
76
76
  if system('sudo', '-k', '-n', 'make')
77
77
  # System is setup to allow make to be run without password
78
78
  system('sudo', 'make', 'install')
79
- else
79
+ else
80
80
  # Password required
81
81
  system('sudo', '-k', '-p', 'Enter password to install: ', 'make', 'install')
82
82
  end
@@ -1,6 +1,9 @@
1
1
  require 'rubber/struct'
2
2
  module Rubber
3
- VERSION = [0,0,10]
3
+ VERSION = [0,0,11]
4
+ def VERSION.to_s
5
+ self.map{|i|i.to_s}.join('.')
6
+ end
4
7
  class ScanState
5
8
  define_members(:in_code, :in_class, :in_func, :braces)
6
9
  end
@@ -116,11 +119,11 @@ def _scan(fp)
116
119
  elsif @str.skip(/%name */) # Extension name
117
120
  @ext = @str.scan(/[a-zA-Z0-9]+/)
118
121
  elsif @str.skip(/%min-version */)
119
- @version = @str.scan(/([0-9]+)\.([0-9]+)\.([0-9])/)
122
+ @version = @str.scan(/([0-9]+)\.([0-9]+)\.([0-9]+)/)
120
123
  version = [1,2,3].map{|i|@str[i].to_i}
121
124
  Rubber::VERSION.each_with_index do |ver,idx|
122
125
  if ver < version[idx]
123
- misc_error "This version of rubber-generate (#{Rubber::VERSION}) is too old: #{@file} requires version #{version.map{|i|i.to_s}.join('.')}"
126
+ misc_error "This version of rubber-generate (#{Rubber::VERSION}) is too old: #{@file} requires version #{version.map{|i|i.to_s}.join('.')}", false
124
127
  end
125
128
  end
126
129
  elsif @str.skip(/%pkg-config\s*([-a-z.0-9+]+)/) # pkg-config library
@@ -495,12 +498,14 @@ end
495
498
  end
496
499
  exit 1
497
500
  end
498
- def misc_error(message)
501
+ def misc_error(message, show_location=true)
499
502
  STDERR.puts "Error: #{message} at line #{current_line}\n"
500
- if @str.rest.size > 255
501
- STDERR.puts @str.rest[0..255]+"..."
502
- else
503
- STDERR.puts @str.rest
503
+ if show_location
504
+ if @str.rest.size > 255
505
+ STDERR.puts @str.rest[0..255]+"..."
506
+ else
507
+ STDERR.puts @str.rest
508
+ end
504
509
  end
505
510
  exit 1
506
511
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubber-generate
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 10
10
- version: 0.0.10
9
+ - 11
10
+ version: 0.0.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Geoff Youngs