-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
75 lines (57 loc) · 1.8 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
VERSION_NUMBER = "0.0.1"
wdgt_bin = "Seismometer.wdgt"
xcode_proj = "plugin/UnimotionPlugin/UnimotionPlugin.xcodeproj/"
task :default => [:build]
task :build => [:build_plugin, :build_wdgt, :install_wdgt] do end
task :build_plugin => [:clean_plugin] do
sh "xcodebuild -project #{xcode_proj}"
end
task :clean_plugin do
sh "rm -rdf plugin/UnimotionPlugin/build"
end
task :build_wdgt => [:clean_wdgt] do
sh "mkdir -p #{wdgt_bin}/UnimotionPlugin.bundle"
sh "cp -r example_widget/* #{wdgt_bin}"
sh "cp -r plugin/UnimotionPlugin/build/Release/UnimotionPlugin.bundle/* #{wdgt_bin}/UnimotionPlugin.bundle"
sh "rm #{wdgt_bin}/design.psd"
end
task :clean_wdgt do
sh "rm -rdf #{wdgt_bin}"
end
task :install_wdgt do
sh "open #{wdgt_bin}"
end
task :restart_dock do
sh "killall Dock"
end
task :generate_site do
sh 'mkdir gh-pages'
sh 'rm -rdf gh-pages/*'
sh 'cp -R site_templates/* gh-pages/'
require 'rubygems'
require 'rdoc/markup/to_html'
def get_file_as_string(filename)
data = ''
f = File.open(File.expand_path(filename), "r")
f.each_line do |line|
data += line
end
return data
end
def string_replace(search, replace, filename)
file = File.open(File.expand_path(filename), "r")
aString = file.read
file.close
aString.gsub!(search, replace)
File.open(filename, "w") {|file| file << aString}
end
h = RDoc::Markup::ToHtml.new
html_str = h.convert(get_file_as_string('README.rdoc'))
string_replace('GENERATED_CONTENT', html_str, 'gh-pages/index.html')
end
task :package_bundle do
sh "mkdir UnimotionPlugin.bundle"
sh "cp -R plugin/UnimotionPlugin/build/Release/UnimotionPlugin.bundle/* UnimotionPlugin.bundle"
sh "tar -czvf UnimotionPlugin.bundle.#{VERSION_NUMBER}.tgz UnimotionPlugin.bundle/*"
sh "rm -rdf UnimotionPlugin.bundle"
end