gitdoc 4.3.0 → 4.4.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.
data/TODO.md CHANGED
@@ -1,3 +1,11 @@
1
+ # drop a .powrc file
2
+
3
+ that sets requiring rubygems
4
+
5
+ # make build dir
6
+
7
+ gitdoc init should create the build dir with the rackup file
8
+
1
9
  # config.ru for build
2
10
 
3
11
  custom 404
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.3.0
1
+ 4.4.0
data/bin/gitdoc CHANGED
@@ -13,13 +13,14 @@ if File.exists? 'config.ru'
13
13
  end
14
14
 
15
15
  config = <<-END
16
+ require 'bundler/setup' if $LOAD_PATH.grep(/gitdoc$/).empty?
16
17
  require 'gitdoc'
17
18
 
18
19
  GitDoc!
19
20
  END
20
21
 
21
22
  rakefile = <<-END
22
- require 'bundler/setup' unless $LOAD_PATH.last =~ /gitdoc$/
23
+ require 'bundler/setup' if $LOAD_PATH.grep(/gitdoc$/).empty?
23
24
  require 'gitdoc/tasks'
24
25
  END
25
26
 
@@ -28,6 +29,10 @@ source :rubygems
28
29
  gem 'gitdoc', '#{version}'
29
30
  END
30
31
 
32
+ powrc = <<-END
33
+ export RUBYOPT="rubygems"
34
+ END
35
+
31
36
  index = <<-END
32
37
  Welcome to GitDoc
33
38
  END
@@ -35,5 +40,6 @@ END
35
40
  File.open('config.ru','w') { |f| f.write config }
36
41
  File.open('Rakefile','w') { |f| f.write rakefile }
37
42
  File.open('Gemfile','w') { |f| f.write gemfile }
43
+ File.open('.powrc','w') { |f| f.write powrc }
38
44
 
39
- system 'bundle install'
45
+ system 'bundle install'
data/gitdoc.rb CHANGED
@@ -175,8 +175,82 @@ stylus.render str, {paths: ['#{File.dirname file}']}, (err,css) -> sys.puts css
175
175
 
176
176
  end
177
177
 
