surpass 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1400,7 +1400,7 @@ class FormulaRecord < BiffRecord
1400
1400
  RECORD_ID = 0x0006
1401
1401
 
1402
1402
  def initialize(row, col, xf_index, rpn, calc_flags = 0)
1403
- @record_data = [row, col, xf_index, 0xFFFF000000000003, calc_flags & 0x03, 0].pack('v3wvV') + rpn
1403
+ @record_data = [row, col, xf_index, 0xFFFF000000000003, calc_flags & 0x03, 0].pack('v3QvV') + rpn
1404
1404
  end
1405
1405
  end
1406
1406
 
@@ -2165,4 +2165,4 @@ class InternalReferenceSupBookRecord < SupBookRecord
2165
2165
  def initialize(num_sheets)
2166
2166
  @record_data = [num_sheets, 0x01, 0x04].pack('vCC')
2167
2167
  end
2168
- end
2168
+ end
@@ -0,0 +1,25 @@
1
+ class Formula
2
+ NO_CALCS=0x00
3
+ RECALC_ALWAYS=0x01
4
+ CALC_ON_OPEN=0x02
5
+ PART_OF_SHARED_FORMULA=0x08
6
+
7
+ attr_reader :parser
8
+
9
+ def initialize(formula_string)
10
+ raise "formulas not available" unless FORMULAS_AVAILABLE
11
+ @lexer = ExcelFormula::Lexer.new(formula_string)
12
+ @parser = ExcelFormula::Parser.new(@lexer)
13
+ begin
14
+ @parser.formula
15
+ rescue RuntimeError => e
16
+ puts e
17
+ raise "invalid Excel formula"
18
+ end
19
+ end
20
+
21
+ def to_biff
22
+ rpn = @parser.rpn
23
+ [rpn.length].pack('v') + rpn
24
+ end
25
+ end
data/lib/surpass/row.rb CHANGED
@@ -145,7 +145,7 @@ class Row
145
145
  @cells << NumberCell.new(self, col, style_index, label)
146
146
  when Date, DateTime, Time
147
147
  @cells << NumberCell.new(self, col, style_index, as_excel_date(label))
148
- when ExcelFormula
148
+ when Formula
149
149
  @cells << FormulaCell.new(self, col, style_index, label)
150
150
  else
151
151
  raise "You are trying to write an object of class #{label.class.name} to a spreadsheet. Please convert this to a supported class such as String."
@@ -63,6 +63,38 @@ module Utilities
63
63
  def hex(value)
64
64
  "0x" + value.to_s(16)
65
65
  end
66
+
67
+ RE_CELL_EX = /^(\$)?([A-I]?[A-Z])(\$?)(\d+)$/i
68
+
69
+ def col_by_name(column_name)
70
+ col = 0
71
+ pow = 1
72
+ column_name.reverse.each_byte do |l|
73
+ col += (l - 64) * pow
74
+ pow *= 26
75
+ end
76
+ col - 1
77
+ end
78
+
79
+ def cell_to_rowcol(cell)
80
+ match = RE_CELL_EX.match(cell)
81
+ raise "Ill-formed single cell reference #{cell}" if match.nil?
82
+ col_abs, col, row_abs, row = match.captures
83
+ row = row.to_i - 1
84
+ col = col_by_name(col.upcase)
85
+ [row, col, row_abs.nil?, col_abs.nil?]
86
+ end
87
+
88
+ def cell_to_packed_rowcol(cell)
89
+ row, col, row_abs, col_abs = cell_to_rowcol(cell)
90
+ raise "Column #{col} is greater than IV (#{MAX_COL})" if col >= MAX_COL
91
+ raise "Row #{row} is greater than #{MAX_ROW} in #{cell}" if row >= MAX_ROW
92
+
93
+ col |= row_abs.to_i << 15
94
+ col |= col_abs.to_i << 14
95
+
96
+ [row, col]
97
+ end
66
98
  end
67
99
 
68
100
  def String.random_alphanumeric(size=16)
@@ -113,7 +113,7 @@ class Workbook
113
113
  options = 0x0020 # see Options Flags for Name record
114
114
 
115
115
  # FIXME: this is just a bad hack, need to use Formula to make the rpn
116
- #~ rpn = ExcelFormula.Formula('').rpn()[2:] # minus the size field
116
+ #~ rpn = Formula.Formula('').rpn()[2:] # minus the size field
117
117
  rpn = [0x3B, 0x0000, rstart, rend, cstart, cend].pack('Cv5')
