-
Notifications
You must be signed in to change notification settings - Fork 12
/
Rakefile
106 lines (82 loc) · 2.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
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
desc "Generate all data sets"
task :data => ["data/synonyms.msgpack", "data/ngrams.msgpack"]
file "data/synonyms.msgpack" do
mkdir_p "data"
sh "python pycryptics/data_generators/generate_synonyms.py"
end
file "data/ngrams.msgpack" do
sh "PYTHONPATH=#{File.dirname(__FILE__)}:$PYTHONPATH python pycryptics/data_generators/generate_ngrams.py"
end
desc "Serve crypticweb locally"
task :serve => [:data, :compile_templates] do
sh "python pycryptics/crypticweb/server.py"
end
task :test => [:data] do
sh "PYTHONPATH=#{File.dirname(__FILE__)}:$PYTHONPATH python -m nose --nocapture pycryptics"
end
task :puz => [:data] do
sh "python pycryptics/solve_puz.py sample_puzzles/kegler_cryptic_1.puz"
end
wordnet_path = "~/nltk_data"
task :download_corpus => [wordnet_path + "/corpora/wordnet.zip"]
file wordnet_path + "/corpora/wordnet.zip" do
sh "python -m nltk.downloader -d " + wordnet_path + " wordnet"
end
desc "Download the NLTK wordnet corpus"
task :download => [:download_corpus]
desc "Generate the App Engine app"
task :app => ["app_build/data/ngrams.00.pck",
"app_build/data/synonyms.00.pck",
"app_build/en/__init__.py",
"app_build/nltk/__init__.py",
"app_build/nltk_data/corpora/wordnet.zip",
"app_build/web/__init__.py",
:compile_templates,
:copy_indicators,
:copy_python,
:copy_static,
:copy_app]
task :app_serve => [:app] do
sh "dev_appserver.py app_build"
end
task :app_upload => [:app] do
sh "appcfg.py update app_build"
end
file "app_build/data/ngrams.00.pck" => ["data/ngrams.00.pck"] do
sh "mkdir -p app_build/data"
sh "cp data/ngrams.* app_build/data/"
sh "cp data/initial_ngrams.* app_build/data/"
end
file "app_build/data/synonyms.00.pck" => ["data/synonyms.00.pck"] do
sh "cp data/synonyms.* app_build/data/"
end
file "app_build/en/__init__.py" => ["en/__init__.py"] do
sh "cp -r en app_build/"
end
file "app_build/nltk/__init__.py" => ["app/nltk/__init__.py"] do
sh "cp -r app/nltk app_build/"
end
file "app_build/web/__init__.py" do
sh "cp -r /usr/local/lib/python2.7/site-packages/web app_build/"
end
file "app_build/nltk_data/corpora/wordnet.zip" do
sh "mkdir -p app_build/nltk_data/corpora"
sh "cp -r /usr/share/nltk_data/corpora/wordnet* app_build/nltk_data/corpora"
end
task :compile_templates do
Dir.chdir "pycryptics/crypticweb"
sh "python -m web.template --compile templates"
Dir.chdir "../.."
end
task :copy_python do
sh "cp -r pycryptics app_build/"
end
task :copy_static do
sh "cp -r static app_build/"
end
task :copy_indicators do
sh "cp -r indicators app_build/"
end
task :copy_app do
sh "cp -r app/* app_build/"
end