gitdoc 3.8.0 → 3.10.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 (5) hide show
  1. data/Rakefile +1 -0
  2. data/VERSION +1 -1
  3. data/gitdoc/tasks.rb +14 -2
  4. data/gitdoc.rb +8 -9
  5. metadata +19 -4
data/Rakefile CHANGED
@@ -13,6 +13,7 @@ begin
13
13
  gs.add_dependency('unicorn','~>3.1.0')
14
14
  gs.add_dependency('coffee-script', '~>2.1.1')
15
15
  gs.add_dependency('json','~>1.4.6') # dependency of coffee-script
16
+ gs.add_dependency('livereload', '~>1.5')
16
17
  end
17
18
  Jeweler::GemcutterTasks.new
18
19
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.8.0
1
+ 3.10.0
data/gitdoc/tasks.rb CHANGED
@@ -1,5 +1,11 @@
1
1
  task :server do
2
- exec 'unicorn'
2
+ livereload = fork { exec "livereload" }
3
+ server = fork { exec 'unicorn' }
4
+ trap('INT') do
5
+ Process.kill('QUIT', server)
6
+ Process.kill('QUIT', livereload)
7
+ end
8
+ Process.waitall
3
9
  end
4
10
 
5
11
  task :default => :server
@@ -9,5 +15,11 @@ task :dev do
9
15
  abort "Run rake with the path to GitDocs's source to use dev mode\n"+
10
16
  "Eg. rake -I ~/Projects/gitdoc dev"
11
17
  end
12
- exec "shotgun -I #{$LOAD_PATH.last}"
18
+ livereload = fork { exec "livereload" }
19
+ server = fork { exec "shotgun -I #{$LOAD_PATH.last}" }
20
+ trap('INT') do
21
+ Process.kill('QUIT', server)
22
+ Process.kill('QUIT', livereload)
23
+ end
24
+ Process.waitall
13
25
  end
data/gitdoc.rb CHANGED
@@ -102,10 +102,10 @@ helpers do
102
102
 
103
103
  ### HTML Extensions
104
104
 
105
- def html html
106
- html = compile_sass_tags html
105
+ def html filename
106
+ html = compile_sass_tags File.read(filename)
107
107
  html = compile_scss_tags html
108
- compile_stylus_tags html
108
+ compile_stylus_tags html, filename
109
109
  end
110
110
 
111
111
  def compile_scss_tags source
@@ -120,20 +120,20 @@ helpers do
120
120
  end
121
121
  end
122
122
 
123
- def compile_stylus_tags source
123
+ def compile_stylus_tags source, filename
124
124
  source.gsub(/^<style type=['"]?text\/stylus['"]?>\r?\n(.+?)<\/style>?$/m) do |match|
125
- "<style type='text/css'>\n#{stylus $1}</style>"
125
+ "<style type='text/css'>\n#{stylus $1, filename}</style>"
126
126
  end
127
127
  end
128
128
 
129
129
  require 'shellwords'
130
130
 
131
131
  # Hacked in. Requires node and the coffee and stylus npm packages installed
132
- def stylus src
132
+ def stylus src, file
133
133
  stylus_compiler = <<-COFFEE
134
134
  sys = require 'sys' ; stylus = require 'stylus'
135
135
  str = """\n#{src}\n"""
136
- stylus.render str, {}, (err,css) -> sys.puts css
136
+ stylus.render str, {paths: ['#{File.dirname file}']}, (err,css) -> sys.puts css
137
137
  COFFEE
138
138
  `coffee --eval #{Shellwords.escape stylus_compiler}`.chomp
139
139
  end
@@ -173,14 +173,13 @@ end
173
173
  get '*.html' do |name|
174
174
  file = settings.dir + '/' + name + '.html'
175
175
  pass unless File.exist? file
176
- html File.read(file)
176
+ html file
177
177
  end
178
178
 
179
179
  get '*._plain' do |name|
180
180
  file = settings.dir + '/' + name
181
181
  pass unless File.exist? file
182
182
  content_type :text
183
- # html File.read(file)
184
183
  File.read(file)
185
184
  end
186
185
 
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: 39
4
+ hash: 47
5
5
  prerelease: false
6
6
  segments:
7
7
  - 3
8
- - 8
8
+ - 10
9
9
  - 0
10
- version: 3.8.0
10
+ version: 3.10.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-02-25 00:00:00 +11:00
18
+ date: 2011-02-28 00:00:00 +11:00
19
19
  default_executable: gitdoc
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -113,6 +113,21 @@ dependencies:
113
113
  version: 1.4.6
114
114
  type: :runtime
115
115
  version_requirements: *id006
116
+ - !ruby/object:Gem::Dependency
117
+ name: livereload
118
+ prerelease: false
119
+ requirement: &id007 !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ hash: 5
125
+ segments:
126
+ - 1
127
+ - 5
128
+ version: "1.5"
129
+ type: :runtime
130
+ version_requirements: *id007
116
131
  description:
117
132
  email: myles@myles.id.au
118
133
  executables: