ember 0.0.1 → 0.1.0

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.
Files changed (65) hide show
  1. data/HISTORY +79 -0
  2. data/INSTALL +31 -0
  3. data/MANUAL +25 -0
  4. data/README +54 -0
  5. data/THEORY +151 -0
  6. data/USAGE +250 -0
  7. data/bin/ember +58 -20
  8. data/doc/ann.xml +93 -0
  9. data/doc/api/Ember.html +436 -0
  10. data/doc/api/Ember/Template.html +774 -0
  11. data/doc/api/Ember/Template/Program.html +877 -0
  12. data/doc/api/Ember/Template/Program/Statement.html +181 -0
  13. data/doc/api/_index.html +139 -0
  14. data/doc/api/class_list.html +36 -0
  15. data/doc/api/css/common.css +1 -0
  16. data/doc/api/css/full_list.css +50 -0
  17. data/doc/api/css/style.css +273 -0
  18. data/doc/api/file.LICENSE.html +73 -0
  19. data/doc/api/file_list.html +38 -0
  20. data/doc/api/frames.html +13 -0
  21. data/doc/api/index.html +72 -13
  22. data/doc/api/js/app.js +111 -0
  23. data/doc/api/js/full_list.js +117 -0
  24. data/doc/api/js/{jquery-1.3.2.min.js → jquery.js} +0 -0
  25. data/doc/api/method_list.html +179 -0
  26. data/doc/api/top-level-namespace.html +87 -0
  27. data/doc/index.html +1353 -682
  28. data/inochi.opts +31 -0
  29. data/lib/ember.rb +1 -15
  30. data/lib/ember/inochi.rb +103 -0
  31. data/lib/ember/template.rb +66 -78
  32. data/test/combinatorics.rb +188 -0
  33. data/test/ember/template_test.rb +137 -0
  34. data/test/runner +25 -0
  35. data/test/test_helper.rb +5 -0
  36. metadata +61 -51
  37. data/doc/api/apple-touch-icon.png +0 -0
  38. data/doc/api/classes/Ember.html +0 -61
  39. data/doc/api/classes/Ember/Template.html +0 -413
  40. data/doc/api/classes/Ember/Template/Program.html +0 -60
  41. data/doc/api/created.rid +0 -1
  42. data/doc/api/css/main.css +0 -263
  43. data/doc/api/css/panel.css +0 -383
  44. data/doc/api/css/reset.css +0 -53
  45. data/doc/api/favicon.ico +0 -0
  46. data/doc/api/files/LICENSE.html +0 -76
  47. data/doc/api/files/lib/ember/template_rb.html +0 -66
  48. data/doc/api/files/lib/ember_rb.html +0 -63
  49. data/doc/api/i/arrows.png +0 -0
  50. data/doc/api/i/results_bg.png +0 -0
  51. data/doc/api/i/tree_bg.png +0 -0
  52. data/doc/api/js/jquery-effect.js +0 -593
  53. data/doc/api/js/main.js +0 -22
  54. data/doc/api/js/searchdoc.js +0 -628
  55. data/doc/api/panel/index.html +0 -71
  56. data/doc/api/panel/search_index.js +0 -1
  57. data/doc/api/panel/tree.js +0 -1
  58. data/doc/history.erb +0 -34
  59. data/doc/index.erb +0 -11
  60. data/doc/intro.erb +0 -53
  61. data/doc/setup.erb +0 -78
  62. data/doc/usage.erb +0 -280
  63. data/rakefile +0 -14
  64. data/test/ember.rb +0 -17
  65. data/test/ember/template.rb +0 -141
