gitdoc 3.13.0 → 4.0.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 (6) hide show
  1. data/Rakefile +4 -0
  2. data/VERSION +1 -1
  3. data/doc.haml +3 -3
  4. data/gitdoc.rb +16 -23
  5. data/pkg/gitdoc-3.13.0.gem +0 -0
  6. metadata +6 -5
data/Rakefile CHANGED
@@ -11,3 +11,7 @@ end
11
11
  task :tag do
12
12
  sh "git tag -a v`cat VERSION` `git rev-parse HEAD` -m ''"
13
13
  end
14
+
15
+ task :release do
16
+ sh "gem push #{gemfile}"
17
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.13.0
1
+ 4.0.0
data/doc.haml CHANGED
@@ -1,9 +1,9 @@
1
1
  !!!
2
2
  %head
3
- %title= settings.title || 'Documents'
3
+ %title= title
4
4
  %meta{:charset => "utf-8"}
5
- %link{:rel => :stylesheet, :href => '/.css'}
6
- = settings.header
5
+ %link{:rel => :stylesheet, :href => '/gitdoc.css'}
6
+ = header
7
7
 
8
8
  - if custom_body?
9
9
  = custom_body
data/gitdoc.rb CHANGED
@@ -5,26 +5,23 @@ require 'sass'
5
5
 
6
6
  ## The Public Interface
7
7
  #
8
- # To run gitdoc in a directory create a rackup file like this:
8
+ # A rackup file with just these two lines:
9
9
  #
10
10
  # require 'gitdoc'
11
11
  # GitDoc!
12
12
  #
13
- # Boom. There are also some optional arguments:
13
+ # is all thats required to serve up the directory.
14
+ #
15
+ # GitDoc is a Sinatra app so you can customize it like one:
14
16
  #
15
17
  # require 'gitdoc'
16
- # GitDoc! "Title to use",
17
- # :header => '<!-- this will appear before the </head> tag -->'
18
- # # This turns off GitDoc's default css, you still get reset and code
19
- # # highligting styles
20
- # :default_styles => false
18
+ # GitDoc.set :title, "My Documents"
19
+ # GitDoc.disable :default_styles
20
+ # GitDoc!
21
21
 
22
- def GitDoc! title = nil, opts = {}
22
+ def GitDoc!
23
23
  dir = File.dirname(File.expand_path(caller.first.split(':').first))
24
24
  set :dir, dir
25
- set :title, title
26
- set :header, opts[:header]
27
- set :default_styles, opts[:default_styles] != false
28
25
  run Sinatra::Application
29
26
  end
30
27
 
@@ -166,20 +163,24 @@ stylus.render str, {paths: ['#{File.dirname file}']}, (err,css) -> sys.puts css
166
163
  haml File.read(settings.dir + '/body.haml')
167
164
  end
168
165
 
166
+ def title
167
+ settings.title || 'Documents'
168
+ end
169
+
169
170
  end
170
171
 
171
172
  # If the path doesn't have a file extension and a matching GitDoc document
172
173
  # exists then it is compiled and rendered
173
174
  get '*' do |name|
174
175
  name += 'index' if name =~ /\/$/
175
- file = File.join(settings.dir + '/' + name + '.md')
176
- pass unless File.exist? file
177
- @doc = gd File.read(file)
176
+ @file = File.join(settings.dir + '/' + name + '.md')
177
+ pass unless File.exist? @file
178
+ @doc = gd File.read(@file)
178
179
  haml :doc
179
180
  end
180
181
 
181
182
  # GitDoc document styles
182
- get '/.css' do
183
+ get '/gitdoc.css' do
183
184
  content_type :css
184
185
  styles = sass(:reset)
185
186
  styles += File.read(settings.root + '/highlight.css')
@@ -204,14 +205,6 @@ get '*.html' do |name|
204
205
  html file
205
206
  end
206
207
 
207
- # Deprecated
208
- get '*._plain' do |name|
209
- file = settings.dir + '/' + name
210
- pass unless File.exist? file
211
- content_type :text
212
- File.read(file)
213
- end
214
-
215
208
  get '*.txt' do |name|
216
209
  file = settings.dir + '/' + name
217
210
  pass unless File.exist? file
Binary file
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitdoc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
4
+ hash: 63
5
5
  prerelease: false
6
6
  segments:
7
- - 3
8
- - 13
7
+ - 4
9
8
  - 0
10
- version: 3.13.0
9
+ - 0
10
+ version: 4.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Myles Byrne
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-07 00:00:00 +10:00
18
+ date: 2011-04-08 00:00:00 +10:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -149,6 +149,7 @@ files:
149
149
  - pkg/gitdoc-3.11.0.gem
150
150
  - pkg/gitdoc-3.11.1.gem
151
151
  - pkg/gitdoc-3.12.0.gem
152
+ - pkg/gitdoc-3.13.0.gem
152
153
  - Rakefile
153
154
  - README.md
154
155
  - reset.sass