118
118
  args = [options, 0x00, MACROS['Print_Area'], sheetnum, rpn]
119
119
  @names << NameRecord.new(*args).to_biff
@@ -152,7 +152,7 @@ class Worksheet
152
152
  @iterations_on = 0
153
153
  @delta = 0.001
154
154
  @save_recalc = 0
155
- @formula_options = ExcelFormula::RECALC_ALWAYS | ExcelFormula::CALC_ON_OPEN
155
+ @formula_options = Formula::RECALC_ALWAYS | Formula::CALC_ON_OPEN
156
156
 
157
157
  @print_headers = 0
158
158
  @print_grid = 0
@@ -553,9 +553,9 @@ class Worksheet
553
553
  end
554
554
  end
555
555
 
556
- def col_width(col)
557
- if cols.keys.include?(col)
558
- col.width_in_pixels
556
+ def col_width(column_index)
557
+ if cols.keys.include?(column_index)
558
+ cols[column_index].width_in_pixels
559
559
  else
560
560
  64
561
561
  end
data/lib/surpass.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Surpass
2
2
 
3
3
  # :stopdoc:
4
- VERSION = '0.0.7'
4
+ VERSION = '0.0.9'
5
5
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
6
6
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
7
7
  # :startdoc:
@@ -40,12 +40,22 @@ module Surpass
40
40
 
41
41
  Dir.glob(search_me).sort.each do |rb|
42
42
  next if File.basename(rb) === File.basename(__FILE__) # skip surpass.rb
43
+ next if File.basename(rb) =~ /^ExcelFormula/ unless FORMULAS_AVAILABLE
43
44
  require rb
44
45
  end
45
46
  end
46
47
 
47
48
  end # module Surpass
48
49
 
49
- Surpass.require_all_libs_relative_to(__FILE__)
50
+ begin
51
+ require 'rubygems'
52
+ require 'antlr3'
53
+ FORMULAS_AVAILABLE = true
54
+ rescue Exception => e
55
+ puts "antlr3 gem not found, formulas not available. Install antlr3 to enable formulas."
56
+ FORMULAS_AVAILABLE = false
57
+ end
50
58
 
59
+ Surpass.require_all_libs_relative_to(__FILE__)
51
60
  require 'date'
61
+
data/surpass.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{surpass}
5
- s.version = "0.0.6"
5
+ s.version = "0.0.8"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Ana Nelson"]
9
- s.date = %q{2009-10-27}
9
+ s.date = %q{2010-04-23}
10
10
  s.default_executable = %q{surpass}
11
11
  s.description = %q{Surpass is writing (and eventually reading) excel workbooks in pure Ruby. Surpass is based on xlwt (and pyExcelerator).
12
12
 
@@ -15,26 +15,25 @@ For comprehensive documentation, please refer to the PDF manual which is availab
15
15
  If you like to learn from playing with working examples, then there are plenty in the examples/ and webby/examples directories of the source code.}
16
16
  s.email = %q{ana@ananelson.com}
17
17
  s.executables = ["surpass"]
