Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nginx-push-stream-module
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
nginx-push-stream-module
Commits
0ec88e79
Commit
0ec88e79
authored
Oct 22, 2014
by
Wandenberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add task to watch for changes on textile files and automatically generate the preview
parent
24ec447d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
16 deletions
+35
-16
Gemfile
misc/Gemfile
+1
-0
Gemfile.lock
misc/Gemfile.lock
+4
-0
Rakefile
misc/Rakefile
+30
-16
No files found.
misc/Gemfile
View file @
0ec88e79
...
@@ -23,4 +23,5 @@ group :docs do
...
@@ -23,4 +23,5 @@ group :docs do
gem
'github-markup'
,
'~> 0.7.5'
,
:require
=>
'github/markup'
gem
'github-markup'
,
'~> 0.7.5'
,
:require
=>
'github/markup'
gem
'RedCloth'
,
'~> 4.2.9'
gem
'RedCloth'
,
'~> 4.2.9'
gem
'nokogiri'
,
'~> 1.5.6'
gem
'nokogiri'
,
'~> 1.5.6'
gem
'filewatcher'
end
end
misc/Gemfile.lock
View file @
0ec88e79
...
@@ -25,6 +25,8 @@ GEM
...
@@ -25,6 +25,8 @@ GEM
eventmachine (1.0.3)
eventmachine (1.0.3)
execjs (2.0.2)
execjs (2.0.2)
ffi (1.9.6)
ffi (1.9.6)
filewatcher (0.3.4)
trollop (~> 2.0)
github-markup (0.7.5)
github-markup (0.7.5)
http_parser.rb (0.6.0)
http_parser.rb (0.6.0)
jasmine (1.3.2)
jasmine (1.3.2)
...
@@ -76,6 +78,7 @@ GEM
...
@@ -76,6 +78,7 @@ GEM
daemons (>= 1.0.9)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
rack (>= 1.0.0)
trollop (2.0)
websocket (1.0.7)
websocket (1.0.7)
PLATFORMS
PLATFORMS
...
@@ -85,6 +88,7 @@ DEPENDENCIES
...
@@ -85,6 +88,7 @@ DEPENDENCIES
RedCloth (~> 4.2.9)
RedCloth (~> 4.2.9)
byebug (~> 1.3.1)
byebug (~> 1.3.1)
em-http-request (~> 1.0.3)
em-http-request (~> 1.0.3)
filewatcher
github-markup (~> 0.7.5)
github-markup (~> 0.7.5)
jasmine (~> 1.3.1)
jasmine (~> 1.3.1)
jshintrb (~> 0.2.1)
jshintrb (~> 0.2.1)
...
...
misc/Rakefile
View file @
0ec88e79
project_dir
=
File
.
expand_path
(
'..'
,
File
.
dirname
(
__FILE__
))
javascript_dir
=
File
.
expand_path
(
Dir
[
"
#{
project_dir
}
/**/js"
].
first
)
require
'rubygems'
require
'rubygems'
require
'erb'
# Set up gems listed in the Gemfile.
# Set up gems listed in the Gemfile.
ENV
[
'BUNDLE_GEMFILE'
]
||=
File
.
expand_path
(
'./Gemfile'
,
File
.
dirname
(
__FILE__
))
ENV
[
'BUNDLE_GEMFILE'
]
||=
File
.
expand_path
(
'./Gemfile'
,
File
.
dirname
(
__FILE__
))
require
'bundler/setup'
if
File
.
exists?
(
ENV
[
'BUNDLE_GEMFILE'
])
require
'bundler/setup'
if
File
.
exists?
(
ENV
[
'BUNDLE_GEMFILE'
])
Bundler
.
require
(
:default
,
:test
)
if
defined?
(
Bundler
)
Bundler
.
require
(
:default
,
:test
)
if
defined?
(
Bundler
)
project_dir
=
File
.
expand_path
(
'..'
,
File
.
dirname
(
__FILE__
))
base_path
=
File
.
expand_path
(
'pushstream/docs/preview'
,
Dir
.
tmpdir
)
javascript_dir
=
File
.
expand_path
(
Dir
[
"
#{
project_dir
}
/**/js"
].
first
)
begin
begin
require
"rspec/core/rake_task"
require
"rspec/core/rake_task"
...
@@ -88,29 +90,41 @@ begin
...
@@ -88,29 +90,41 @@ begin
Bundler
.
require
(
:default
,
:docs
)
if
defined?
(
Bundler
)
Bundler
.
require
(
:default
,
:docs
)
if
defined?
(
Bundler
)
task
:get_static_files
do
task
:get_static_files
do
base_path
=
File
.
expand_path
(
'pushstream/docs/preview'
,
Dir
.
tmpdir
)
FileUtils
.
mkdir_p
(
"
#{
base_path
}
/css"
)
FileUtils
.
mkdir_p
(
"
#{
base_path
}
/css"
)
download_file
(
"https://github.global.ssl.fastly.net/assets/github-f226abc7983f8566b17d24236adae64ba647ffea.css"
,
"
#{
base_path
}
/css/github.css"
)
unless
File
.
exists?
(
"
#{
base_path
}
/css/github.css"
)
download_file
(
"https://github.global.ssl.fastly.net/assets/github-f226abc7983f8566b17d24236adae64ba647ffea.css"
,
"
#{
base_path
}
/css/github.css"
)
unless
File
.
exists?
(
"
#{
base_path
}
/css/github.css"
)
download_file
(
"https://github.global.ssl.fastly.net/assets/github2-6edea06c20f02c9c2ae32842c7455d50c08c3f69.css"
,
"
#{
base_path
}
/css/github2.css"
)
unless
File
.
exists?
(
"
#{
base_path
}
/css/github2.css"
)
download_file
(
"https://github.global.ssl.fastly.net/assets/github2-6edea06c20f02c9c2ae32842c7455d50c08c3f69.css"
,
"
#{
base_path
}
/css/github2.css"
)
unless
File
.
exists?
(
"
#{
base_path
}
/css/github2.css"
)
end
end
desc
"Generates docs files to preview."
def
generate_preview_for
(
file
,
project_dir
,
base_path
)
task
:generate
=>
:get_static_files
do
require
'erb'
template
=
ERB
.
new
File
.
read
(
"
#{
project_dir
}
/misc/github_template.html.erb"
)
template
=
ERB
.
new
File
.
read
(
"
#{
project_dir
}
/misc/github_template.html.erb"
)
base_path
=
File
.
expand_path
(
'pushstream/docs/preview'
,
Dir
.
tmpdir
)
Dir
.
glob
(
"
#{
project_dir
}
/**/*.textile"
).
each
do
|
file
|
filename
=
File
.
basename
(
file
)
filename
=
File
.
basename
(
file
)
content
=
GitHub
::
Markup
.
render
(
file
,
File
.
read
(
file
))
content
=
GitHub
::
Markup
.
render
(
file
,
File
.
read
(
file
))
rendered
=
template
.
result
(
binding
)
rendered
=
template
.
result
(
binding
)
output
=
file
.
gsub
(
project_dir
,
File
.
expand_path
(
'pushstream/docs/preview'
,
Dir
.
tmpdir
)
)
output
=
File
.
expand_path
(
file
.
gsub
(
project_dir
,
"./"
),
base_path
)
output_dir
=
File
.
dirname
(
output
)
output_dir
=
File
.
dirname
(
output
)
FileUtils
.
mkdir_p
(
output_dir
)
FileUtils
.
mkdir_p
(
output_dir
)
File
.
open
(
output
,
'w'
)
{
|
f
|
f
.
write
(
rendered
)
}
File
.
open
(
output
,
'w'
)
{
|
f
|
f
.
write
(
rendered
)
}
puts
"Preview rendered to
#{
output
}
"
puts
"Preview rendered to
#{
output
}
"
end
end
desc
"Generates docs files to preview."
task
:generate
=>
:get_static_files
do
Dir
.
glob
(
"
#{
project_dir
}
/**/*.textile"
).
each
do
|
file
|
generate_preview_for
(
file
,
project_dir
,
base_path
)
end
end
desc
"Watch for changes on doc to generate the preview."
task
:watch
do
puts
"watching for changes on textile files"
Dir
.
chdir
(
project_dir
)
do
FileWatcher
.
new
([
"*.textile"
]).
watch
do
|
file
,
event
|
if
(
event
!=
:delete
)
generate_preview_for
(
file
,
project_dir
,
base_path
)
end
end
end
end
end
desc
"Convert docs to Nginx wiki format."
desc
"Convert docs to Nginx wiki format."
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment