-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
113 lines (84 loc) · 3.25 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
require 'rubygems' unless ENV['NO_RUBYGEMS']
require 'fileutils'
task :default => [:build]
desc "Create the release [default]"
task :build => ["build:clean", "build:prepare", "build:compile", "build:copy"]
desc "Build and release"
task :all => [:clobber, :build, :release]
desc "Removes all files from build and release"
task :clobber => ["build:clean", "release:clean"]
namespace :build do
desc "Removes files from dist and build"
task :clean do
FileUtils.rm_r Dir.glob('dist') rescue nil
FileUtils.rm_r Dir.glob('build') rescue nil
end
task :prepare do
FileUtils.mkdir_p %w(dist dist/css dist/scripts dist/images)
FileUtils.mkdir_p %w(build build/css build/scripts build/images)
end
desc "Builds javascript through node.js"
task :compile do
sh %{ node lib/r.js -o app.build.js }
end
desc "Copies files to the dist folder"
task :copy do
FileUtils.cp 'build/app-dist.html', "dist/app.html", :verbose => true
# TODO - this should really be screen-min
FileUtils.cp_r 'build/css/screen.css', "dist/css/screen.css", :verbose => true
FileUtils.cp 'build/scripts/coffee/main.js', "dist/scripts/main-min.js", :verbose => true
# FileUtils.cp 'build/scripts/coffee/loader.js', "dist/scripts/loader-min.js", :verbose => true
FileUtils.cp 'build/scripts/bootstrap.js', "dist/scripts/bootstrap-min.js", :verbose => true
FileUtils.cp 'build/scripts/bootstrap-html.js', "dist/scripts/bootstrap-html-min.js", :verbose => true
FileUtils.cp_r 'build/images', "dist", :verbose => true
FileUtils.cp_r 'README.md', "dist", :verbose => true
FileUtils.rm_r Dir.glob('dist/**/.svn')
FileUtils.rm_r Dir.glob('dist/**/.DS_Store')
end
end
desc "Opens all tests and examples in browser"
task :test => ["test:acceptance", "test:specs", "test:example"]
namespace :test do
open = /mswin|mingw/ =~ RUBY_PLATFORM ? 'start' : 'open'
desc "Run acceptance test in browser"
task :acceptance => "build:compile" do
`#{open} dist/app.html`
end
desc "Run spec tests in browser"
task :specs do
`#{open} test/SpecRunner.html`
end
desc "Show example"
task :example do
`#{open} src/app.html`
end
desc "Run spec tests in node.js"
task :node => ['build:compile'] do
`lib/node-jasmine-dom/bin/jasmine-dom --runner test/SpecRunner.html`
end
end
desc "Build and release to server using upload.sh - (not checked in)"
task :release => ["release:clean", "release:prepare"] do
# This is an example of my basic upload.sh file that is specific to my environment
# #!/usr/bin/env bash
# cd dist
# scp -r * [email protected]:/home/user/myapp.mydomain.com
# echo "Copying the archive across"
# zip -r ../release/app.zip .
# scp ../release/app.zip [email protected]:/home/user/myapp.mydomain.com
# # add redirect in the apache environment
# echo "DirectoryIndex app.html" > .htaccess
# scp -r .htaccess [email protected]:/home/user/myapp.mydomain.com
# cd ..
sh %{ ./upload.sh }
end
namespace "release" do
desc "Cleans release folder"
task :clean do
FileUtils.rm_r Dir.glob('release') rescue nil
end
desc "Creates the release folder"
task :prepare do
FileUtils.mkdir_p %w(release)
end
end