18
- s.extra_rdoc_files = ["History.txt", "LICENSE.txt", "README.txt", "bin/surpass", "lib/surpass/ExcelFormula.g", "lib/surpass/ExcelFormula.tokens", "lib/surpass/tokens.txt", "spec/data/random-strings.txt", "stats/cloc.txt", "stats/rcov.txt", "stats/specdoc.txt", "webby/README.txt", "webby/content/css/pygments.txt", "webby/content/index.txt", "webby/content/installation/index.txt", "webby/content/source/ExcelFormulaLexer.txt", "webby/content/source/ExcelFormulaParser.txt", "webby/content/source/biff_record.txt", "webby/content/source/bitmap.txt", "webby/content/source/cell.txt", "webby/content/source/chart.txt", "webby/content/source/column.txt", "webby/content/source/document.txt", "webby/content/source/excel_formula.txt", "webby/content/source/excel_magic.txt", "webby/content/source/formatting.txt", "webby/content/source/row.txt", "webby/content/source/style.txt", "webby/content/source/surpass.txt", "webby/content/source/utilities.txt", "webby/content/source/workbook.txt", "webby/content/source/worksheet.txt", "webby/layouts/book.txt", "webby/layouts/default.txt", "webby/layouts/two_column.txt", "webby/layouts/web.txt"]
19
- s.files = [".bzr/README", ".bzr/branch-format", ".bzr/branch/branch.conf", ".bzr/branch/format", ".bzr/branch/last-revision", ".bzr/branch/tags", ".bzr/checkout/conflicts", ".bzr/checkout/dirstate", ".bzr/checkout/format", ".bzr/checkout/merge-hashes", ".bzr/repository/format", ".bzr/repository/indices/151ac19fd622c8084eca354d80336510.iix", ".bzr/repository/indices/151ac19fd622c8084eca354d80336510.rix", ".bzr/repository/indices/151ac19fd622c8084eca354d80336510.six", ".bzr/repository/indices/151ac19fd622c8084eca354d80336510.tix", ".bzr/repository/indices/29647a57de6255f81ed838b5aaf89e54.iix", ".bzr/repository/indices/29647a57de6255f81ed838b5aaf89e54.rix", ".bzr/repository/indices/29647a57de6255f81ed838b5aaf89e54.six", ".bzr/repository/indices/29647a57de6255f81ed838b5aaf89e54.tix", ".bzr/repository/indices/5901bb87fc326fc481c268c7093087d6.iix", ".bzr/repository/indices/5901bb87fc326fc481c268c7093087d6.rix", ".bzr/repository/indices/5901bb87fc326fc481c268c7093087d6.six", ".bzr/repository/indices/5901bb87fc326fc481c268c7093087d6.tix", ".bzr/repository/indices/60afa9e7714310e7df9780bb1be8904f.iix", ".bzr/repository/indices/60afa9e7714310e7df9780bb1be8904f.rix", ".bzr/repository/indices/60afa9e7714310e7df9780bb1be8904f.six", ".bzr/repository/indices/60afa9e7714310e7df9780bb1be8904f.tix", ".bzr/repository/indices/6f8954ed6fa3fc3771613f06347014f4.iix", ".bzr/repository/indices/6f8954ed6fa3fc3771613f06347014f4.rix", ".bzr/repository/indices/6f8954ed6fa3fc3771613f06347014f4.six", ".bzr/repository/indices/6f8954ed6fa3fc3771613f06347014f4.tix", ".bzr/repository/indices/764c4380dd16055c6dc1d6ed22ce4c16.iix", ".bzr/repository/indices/764c4380dd16055c6dc1d6ed22ce4c16.rix", ".bzr/repository/indices/764c4380dd16055c6dc1d6ed22ce4c16.six", ".bzr/repository/indices/764c4380dd16055c6dc1d6ed22ce4c16.tix", ".bzr/repository/indices/929fece420d91bbac5a96347aee1b3d6.iix", ".bzr/repository/indices/929fece420d91bbac5a96347aee1b3d6.rix", ".bzr/repository/indices/929fece420d91bbac5a96347aee1b3d6.six", ".bzr/repository/indices/929fece420d91bbac5a96347aee1b3d6.tix", ".bzr/repository/indices/bba034b51d01b176f36c84a60d9f947f.iix", ".bzr/repository/indices/bba034b51d01b176f36c84a60d9f947f.rix", ".bzr/repository/indices/bba034b51d01b176f36c84a60d9f947f.six", ".bzr/repository/indices/bba034b51d01b176f36c84a60d9f947f.tix", ".bzr/repository/indices/de1db3c0ce54620ccf022905ad589c90.iix", ".bzr/repository/indices/de1db3c0ce54620ccf022905ad589c90.rix", ".bzr/repository/indices/de1db3c0ce54620ccf022905ad589c90.six", ".bzr/repository/indices/de1db3c0ce54620ccf022905ad589c90.tix", ".bzr/repository/indices/fac52d20970efba4203df3cef78176a2.iix", ".bzr/repository/indices/fac52d20970efba4203df3cef78176a2.rix", ".bzr/repository/indices/fac52d20970efba4203df3cef78176a2.six", ".bzr/repository/indices/fac52d20970efba4203df3cef78176a2.tix", ".bzr/repository/indices/fd968e63b0439f3eccfaf7ce7d421d0c.iix", ".bzr/repository/indices/fd968e63b0439f3eccfaf7ce7d421d0c.rix", ".bzr/repository/indices/fd968e63b0439f3eccfaf7ce7d421d0c.six", ".bzr/repository/indices/fd968e63b0439f3eccfaf7ce7d421d0c.tix", ".bzr/repository/obsolete_packs/14491a06534831c3c83658e356759a01.iix", ".bzr/repository/obsolete_packs/14491a06534831c3c83658e356759a01.pack", ".bzr/repository/obsolete_packs/14491a06534831c3c83658e356759a01.rix", ".bzr/repository/obsolete_packs/14491a06534831c3c83658e356759a01.six", ".bzr/repository/obsolete_packs/14491a06534831c3c83658e356759a01.tix", ".bzr/repository/obsolete_packs/25281e7274abffc32e7a43da7f8d0461.iix", ".bzr/repository/obsolete_packs/25281e7274abffc32e7a43da7f8d0461.pack", ".bzr/repository/obsolete_packs/25281e7274abffc32e7a43da7f8d0461.rix", ".bzr/repository/obsolete_packs/25281e7274abffc32e7a43da7f8d0461.six", ".bzr/repository/obsolete_packs/25281e7274abffc32e7a43da7f8d0461.tix", ".bzr/repository/obsolete_packs/337318464912506e396a98e2846375ee.iix", ".bzr/repository/obsolete_packs/337318464912506e396a98e2846375ee.pack", ".bzr/repository/obsolete_packs/337318464912506e396a98e2846375ee.rix", ".bzr/repository/obsolete_packs/337318464912506e396a98e2846375ee.six", ".bzr/repository/obsolete_packs/337318464912506e396a98e2846375ee.tix", ".bzr/repository/obsolete_packs/4b641e21199b5b3983ead40baee59157.iix", ".bzr/repository/obsolete_packs/4b641e21199b5b3983ead40baee59157.pack", ".bzr/repository/obsolete_packs/4b641e21199b5b3983ead40baee59157.rix", ".bzr/repository/obsolete_packs/4b641e21199b5b3983ead40baee59157.six", ".bzr/repository/obsolete_packs/4b641e21199b5b3983ead40baee59157.tix", ".bzr/repository/obsolete_packs/69d1464bc492b242c2c80b98f1eaca16.iix", ".bzr/repository/obsolete_packs/69d1464bc492b242c2c80b98f1eaca16.pack", ".bzr/repository/obsolete_packs/69d1464bc492b242c2c80b98f1eaca16.rix", ".bzr/repository/obsolete_packs/69d1464bc492b242c2c80b98f1eaca16.six", ".bzr/repository/obsolete_packs/69d1464bc492b242c2c80b98f1eaca16.tix", ".bzr/repository/obsolete_packs/7e561e10b317a3561596c12162aa0b62.iix", ".bzr/repository/obsolete_packs/7e561e10b317a3561596c12162aa0b62.pack", ".bzr/repository/obsolete_packs/7e561e10b317a3561596c12162aa0b62.rix", ".bzr/repository/obsolete_packs/7e561e10b317a3561596c12162aa0b62.six", ".bzr/repository/obsolete_packs/7e561e10b317a3561596c12162aa0b62.tix", ".bzr/repository/obsolete_packs/873c887bbba83618f871b71b92dd2cab.iix", ".bzr/repository/obsolete_packs/873c887bbba83618f871b71b92dd2cab.pack", ".bzr/repository/obsolete_packs/873c887bbba83618f871b71b92dd2cab.rix", ".bzr/repository/obsolete_packs/873c887bbba83618f871b71b92dd2cab.six", ".bzr/repository/obsolete_packs/873c887bbba83618f871b71b92dd2cab.tix", ".bzr/repository/pack-names", ".bzr/repository/packs/151ac19fd622c8084eca354d80336510.pack", ".bzr/repository/packs/29647a57de6255f81ed838b5aaf89e54.pack", ".bzr/repository/packs/5901bb87fc326fc481c268c7093087d6.pack", ".bzr/repository/packs/60afa9e7714310e7df9780bb1be8904f.pack", ".bzr/repository/packs/6f8954ed6fa3fc3771613f06347014f4.pack", ".bzr/repository/packs/764c4380dd16055c6dc1d6ed22ce4c16.pack", ".bzr/repository/packs/929fece420d91bbac5a96347aee1b3d6.pack", ".bzr/repository/packs/bba034b51d01b176f36c84a60d9f947f.pack", ".bzr/repository/packs/de1db3c0ce54620ccf022905ad589c90.pack", ".bzr/repository/packs/fac52d20970efba4203df3cef78176a2.pack", ".bzr/repository/packs/fd968e63b0439f3eccfaf7ce7d421d0c.pack", ".bzrignore", "History.txt", "LICENSE.txt", "README.txt", "Rakefile", "bin/surpass", "examples/big-16mb.rb", "examples/big-random-strings.rb", "examples/blanks.rb", "examples/col_width.rb", "examples/col_width.xls", "examples/dates.rb", "examples/format.rb", "examples/hello-world.rb", "examples/image.rb", "examples/merged.rb", "examples/merged0.rb", "examples/merged1.rb", "examples/num_formats.rb", "examples/numbers.rb", "examples/numbers.xls", "examples/outline.rb", "examples/outline.xls", "examples/panes.rb", "examples/protection.rb", "examples/python.bmp", "examples/row_styles.rb", "examples/row_styles_empty.rb", "examples/set_cell_and_range_style.rb", "examples/wrapped-text.rb", "examples/wrapped-text.xls", "examples/write_arrays.rb", "examples/write_arrays.xls", "examples/ws_props.rb", "lib/surpass.rb", "lib/surpass/ExcelFormula.g", "lib/surpass/ExcelFormula.tokens", "lib/surpass/ExcelFormulaLexer.rb", "lib/surpass/ExcelFormulaParser.rb", "lib/surpass/biff_record.rb", "lib/surpass/bitmap.rb", "lib/surpass/cell.rb", "lib/surpass/chart.rb", "lib/surpass/column.rb", "lib/surpass/document.rb", "lib/surpass/excel_formula.rb", "lib/surpass/excel_magic.rb", "lib/surpass/formatting.rb", "lib/surpass/row.rb", "lib/surpass/style.rb", "lib/surpass/tokens.txt", "lib/surpass/utilities.rb", "lib/surpass/workbook.rb", "lib/surpass/worksheet.rb", "out.bin", "spec/biff_record_spec.rb", "spec/cell_spec.rb", "spec/data/random-strings.txt", "spec/document_spec.rb", "spec/excel_formula_spec.rb", "spec/formatting_spec.rb", "spec/output/cells-rk.xls", "spec/output/cells.xls", "spec/output/mini.xls", "spec/reference/P-0508-0000507647-3280-5298.xls", "spec/reference/all-cell-styles.bin", "spec/reference/all-number-formats.bin", "spec/reference/all-styles.bin", "spec/reference/mini.xls", "spec/row_spec.rb", "spec/spec_helper.rb", "spec/style_spec.rb", "spec/surpass_spec.rb", "spec/utilities_spec.rb", "spec/workbook_spec.rb", "spec/worksheet_spec.rb", "stats/cloc.txt", "stats/rcov.txt", "stats/specdoc.txt", "test/test_surpass.rb", "webby/.DS_Store", "webby/README.txt", "webby/Sitefile", "webby/content/css/pygments.txt", "webby/content/css/style.css", "webby/content/examples/.array.rb.swp", "webby/content/examples/autoformat.png", "webby/content/examples/autoformat.rb", "webby/content/examples/autoformat.xls", "webby/content/examples/borders.png", "webby/content/examples/borders.rb", "webby/content/examples/borders.xls", "webby/content/examples/colours.png", "webby/content/examples/colours.rb", "webby/content/examples/colours.xls", "webby/content/examples/data.png", "webby/content/examples/data.rb", "webby/content/examples/data.xls", "webby/content/examples/formatting.png", "webby/content/examples/formatting.rb", "webby/content/examples/formatting.xls", "webby/content/examples/hello-world.png", "webby/content/examples/hello-world.py", "webby/content/examples/hello-world.rb", "webby/content/examples/hello-world.xls", "webby/content/examples/number-format-string.png", "webby/content/examples/number-format-string.rb", "webby/content/examples/number-format-string.xls", "webby/content/examples/patterns.png", "webby/content/examples/patterns.rb", "webby/content/examples/patterns.xls", "webby/content/examples/show-greens.sh", "webby/content/examples/surpass-info.sh", "webby/content/img/Thumbs.db", "webby/content/img/bg_menu.gif", "webby/content/img/bg_t.gif", "webby/content/img/bullet.gif", "webby/content/img/logo.png", "webby/content/img/logo_.jpg", "webby/content/img/top_bg.gif", "webby/content/img/top_bg_.gif", "webby/content/index.txt", "webby/content/installation/index.txt", "webby/content/source/ExcelFormulaLexer.txt", "webby/content/source/ExcelFormulaParser.txt", "webby/content/source/biff_record.txt", "webby/content/source/bitmap.txt", "webby/content/source/cell.txt", "webby/content/source/chart.txt", "webby/content/source/column.txt", "webby/content/source/document.txt", "webby/content/source/excel_formula.txt", "webby/content/source/excel_magic.txt", "webby/content/source/formatting.txt", "webby/content/source/row.txt", "webby/content/source/style.txt", "webby/content/source/surpass.txt", "webby/content/source/utilities.txt", "webby/content/source/workbook.txt", "webby/content/source/worksheet.txt", "webby/content/surpass-manual.erb", "webby/layouts/book.txt", "webby/layouts/default.txt", "webby/layouts/two_column.txt", "webby/layouts/web.txt", "webby/output/.cairn", "webby/output/css/pygments.css", "webby/output/css/style.css", "webby/output/examples/autoformat.png", "webby/output/examples/autoformat.rb", "webby/output/examples/autoformat.xls", "webby/output/examples/borders.png", "webby/output/examples/borders.rb", "webby/output/examples/borders.xls", "webby/output/examples/colours.png", "webby/output/examples/colours.rb", "webby/output/examples/colours.xls", "webby/output/examples/data.png", "webby/output/examples/data.rb", "webby/output/examples/data.xls", "webby/output/examples/formatting.png", "webby/output/examples/formatting.rb", "webby/output/examples/formatting.xls", "webby/output/examples/hello-world.png", "webby/output/examples/hello-world.py", "webby/output/examples/hello-world.rb", "webby/output/examples/hello-world.xls", "webby/output/examples/number-format-string.png", "webby/output/examples/number-format-string.rb", "webby/output/examples/number-format-string.xls", "webby/output/examples/patterns.png", "webby/output/examples/patterns.rb", "webby/output/examples/patterns.xls", "webby/output/examples/show-greens.sh", "webby/output/examples/surpass-info.sh", "webby/output/img/Thumbs.db", "webby/output/img/bg_menu.gif", "webby/output/img/bg_t.gif", "webby/output/img/bullet.gif", "webby/output/img/logo.png", "webby/output/img/logo_.jpg", "webby/output/img/top_bg.gif", "webby/output/img/top_bg_.gif", "webby/output/index.html", "webby/output/installation/index.html", "webby/output/source/ExcelFormulaLexer.html", "webby/output/source/ExcelFormulaParser.html", "webby/output/source/biff_record.html", "webby/output/source/bitmap.html", "webby/output/source/cell.html", "webby/output/source/chart.html", "webby/output/source/column.html", "webby/output/source/document.html", "webby/output/source/excel_formula.html", "webby/output/source/excel_magic.html", "webby/output/source/formatting.html", "webby/output/source/row.html", "webby/output/source/style.html", "webby/output/source/surpass.html", "webby/output/source/utilities.html", "webby/output/source/workbook.html", "webby/output/source/worksheet.html", "webby/output/surpass-manual-0-0-5.pdf", "webby/output/surpass-manual.aux", "webby/output/surpass-manual.log", "webby/output/surpass-manual.out", "webby/output/surpass-manual.tex", "webby/output/surpass-manual.toc", "webby/output/surpass-r65.tgz", "webby/rsync-exclude", "webby/tasks/latex.rake", "webby/tasks/screenshots.rb", "webby/templates/article.erb", "webby/templates/book.erb", "webby/templates/page.erb"]
18
+ s.extra_rdoc_files = ["History.txt", "LICENSE.txt", "README.txt", "bin/surpass", "lib/surpass/ExcelFormula.g", "lib/surpass/ExcelFormulaGrammar.g", "lib/surpass/ExcelFormulaGrammar.tokens", "lib/surpass/tokens.txt"]
19
+ s.files = ["History.txt", "LICENSE.txt", "README.txt", "Rakefile", "bin/surpass", "lib/surpass.rb", "lib/surpass/ExcelFormula.g", "lib/surpass/ExcelFormulaGrammar.g", "lib/surpass/ExcelFormulaGrammar.tokens", "lib/surpass/ExcelFormulaGrammarLexer.rb", "lib/surpass/ExcelFormulaGrammarParser.rb", "lib/surpass/biff_record.rb", "lib/surpass/bitmap.rb", "lib/surpass/cell.rb", "lib/surpass/chart.rb", "lib/surpass/column.rb", "lib/surpass/document.rb", "lib/surpass/excel_formula.rb", "lib/surpass/excel_magic.rb", "lib/surpass/formatting.rb", "lib/surpass/row.rb", "lib/surpass/style.rb", "lib/surpass/tokens.txt", "lib/surpass/utilities.rb", "lib/surpass/workbook.rb", "lib/surpass/worksheet.rb", "surpass.gemspec"]
20
20
  s.homepage = %q{http://surpass.rubyforge.org}
21
21
  s.rdoc_options = ["--main", "README.txt"]
22
22
  s.require_paths = ["lib"]
23
23
  s.rubyforge_project = %q{surpass}
24
- s.rubygems_version = %q{1.3.5}
24
+ s.rubygems_version = %q{1.3.6}
25
25
  s.summary = %q{Surpass is writing (and eventually reading) excel workbooks in pure Ruby}
26
- s.test_files = ["test/test_surpass.rb"]
27
26
 
28
27
  if s.respond_to? :specification_version then
29
28
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
30
29
  s.specification_version = 3
31
30
 
32
31
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
33
- s.add_development_dependency(%q<bones>, [">= 2.5.1"])
32
+ s.add_development_dependency(%q<bones>, [">= 3.4.1"])
34
33
  else
35
- s.add_dependency(%q<bones>, [">= 2.5.1"])
34
+ s.add_dependency(%q<bones>, [">= 3.4.1"])
36
35
  end
37
36
  else
38
- s.add_dependency(%q<bones>, [">= 2.5.1"])
37
+ s.add_dependency(%q<bones>, [">= 3.4.1"])
39
38
  end
40
39
  end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: surpass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 9
9
+ version: 0.0.9
5
10
  platform: ruby
6
11
  authors:
7
12
  - Ana Nelson
@@ -9,19 +14,23 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-11-15 00:00:00 +00:00
17
+ date: 2010-05-03 00:00:00 +01:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: bones
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
23
- version: 2.5.1
24
- version:
27
+ segments:
28
+ - 3
29
+ - 4
30
+ - 1
31
+ version: 3.4.1
32
+ type: :development
33
+ version_requirements: *id001
25
34
  description: |-
26
35
  Surpass is writing (and eventually reading) excel workbooks in pure Ruby. Surpass is based on xlwt (and pyExcelerator).
27
36
 
@@ -47,6 +56,10 @@ files:
47
56
  - README.txt
48
57
  - Rakefile
49
58
  - bin/surpass
59
+ - debug-examples/formula-cell.bin
60
+ - debug-examples/formula-cell.rb
61
+ - debug-examples/formula-record.bin
62
+ - debug-examples/formula-record.rb
50
63
  - lib/surpass.rb
51
64
  - lib/surpass/ExcelFormula.g
52
65
  - lib/surpass/ExcelFormula.tokens
@@ -58,30 +71,16 @@ files:
58
71
  - lib/surpass/chart.rb
59
72
  - lib/surpass/column.rb
60
73
  - lib/surpass/document.rb
61
- - lib/surpass/excel_formula.rb
62
74
  - lib/surpass/excel_magic.rb
63
75
  - lib/surpass/formatting.rb
76
+ - lib/surpass/formula.rb
64
77
  - lib/surpass/row.rb
65
78
  - lib/surpass/style.rb
66
79
  - lib/surpass/tokens.txt
67
80
  - lib/surpass/utilities.rb
68
81
  - lib/surpass/workbook.rb
69
82
  - lib/surpass/worksheet.rb
70
- - out.bin
71
83
  - surpass.gemspec
72
- - tasks/ann.rake
73
- - tasks/bones.rake
74
- - tasks/gem.rake
75
- - tasks/git.rake
76
- - tasks/notes.rake
77
- - tasks/post_load.rake
78
- - tasks/rdoc.rake
79
- - tasks/rubyforge.rake
80
- - tasks/setup.rb
81
- - tasks/spec.rake
82
- - tasks/svn.rake
83
- - tasks/test.rake
84
- - tasks/zentest.rake
85
84
  has_rdoc: true
86
85
  homepage: http://surpass.rubyforge.org
87
86
  licenses: []
@@ -96,18 +95,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
95
  requirements:
97
96
  - - ">="
98
97
  - !ruby/object:Gem::Version
98
+ segments:
99
+ - 0
99
100
  version: "0"
100
- version:
101
101
  required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - ">="
104
104
  - !ruby/object:Gem::Version
105
+ segments:
106
+ - 0
105
107
  version: "0"
106
- version:
107
108
  requirements: []
108
109
 
109
110
  rubyforge_project: surpass
110
- rubygems_version: 1.3.5
111
+ rubygems_version: 1.3.6
111
112
  signing_key:
112
113
  specification_version: 3
113
114
  summary: Surpass is writing (and eventually reading) excel workbooks in pure Ruby
@@ -1,23 +0,0 @@
1
- class ExcelFormula
2
- NO_CALCS=0x00
3
- RECALC_ALWAYS=0x01
4
- CALC_ON_OPEN=0x02
5
- PART_OF_SHARED_FORMULA=0x08
6
-
7
- attr_reader :parser
8
-
9
- def initialize(formula_string)
10
- @parser = ExcelFormulaParser.new(formula_string)
11
- # begin
12
- @parser.formula
13
- # rescue RuntimeError => e
14
- # puts e
15
- # raise "invalid Excel formula"
16
- # end
17
- end
18
-
19
- def to_biff
20
- rpn = @parser.rpn
21
- [rpn.size].pack('v') + rpn
22
- end
23
- end
data/out.bin DELETED
Binary file
data/tasks/ann.rake DELETED
@@ -1,80 +0,0 @@
1
-
2
- begin
3
- require 'bones/smtp_tls'
4
- rescue LoadError
5
- require 'net/smtp'
6
- end
7
- require 'time'
8
-
9
- namespace :ann do
10
-
11
- # A prerequisites task that all other tasks depend upon
12
- task :prereqs
13
-
14
- file PROJ.ann.file do
15
- ann = PROJ.ann
16
- puts "Generating #{ann.file}"
17
- File.open(ann.file,'w') do |fd|
18
- fd.puts("#{PROJ.name} version #{PROJ.version}")
19
- fd.puts(" by #{Array(PROJ.authors).first}") if PROJ.authors
20
- fd.puts(" #{PROJ.url}") if PROJ.url.valid?
21
- fd.puts(" (the \"#{PROJ.release_name}\" release)") if PROJ.release_name
22
- fd.puts
23
- fd.puts("== DESCRIPTION")
24
- fd.puts
25
- fd.puts(PROJ.description)
26
- fd.puts
27
- fd.puts(PROJ.changes.sub(%r/^.*$/, '== CHANGES'))
28
- fd.puts
29
- ann.paragraphs.each do |p|
30
- fd.puts "== #{p.upcase}"
31
- fd.puts
32
- fd.puts paragraphs_of(PROJ.readme_file, p).join("\n\n")
33
- fd.puts
34
- end
35
- fd.puts ann.text if ann.text
36
- end
37
- end
38
-
39
- desc "Create an announcement file"
40
- task :announcement => ['ann:prereqs', PROJ.ann.file]
41
-
42
- desc "Send an email announcement"
43
- task :email => ['ann:prereqs', PROJ.ann.file] do
44
- ann = PROJ.ann
45
- from = ann.email[:from] || Array(PROJ.authors).first || PROJ.email
46
- to = Array(ann.email[:to])
47
-
48
- ### build a mail header for RFC 822
49
- rfc822msg = "From: #{from}\n"
50
- rfc822msg << "To: #{to.join(',')}\n"
51
- rfc822msg << "Subject: [ANN] #{PROJ.name} #{PROJ.version}"
52
- rfc822msg << " (#{PROJ.release_name})" if PROJ.release_name
53
- rfc822msg << "\n"
54
- rfc822msg << "Date: #{Time.new.rfc822}\n"
55
- rfc822msg << "Message-Id: "
56
- rfc822msg << "<#{"%.8f" % Time.now.to_f}@#{ann.email[:domain]}>\n\n"
57
- rfc822msg << File.read(ann.file)
58
-
59
- params = [:server, :port, :domain, :acct, :passwd, :authtype].map do |key|
60
- ann.email[key]
61
- end
62
-
63
- params[3] = PROJ.email if params[3].nil?
64
-
65
- if params[4].nil?
66
- STDOUT.write "Please enter your e-mail password (#{params[3]}): "
67
- params[4] = STDIN.gets.chomp
68
- end
69
-
70
- ### send email
71
- Net::SMTP.start(*params) {|smtp| smtp.sendmail(rfc822msg, from, to)}
72
- end
73
- end # namespace :ann
74
-
75
- desc 'Alias to ann:announcement'
76
- task :ann => 'ann:announcement'
77
-
78
- CLOBBER << PROJ.ann.file
79
-
80
- # EOF
data/tasks/bones.rake DELETED
@@ -1,20 +0,0 @@
1
-
2
- if HAVE_BONES
3
-
4
- namespace :bones do
5
-
6
- desc 'Show the PROJ open struct'
7
- task :debug do |t|
8
- atr = if t.application.top_level_tasks.length == 2
9
- t.application.top_level_tasks.pop
10
- end
11
-
12
- if atr then Bones::Debug.show_attr(PROJ, atr)
13
- else Bones::Debug.show PROJ end
14
- end
15
-
16
- end # namespace :bones
17
-
18
- end # HAVE_BONES
19
-
20
- # EOF