-
Notifications
You must be signed in to change notification settings - Fork 18
/
Rakefile
78 lines (60 loc) · 1.59 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
require 'middleman-gh-pages'
require "bundler/setup"
require 'yaml'
def git_initialize(repository)
unless File.exist?(".git")
system "git init"
system "git remote add origin https://github.com/emberjs/#{repository}.git"
end
end
def git_update
system "git fetch origin"
system "git reset --hard origin/master"
# Remove all files so we don't accidentally keep old stuff
# These will be regenerated by the build process
system "rm `git ls-files`"
end
def aura_path
File.expand_path(ENV['EMBER_PATH'] || File.expand_path("../../aura", __FILE__))
end
def generate_docs
print "Generating docs data from #{aura_path}... "
sha = nil
Dir.chdir(aura_path) do
# returns either `tag` or `tag-numcommits-gSHA`
describe = `git describe --tags --always`.strip
sha = describe =~ /-g(.+)/ ? $1 : describe
system("grunt yuidoc")
end
# JSON is valid YAML
data = YAML.load_file(File.join(aura_path, "docs/data.json"))
data["project"]["sha"] = sha
File.open(File.expand_path("../data/api.yml", __FILE__), "w") do |f|
YAML.dump(data, f)
end
puts "Built #{sha}"
end
# def build
# system "middleman build"
# end
task :aura_path do
puts aura_path
end
# desc "Generate API Docs"
task :generate_docs do
generate_docs
end
# desc "Build the website"
# task :build => :generate_docs do
# build
# end
desc "Preview"
task :preview do
require 'listen'
generate_docs
paths = Dir.glob(File.join(aura_path, "packages/*/lib"))
listener = Listen.to(*paths, :filter => /\.js$/)
listener.change { generate_docs }
listener.start(false)
system "middleman server"
end