erbside 0.2.1 → 0.3.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 (46) hide show
  1. data/.ruby +28 -31
  2. data/HISTORY.rdoc +12 -0
  3. data/QED.rdoc +353 -0
  4. data/README.rdoc +8 -4
  5. data/lib/erbside.yml +28 -31
  6. data/lib/erbside/metadata.rb +2 -4
  7. data/qed/00_intro.rdoc +1 -0
  8. metadata +67 -105
  9. data/.gemspec +0 -152
  10. data/.gitignore +0 -8
  11. data/MANIFEST +0 -34
  12. data/PROFILE +0 -33
  13. data/VERSION +0 -1
  14. data/main.assembly +0 -57
  15. data/site/.htaccess +0 -2
  16. data/site/.rsync-filter +0 -7
  17. data/site/assets/css/highlight.css +0 -96
  18. data/site/assets/css/reset.css +0 -19
  19. data/site/assets/css/site.css +0 -52
  20. data/site/assets/img/curb.jpg +0 -0
  21. data/site/assets/img/emeraled.png +0 -0
  22. data/site/assets/img/fade.png +0 -0
  23. data/site/assets/img/fork-me.png +0 -0
  24. data/site/assets/img/icon.jpg +0 -0
  25. data/site/assets/js/highlight.js +0 -1
  26. data/site/assets/js/jquery.js +0 -19
  27. data/site/assets/js/jquery.tabs.js +0 -1
  28. data/site/index.html +0 -229
  29. data/work/defunct/css/color.css +0 -45
  30. data/work/defunct/css/font.css +0 -39
  31. data/work/defunct/css/struct.css +0 -51
  32. data/work/defunct/inline-old/bash.rb +0 -36
  33. data/work/defunct/inline-old/cpp.rb +0 -39
  34. data/work/defunct/inline-old/css.rb +0 -32
  35. data/work/defunct/inline-old/html.rb +0 -32
  36. data/work/defunct/inline-old/js.rb +0 -85
  37. data/work/defunct/inline-old/ruby.rb +0 -147
  38. data/work/defunct/inline-old/type.rb +0 -91
  39. data/work/defunct/inline.rb +0 -202
  40. data/work/defunct/plan.rb +0 -37
  41. data/work/defunct/tiller.rb +0 -200
  42. data/work/defunct/webme/options.yml +0 -4
  43. data/work/defunct/whole.rb +0 -221
  44. data/work/plugins/syckle/erbside.rb +0 -45
  45. data/work/radio_earth.jpg +0 -0
  46. data/yard.watchr +0 -12
