pivotal-erector 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/README.txt +81 -0
  2. data/VERSION.yml +4 -0
  3. data/bin/erect +7 -0
  4. data/lib/erector/erect.rb +148 -0
  5. data/lib/erector/erected.rb +63 -0
  6. data/lib/erector/extensions/object.rb +18 -0
  7. data/lib/erector/indenting.rb +36 -0
  8. data/lib/erector/rails/extensions/action_controller/1.2.5/action_controller.rb +17 -0
  9. data/lib/erector/rails/extensions/action_controller/2.2.0/action_controller.rb +26 -0
  10. data/lib/erector/rails/extensions/action_controller.rb +8 -0
  11. data/lib/erector/rails/extensions/action_view.rb +21 -0
  12. data/lib/erector/rails/extensions/widget/1.2.5/widget.rb +18 -0
  13. data/lib/erector/rails/extensions/widget/2.2.0/widget.rb +36 -0
  14. data/lib/erector/rails/extensions/widget.rb +117 -0
  15. data/lib/erector/rails/supported_rails_versions.rb +14 -0
  16. data/lib/erector/rails/template_handlers/1.2.5/action_view_template_handler.rb +32 -0
  17. data/lib/erector/rails/template_handlers/2.0.0/action_view_template_handler.rb +36 -0
  18. data/lib/erector/rails/template_handlers/2.1.0/action_view_template_handler.rb +31 -0
  19. data/lib/erector/rails/template_handlers/2.2.0/action_view_template_handler.rb +46 -0
  20. data/lib/erector/rails/template_handlers/action_view_template_handler.rb +14 -0
  21. data/lib/erector/rails.rb +6 -0
  22. data/lib/erector/raw_string.rb +8 -0
  23. data/lib/erector/rhtml.treetop +156 -0
  24. data/lib/erector/unicode.rb +18185 -0
  25. data/lib/erector/unicode_builder.rb +67 -0
  26. data/lib/erector/version.rb +10 -0
  27. data/lib/erector/widget.rb +510 -0
  28. data/lib/erector/widgets/table.rb +96 -0
  29. data/lib/erector/widgets.rb +2 -0
  30. data/lib/erector.rb +16 -0
  31. data/spec/core_spec_suite.rb +3 -0
  32. data/spec/erect/erect_spec.rb +145 -0
  33. data/spec/erect/erected_spec.rb +80 -0
  34. data/spec/erect/rhtml_parser_spec.rb +318 -0
  35. data/spec/erector/indentation_spec.rb +136 -0
  36. data/spec/erector/unicode_builder_spec.rb +75 -0
  37. data/spec/erector/widget_spec.rb +657 -0
  38. data/spec/erector/widgets/table_spec.rb +99 -0
  39. data/spec/rails_spec_suite.rb +3 -0
  40. data/spec/spec_helper.rb +54 -0
  41. data/spec/spec_suite.rb +45 -0
  42. metadata +118 -0
@@ -0,0 +1,75 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../spec_helper")
2
+ require File.expand_path("#{File.dirname(__FILE__)}/../../lib/erector/unicode_builder")
3
+
4
+ describe "build unicode" do
5
+
6
+ def make_builder(input_string)
7
+ @output = ""
8
+ Erector::UnicodeBuilder.new(
9
+ StringIO.new(input_string),
10
+ StringIO.new(@output))
11
+ end
12
+
13
+ it "#generate generates header and footer" do
14
+ make_builder("").generate()
15
+ @output.should == "Erector::CHARACTERS = {\n}\n"
16
+ end
17
+
18
+ it "generates nothing from empty file" do
19
+ make_builder("").process_file()
20
+ @output.should == ""
21
+ end
22
+
23
+ it "generates nothing from blank line" do
24
+ make_builder("\n").process_file()
25
+ @output.should == ""
26
+ end
27
+
28
+ it "generates entry from a simple line" do
29
+ make_builder(%q{
30
+ 0025;PERCENT SIGN;Po;0;ET;;;;;N;;;;;
31
+ }).process_file()
32
+ @output.should == " :percent_sign => 0x0025\n"
33
+ end
34
+
35
+ it "can process two lines" do
36
+ make_builder(%q{
37
+ 0906;DEVANAGARI LETTER AA;Lo;0;L;;;;;N;;;;;
38
+ 237E;BELL SYMBOL;So;0;ON;;;;;N;;;;;
39
+ }).process_file()
40
+ @output.should == " :devanagari_letter_aa => 0x0906,\n" +
41
+ " :bell_symbol => 0x237e\n"
42
+ end
43
+
44
+ it "also adds an entry for an alias" do
45
+ make_builder(%q{
46
+ 2192;RIGHTWARDS ARROW;Sm;0;ON;;;;;N;RIGHT ARROW;;;;
47
+ }).process_file()
48
+ @output.should == " :rightwards_arrow => 0x2192,\n" +
49
+ " :right_arrow => 0x2192\n"
50
+ end
51
+
52
+ it "can handle hyphen in name" do
53
+ make_builder(%q{
54
+ 2673;RECYCLING SYMBOL FOR TYPE-1 PLASTICS;So;0;ON;;;;;N;;pete;;;
55
+ }).process_file()
56
+ @output.should == " :recycling_symbol_for_type_1_plastics => 0x2673\n"
57
+ end
58
+
59
+ it "can handle characters above 0xffff" do
60
+ make_builder(%q{
61
+ 10400;DESERET CAPITAL LETTER LONG I;Lu;0;L;;;;;N;;;;10428;
62
+ }).process_file()
63
+ @output.should == " :deseret_capital_letter_long_i => 0x10400\n"
64
+ end
65
+
66
+ it "ignores entries whose names start with less than" do
67
+ make_builder(%q{
68
+ F0000;<Plane 15 Private Use, First>;Co;0;L;;;;;N;;;;;
69
+ FFFFD;<Plane 15 Private Use, Last>;Co;0;L;;;;;N;;;;;
70
+ }).process_file()
71
+ @output.should == ""
72
+ end
73
+
74
+ end
75
+