Skip to content
This repository has been archived by the owner on Oct 10, 2017. It is now read-only.

Updated docs #69

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
47 changes: 35 additions & 12 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,27 @@ end

def build
system "middleman build"

Dir.chdir "build" do
system "cp ../config.ru ."
system "cp ../Procfile ."
end
end

def generate_marionette_docs
# output_path = 'api.yml'
repo_path = marionette_path
site_path = current_path
current_tag = ""
select_box = "<select id=\"version\" class=\"form-control\">"
tags = Array.new
print "Generating docs data from #{repo_path}... "

Dir.chdir(repo_path) do
system("git checkout master")
describe = `git describe --tags --always`.strip
current_tag = describe.gsub("\n", "")

# get list of tags in marionette repo
describe = `git tag`.strip
tags = describe.split("\n")
Expand All @@ -53,11 +63,17 @@ def generate_marionette_docs
newfilename = File.basename(filename, ".*" )
FileUtils.cp(filename, "#{site_path}/source/docs/#{tag}/#{newfilename}.md")
end

if tag == current_tag
select_box += "<option value=\"#{tag}\">#{tag} (current)</option>"
else
select_box += "<option value=\"#{tag}\">#{tag}</option>"
end
end

# checkout last tag
describe = `git describe --tags --always`.strip
current_tag = describe.gsub("\n", "")
select_box += "</select>"

# checkout latest tag
system("git checkout tags/#{current_tag}")
FileUtils.mkdir_p("#{site_path}/source/docs/current")
filenames = Dir.glob('docs/*.md')
Expand All @@ -76,6 +92,8 @@ def generate_marionette_docs

system("node ../../doc-assets/build.js");
system("rm *.md");
text = File.read('sidebar_.html')
File.write('sidebar_.html', text.gsub('{select_box}', select_box))

end
end
Expand All @@ -85,15 +103,18 @@ def generate_marionette_docs

system("node ../../doc-assets/build.js");
system("rm *.md");
text = File.read('sidebar_.html')
File.write('sidebar_.html', text.gsub('{select_box}', select_box))

end

print "Generating annotated src data from #{repo_path}... "
FileUtils.mkdir_p("#{site_path}/backbone.marionette/#{current_tag}")
system("curl https://raw.githubusercontent.com/marionettejs/backbone.marionette/#{current_tag}/lib/backbone.marionette.js > backbone.marionette/#{current_tag}/backbone.marionette.js")
system("./node_modules/.bin/docco backbone.marionette/#{current_tag}/backbone.marionette.js -o source/annotated-src/")
system("rm -rdf backbone.marionette");
puts "Built #{repo_path}"
# print "Generating annotated src data from #{repo_path}... "
# FileUtils.mkdir_p("#{site_path}/backbone.marionette/#{current_tag}")
# system("curl https://raw.githubusercontent.com/marionettejs/backbone.marionette/#{current_tag}/lib/backbone.marionette.js > backbone.marionette/#{current_tag}/backbone.marionette.js")
# system("./node_modules/.bin/docco backbone.marionette/#{current_tag}/backbone.marionette.js -o source/annotated-src/#{current_tag}/")
# system("./node_modules/.bin/docco backbone.marionette/#{current_tag}/backbone.marionette.js -o source/annotated-src/")
# system("rm -rdf backbone.marionette");
# puts "Built #{repo_path}"
end

def get_anotated_source
Expand Down Expand Up @@ -132,6 +153,10 @@ task :backfill_anotated_source do
get_anotated_source
end

task :build do
build
end

desc "Build and deploy the website to github pages"
task :deploy do
require "highline/import"
Expand All @@ -146,11 +171,9 @@ task :deploy do
build

Dir.chdir "build" do
system "cp ../config.ru ."
system "cp ../Procfile ."
system "git add -A"
system "git commit -m '#{message.gsub("'", "\\'")}'"
system "git push --force heroku master"
end

end
end
1 change: 1 addition & 0 deletions config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ require 'rack/rewrite'
use Rack::Rewrite do
r301 '/docs/backbone.marionette.html', '/annotated-src/backbone.marionette'
rewrite %r{/docs/marionette.(\w+).html}, '/docs/current/marionette.$1.html'
rewrite %r{/docs/index.html}, '/docs/current/index.html'
rewrite %r{/docs/sidebar_.html}, '/docs/current/sidebar_.html'
rewrite %r{/docs/assets_/(.*)}, '/docs/current/assets_/$1'
end
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "marionette-www",
"dependencies": {
"mdoc": "~0.3.4",
"mdoc": "git://github.com/ahumphreys87/mdoc.git#v0.4.0",
"docco": "~0.6.3"
}
}
8 changes: 5 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ Update the site

Make your changes to the site in the source/ folder.

middleman server
rake build
cd build
rackup config.ru -p 2000

Preview your changes in browser by pointing to http://localhost:4567
Preview your changes in browser by pointing to http://localhost:2000


Populate a new version of Marionette.js builds
Expand All @@ -32,4 +34,4 @@ Push your changes to Heroku
-----

Login to heroku CLI Tools
`git push heroku {branchName}:master`
`rake deploy`
2 changes: 2 additions & 0 deletions source/doc-assets/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ mdoc.run({

templatePath : __dirname + '/custom_template',

indexContent: '<h1>Backbone.Marionette Documentation.</h1><p>Please use the links in the sidebar or below to find what you are looking for.</p>',

//by default it will look at an `assets_` folder inside the `templatePath`
assetsPath : __dirname + '/custom_assets',

Expand Down
Loading