@@ -1,4 +0,0 @@
1
- ---
2
- colors:
3
- back: green
4
-
@@ -1,221 +0,0 @@
1
- module Till
2
-
3
- # = Whole Template
4
- #
5
- class Whole
6
-
7
- # R E Q U I R E M E N T S
8
-
9
- # TODO: Load engines only if used?
10
-
11
- begin ; require 'rubygems' ; rescue LoadError ; end # why?
12
- begin ; require 'erb' ; rescue LoadError ; end
13
- begin ; require 'redcloth' ; rescue LoadError ; end
14
- begin ; require 'bluecloth' ; rescue LoadError ; end
15
- begin ; require 'rdiscount' ; rescue LoadError ; end
16
-
17
- begin
18
- require 'liquid'
19
- #Liquid::Template.register_filter(TemplateFilters)
20
- rescue LoadError
21
- end
22
-
23
- begin
24
- require 'haml'
25
- #Haml::Template.options[:format] = :html5
26
- rescue LoadError
27
- end
28
-
29
- begin
30
- require 'rdoc/markup/simple_markup'
31
- require 'rdoc/markup/simple_markup/to_html'
32
- rescue LoadError
33
- end
34
-
35
- require 'tilt'
36
-
37
- require 'till/context'
38
-
39
-
40
- # A T T R I B U T E S
41
-
42
- # File pathname of the template file.
43
- attr :file
44
-
45
- # Directory location of the template +file+.
46
- attr :location
47
-
48
- # Format of the template (in terms of extension names).
49
- attr :format
50
-
51
- # Where to save the rendered result (defaults to +file+ w/o it's extension).
52
- # This is also often referred to as the *target*.
53
- attr :output
54
-
55
- # List of redering filters to processes file through (defaults to +extension+ plus +erb+).
56
- attr :filters
57
-
58
- # Stores the rendered result, after #render is called.
59
- attr :result
60
-
61
- # Body of file.
62
- attr :content
63
-
64
- # Context/scope of template rendering.
65
- attr :context
66
-
67
-
68
- # I N I T I A L I Z E
69
-
70
- #
71
- def initialize(file)
72
- @file = file
73
-
74
- case ext = File.extname(file)
75
- when '.till', '.til'
76
- fname = file.chomp(ext)
77
- else
78
- fname = file
79
- end
80
-
81
- #@format = File.extname(fname)
82
- @location = File.dirname(File.expand_path(file))
83
-
84
- text = File.read(file).rstrip
85
-
86
- # front matter indicator
87
- if text =~ /\A---/
88
- text = text.sub(/---.*?\n/, '')
89
- meta, body = *text.split(/^---/)
90
- else
91
- meta = nil
92
- body = text
93
- end
94
-
95
- @content = body
96
-
97
- fm = meta ? YAML.load(meta) : {}
98
-
99
- self.filters = fm['filter'] || ['erb']
100
-
101
- self.format = fm['format'] || File.extname(fname)
102
-
103
- if fm['output']
104
- self.output = fm['output']
105
- else
106
- self.output = fname #.chomp(extension) #+ DEFAULT_CONVERSIONS[filters.last]
107
- end
108
-
109
-
110
-
111
- #@context = Context.new(@location) # prime context/scope
112
- end
113
-
114
- #
115
-
116
- def output=(path)
117
- if path[0,1] == '/'
118
- path = File.join(root, path[1..-1])
119
- else
120
- path = File.join(location, path)
121
- end
122
- @output = File.expand_path(path)
123
- end
124
-
125
- #
126
-
127
- def format=(ext)
128
- ext = ext.to_s
129
- ext = (ext[0,1] == '.' ? ext : ".#{ext}")
130
- case ext
131
- when '.md'
132
- ext = '.markdown'
133
- when '.tt'
134
- ext = '.textile'
135
- end
136
- @format = ext
137
- end
138
-
139
- #
140
-
141
- def filters=(list)
142
- @filters = [list].flatten.compact.map{ |f| f.sub(/^\./,'') }
143
- end
144
-
145
- #
146
-
147
- def relative_output(dir=nil)
148
- dir = dir || Dir.pwd
149
- output.sub(dir+'/', '')
150
- end
151
-
152
- # Does the output file exist?
153
-
154
- def exist?
155
- File.exist?(output)
156
- end
157
-
158
- #
159
-
160
- def context
161
- @context ||= Context.new(location)
162
- end
163
-
164
- # TODO: maybe bring root discovery up a level or two ?
165
-
166
- def root
167
- context.metadata.root
168
- end
169
-
170
- # Render a whole template.
171
-
172
- def render
173
- context = Context.new(location) # prime context/scope
174
- result = content
175
-
176
- filters.each do |filter|
177
- if filter == 'html' # TODO: +next+ if html format and html filter ?
178
- engine = Tilt[format]
179
- else
180
- engine = Tilt[filter]
181
- end
182
- raise "unknown filter #{filter}" unless engine
183
- result = Dir.chdir(location) do
184
- engine.new{result}.render(context)
185
- end
186
- end
187
- @result = result
188
- end
189
-
190
- # Is the current rendering different then the output file's content?
191
- # This will call #render if it hasn't been called yet.
192
-
193
- def changed?
194
- render unless result
195
- if exist?
196
- File.read(output) != result
197
- else
198
- true
199
- end
200
- end
201
-
202
- # Save the rendering to the output file.
203
- # This will call #render if it hasn't been called yet.
204
-
205
- def save
206
- render unless result
207
- if File.exist?(output)
208
- mode = File.stat(output).mode
209
- File.chmod(mode | 0000220, output)
210
- File.open(output, 'w'){ |f| f << result }
211
- File.chmod(mode, output)
212
- else
213
- File.open(output, 'w'){ |f| f << result }
214
- File.chmod(0440, output) # change to read-only mode
215
- end
216
- end
217
-
218
- end
219
-
220
- end
221
-
@@ -1,45 +0,0 @@
1
- module Syckle::Plugins
2
-
3
- # = Erbside Generation
4
- #
5
- class Erbside < Service
6
-
7
- cycle :main, :generate
8
- cycle :site, :generate
9
-
10
- # Make automatic?
11
- #autorun do
12
- # ...
13
- #end
14
-
15
- available do |project|
16
- begin
17
- require 'erbside'
18
- true
19
- rescue LoadError
20
- false
21
- end
22
- end
23
-
24
- #
25
- #def safe?; @safe; end
26
-
27
- #
28
- def generate(options={})
29
- options ||= {}
30
-
31
- dir = nil # defaults to curent directory
32
-
33
- options[:trial] = trial?
34
- options[:debug] = debug?
35
- options[:quiet] = quiet?
36
- options[:force] = force?
37
-
38
- tiller = Erbside::Runner.new(dir, options)
39
- tiller.till
40
- end
41
-
42
- end
43
-
44
- end
45
-
Binary file
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- watch /qed\/.*?\.rdoc/ do
4
- File.open('DEMOS.rdoc', 'w') do |f|
5
- f << "= <i>DEMONSTRATIONS</i>\n\n"
6
- Dir['qed/*.rdoc'].sort.each do |qed_file|
7
- f << File.read(qed_file)
8
- f << "\n\n"
9
- end
10
- end
11
- end
12
-