178
- # If the path doesn't have a file extension and a matching GitDoc document
179
- # exists then it is compiled and rendered
178
+ # Compiles stylus to css
179
+ module Stylus
180
+ extend self
181
+
182
+ # TODO: line number matching, raise errors through the stack
183
+ def compile source, file
184
+ # Requires node and the coffee and stylus npm packages installed
185
+ stylus_compiler = <<-COFFEE
186
+ sys = require 'sys' ; stylus = require 'stylus'
187
+ str = """\n#{source}\n"""
188
+ stylus.render str, {paths: ['#{File.dirname file}']}, (err,css) -> sys.puts css
189
+ COFFEE
190
+ `coffee --eval #{Shellwords.escape stylus_compiler}`.rstrip
191
+ end
192
+ end
193
+
194
+ # TODO: remove the CoffeeScript dependency and just use this
195
+ module GitDoc::CoffeeScript
196
+ extend self
197
+
198
+ # TODO: line number matching, raise errors through the stack
199
+ def compile source, file = nil
200
+ `coffee --print --eval #{Shellwords.escape source}`.rstrip
201
+ end
202
+ end
203
+
204
+ # Compiles an extended coffeescript format into html
205
+ module CoffeePage
206
+ extend self
207
+
208
+ def compile source, file
209
+ source = extract_requires source
210
+ source = extract_stylus source, file
211
+ ['<html>',
212
+ '<head>',
213
+ requires,
214
+ stylus,
215
+ '</head>',
216
+ '<body>',
217
+ '<script>',
218
+ GitDoc::CoffeeScript.compile(source),
219
+ '</script>',
220
+ '</body>'].flatten.join "\n"
221
+ end
222
+
223
+ def extract_requires source
224
+ @requires = []
225
+ source.gsub(/^\#\#\#[ ]*~[ ]*require[ ]*\n(.+?)\#\#\#\n?$/m) do
226
+ $1.split("\n").map(&:strip).each do |path|
227
+ @requires << path unless path.empty?
228
+ end
229
+ ''
230
+ end
231
+ end
232
+
233
+ def extract_stylus source, file
234
+ @stylus = []
235
+ source.gsub(/^\#\#\#[ ]*~[ ]*stylus[ ]*\n(.+?)\#\#\#\n?$/m) do
236
+ @stylus << Stylus.compile($1, file)
237
+ ''
238
+ end
239
+ end
240
+
241
+ def requires
242
+ @requires.map do |path|
243
+ "<script src='#{path}'></script>"
244
+ end.join "\n"
245
+ end
246
+
247
+ def stylus
248
+ ['<style>',@stylus.join("\n"),'</style>'].join("\n") unless @stylus.empty?
249
+ end
250
+
251
+ end
252
+
253
+ # Renders an extended markdown page wrapped in the GitDoc html
180
254
  get '*' do |name|
181
255
  name += 'index' if name =~ /\/$/
182
256
  file = settings.dir + name + '.md'
@@ -185,14 +259,21 @@ get '*' do |name|
185
259
  haml :doc
186
260
  end
187
261
 
188
- # If the path doesn't have a file extension or the extension is .html and a
189
- # matching html file exists then process it with the extended html compiler
262
+ # Renders and extended html page without any additional wrapping
190
263
  get %r{(.*?)(\.html)?$} do |name,extension|
191
264
  file = settings.dir + name + (extension || '.html')
192
265
  pass unless File.exist? file
193
266
  html file
194
267
  end
195
268
 
269
+ # Renders a .cspage as html
270
+ get '*' do |name|
271
+ file = settings.dir + name + '.cspage'
272
+ pass unless File.exist? file
273
+ content_type :html
274
+ CoffeePage.compile File.read(file), file
275
+ end
276
+
196
277
  # GitDoc document styles
197
278
  get '/gitdoc.css' do
198
279
  content_type :css
data/gitdoc/tasks.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  task :dev do
2
- unless $LOAD_PATH.last =~ /gitdoc$/
2
+ unless $LOAD_PATH.grep /gitdoc$/
3
3
  abort "Run rake with the path to GitDocs's source to use dev mode\n"+
4
4
  "Eg. rake -I ~/Projects/gitdoc dev"
5
5
  end
data/pkg/gitdoc-4.3.0.gem CHANGED
Binary file
Binary file
metadata CHANGED
@@ -1,13 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitdoc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
5
- prerelease:
6
- segments:
7
- - 4
8
- - 3
9
- - 0
10
- version: 4.3.0
4
+ version: 4.4.0
11
5
  platform: ruby
12
6
  authors:
13
7
  - Myles Byrne
@@ -15,87 +9,59 @@ autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
11
 
18
- date: 2011-05-01 00:00:00 Z
12
+ date: 2011-06-01 00:00:00 -05:00
13
+ default_executable:
19
14
  dependencies:
20
15
  - !ruby/object:Gem::Dependency
21
16
  name: rdiscount
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
25
20
  requirements:
26
21
  - - ~>
27
22
  - !ruby/object:Gem::Version
28
- hash: 19
29
- segments:
30
- - 1
31
- - 5
32
- - 8
33
23
  version: 1.5.8
34
- type: :runtime
35
- version_requirements: *id001
24
+ version:
36
25
  - !ruby/object:Gem::Dependency
37
26
  name: haml
38
- prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
40
- none: false
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
41
30
  requirements:
42
31
  - - ~>
43
32
  - !ruby/object:Gem::Version
44
- hash: 53
45
- segments:
46
- - 3
47
- - 0
48
- - 25
49
33
  version: 3.0.25
50
- type: :runtime
51
- version_requirements: *id002
34
+ version:
52
35
  - !ruby/object:Gem::Dependency
53
36
  name: sinatra
54
- prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
56
- none: false
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
57
40
  requirements:
58
41
  - - ~>
59
42
  - !ruby/object:Gem::Version
60
- hash: 15
61
- segments:
62
- - 1
63
- - 0
64
43
  version: "1.0"
65
- type: :runtime
66
- version_requirements: *id003
44
+ version:
67
45
  - !ruby/object:Gem::Dependency
68
46
  name: coffee-script
69
- prerelease: false
70
- requirement: &id004 !ruby/object:Gem::Requirement
71
- none: false
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
72
50
  requirements:
73
51
  - - ~>
74
52
  - !ruby/object:Gem::Version
75
- hash: 9
76
- segments:
77
- - 2
78
- - 1
79
- - 1
80
53
  version: 2.1.1
81
- type: :runtime
82
- version_requirements: *id004
54
+ version:
83
55
  - !ruby/object:Gem::Dependency
84
56
  name: json
85
- prerelease: false
86
- requirement: &id005 !ruby/object:Gem::Requirement
87
- none: false
57
+ type: :runtime
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
88
60
  requirements:
89
61
  - - ~>
90
62
  - !ruby/object:Gem::Version
91
- hash: 11
92
- segments:
93
- - 1
94
- - 4
95
- - 6
96
63
  version: 1.4.6
97
- type: :runtime
98
- version_requirements: *id005
64
+ version:
99
65
  description:
100
66
  email: myles@myles.id.au
101
67
  executables: []
@@ -117,11 +83,13 @@ files:
117
83
  - pkg/gitdoc-4.1.0.gem
118
84
  - pkg/gitdoc-4.2.0.gem
119
85
  - pkg/gitdoc-4.3.0.gem
86
+ - pkg/gitdoc-4.4.0.gem
120
87
  - Rakefile
121
88
  - README.md
122
89
  - reset.sass
123
90
  - TODO.md
124
91
  - VERSION
92
+ has_rdoc: true
125
93
  homepage: http://github.com/quackingduck/gitdoc
126
94
  licenses: []
127
95
 
@@ -131,27 +99,21 @@ rdoc_options: []
131
99
  require_paths:
132
100
  - .
133
101
  required_ruby_version: !ruby/object:Gem::Requirement
134
- none: false
135
102
  requirements:
136
103
  - - ">="
137
104
  - !ruby/object:Gem::Version
138
- hash: 3
139
- segments:
140
- - 0
141
105
  version: "0"
106
+ version:
142
107
  required_rubygems_version: !ruby/object:Gem::Requirement
143
- none: false
144
108
  requirements:
145
109
  - - ">="
146
110
  - !ruby/object:Gem::Version
147
- hash: 3
148
- segments:
149
- - 0
150
111
  version: "0"
112
+ version:
151
113
  requirements: []
152
114
 
153
115
  rubyforge_project:
154
- rubygems_version: 1.7.2
116
+ rubygems_version: 1.3.5
155
117
  signing_key:
156
118
  specification_version: 3
157
119
  summary: A light-weight web app for serving up a folder of markdown files