data/rakefile DELETED
@@ -1,14 +0,0 @@
1
- #--
2
- # Copyright protects this work.
3
- # See LICENSE file for details.
4
- #++
5
-
6
- require 'rubygems'
7
- gem 'inochi', '~> 1'
8
- require 'inochi'
9
-
10
- Inochi.rake :Ember,
11
- :test_with => :dfect,
12
- :rubyforge_project => 'sunaku',
13
- :upload_target => File.expand_path('~/www/lib/ember/'),
14
- :upload_delete => true
@@ -1,17 +0,0 @@
1
- unless Ember.const_defined? :INOCHI
2
- fail "#{Ember} must have INOCHI constant"
3
- end
4
-
5
- Ember::INOCHI.each do |param, value|
6
- const = param.to_s.upcase
7
-
8
- unless Ember.const_defined? const
9
- fail "#{Ember} must have #{const} constant"
10
- end
11
-
12
- unless Ember.const_get(const) == value
13
- fail "#{Ember}'s #{const} constant must be provided by Inochi"
14
- end
15
- end
16
-
17
- puts "Inochi establishment tests passed!"
@@ -1,141 +0,0 @@
1
- require 'dfect/mini'
2
- require 'inochi/util/combo'
3
-
4
- describe "A template" do
5
- it "renders single & multi-line comments as nothing" do
6
- WHITESPACE.each_join do |s|
7
- render("<%##{s}an#{s}eRuby#{s}comment#{s}%>").must_equal("")
8
- end
9
- end
10
-
11
- it "renders directives with whitespace-only bodies as nothing" do
12
- WHITESPACE.each_join do |s|
13
- OPERATIONS.each do |o|
14
- render("<%#{o}#{s}%>").must_equal("")
15
- end
16
- end
17
- end
18
-
19
- it "renders escaped directives in unescaped form" do
20
- render("<%%%>").must_equal("<%%>")
21
-
22
- render("<%% %>").must_equal("<% %>")
23
-
24
- lambda { render("<% %%>") }.
25
- must_raise(SyntaxError, "the trailing delimiter must not be unescaped")
26
-
27
- render("<%%%%>").must_equal("<%%%>",
28
- "the trailing delimiter must not be unescaped")
29
-
30
- WHITESPACE.each_join do |s|
31
- body = "#{s}an#{s}eRuby#{s}directive#{s}"
32
-
33
- OPERATIONS.each do |o|
34
- render("<%%#{o}#{body}%>").must_equal("<%#{o}#{body}%>")
35
- end
36
- end
37
- end
38
-
39
- it "renders whitespace surrounding vocal directives correctly" do
40
- o = rand.to_s
41
- i = "<%= #{o} %>"
42
-
43
- WHITESPACE.each_join do |s|
44
- (BLANK + NEWLINES).enumeration do |a, b|
45
- render("a#{a}#{s}#{i}#{b}#{s}b").must_equal("a#{a}#{s}#{o}#{b}#{s}b")
46
- end
47
- end
48
- end
49
-
50
- it "renders whitespace surrounding silent directives correctly" do
51
- i = '<%%>'
52
- o = ''
53
-
54
- SPACES.each_join do |s|
55
- NEWLINES.each do |n|
56
- # without preceding newline
57
- render("a#{s}#{i}#{n}b").must_equal("a#{o}b")
58
-
59
- # with preceding newline
60
- render("a#{n}#{s}#{i}#{n}b").must_equal("a#{n}#{o}b")
61
- end
62
- end
63
- end
64
-
65
- private
66
-
67
- def render input, options = {}
68
- Ember::Template.new(input, options).render
69
- end
70
-
71
- BLANK = [''] # the empty string
72
- NEWLINES = ["\n", "\r\n"]
73
- SPACES = [' ', "\t"]
74
- WHITESPACE = SPACES + NEWLINES
75
- OPERATIONS = [nil, '=', '#', *WHITESPACE]
76
- end
77
-
78
- describe "A program compiled from a template" do
79
- it "has the same number of lines as its input, regardless of template options" do
80
- (BLANK + NEWLINES).each do |s|
81
- test_num_lines s
82
- test_num_lines "hello#{s}world"
83
-
84
- OPERATIONS.each do |o|
85
- test_num_lines "<%#{o}hello#{s}world%>"
86
- end
87
- end
88
- end
89
-
90
- private
91
-
92
- ##
93
- # Checks that the given input template is compiled into the same
94
- # number of lines of Ruby code for all possible template options.
95
- #
96
- def test_num_lines input
97
- num_input_lines = count_lines(input)
98
-
99
- OPTIONS.each_combo do |options|
100
- template = Ember::Template.new(input, options)
101
- program = template.program
102
-
103
- count_lines(program).must_equal num_input_lines, "template program compiled with #{options.inspect} has different number of lines for input #{input.inspect}"
104
- end
105
- end
106
-
107
- ##
108
- # Counts the number of lines in the given string.
109
- #
110
- def count_lines string
111
- string.to_s.scan(/$/).length
112
- end
113
-
114
- OPTIONS = [:shorthand, :infer_end, :unindent]
115
-
116
- ##
117
- # Invokes the given block, passing in an options hash
118
- # for Ember::Template, for every possible combination.
119
- #
120
- def OPTIONS.each_combo
121
- raise ArgumentError unless block_given?
122
-
123
- combinations do |flags|
124
- yield Hash[ *flags.map {|f| [f, true] }.flatten ]
125
- end
126
- end
127
- end
128
-
129
- class Array
130
- ##
131
- # Invokes the given block, passing in the result
132
- # of Array#join, for every possible combination.
133
- #
134
- def each_join
135
- raise ArgumentError unless block_given?
136
-
137
- permutations do |combo|
138
- yield combo.join
139
- end
140
- end
141
- end