Skip to content
Newer
Older
100644 110 lines (87 sloc) 2.57 KB
10f9f3e Initial commit
adamstac authored Mar 24, 2011
1 require 'rubygems'
540cdaf @adamstac Added a rake tasks
authored Apr 23, 2011
2 require 'bundler'
3 require 'rake'
10f9f3e Initial commit
adamstac authored Mar 24, 2011
4
540cdaf @adamstac Added a rake tasks
authored Apr 23, 2011
5 Bundler.setup
10f9f3e Initial commit
adamstac authored Mar 24, 2011
6 Bundler.require(:default, :test)
7
8 require 'nesta/config'
9 require 'nesta/models'
10
11 namespace :heroku do
12 desc "Set Heroku config vars from config.yml"
13 task :config do
14 Nesta::App.environment = ENV['RACK_ENV'] || 'production'
15 settings = {}
16 Nesta::Config.settings.map do |variable|
17 value = Nesta::Config.send(variable)
18 value && settings["NESTA_#{variable.upcase}"] = value
19 end
20 if Nesta::Config.author
21 Nesta::Config.author_settings.map do |author_var|
22 value = Nesta::Config.author[author_var]
23 if value
24 value && settings["NESTA_AUTHOR__#{author_var.upcase}"] = value
25 end
26 end
27 end
28 params = settings.map { |k, v| %Q{#{k}="#{v}"} }.join(" ")
29 system("heroku config:add #{params}")
30 end
31 end
32
540cdaf @adamstac Added a rake tasks
authored Apr 23, 2011
33 ## My Rake tasks
34 desc 'Start the application'
35 task :start do
36 system "bundle exec shotgun config.ru"
37 end
38
39 desc 'Generate a new project at dir=foo'
40 task :generate do
41 # Generate the new 'dir' if it's not already created
42 system "mkdir #{(ENV['dir'])}" unless File.exists?(ENV['dir'])
43
44 # Archive the current HEAD to 'dir'
45 system "git archive HEAD | (cd #{ENV['dir']} && tar -xvf -)"
46
47 puts "\n *** A new project has been generated at: #{(ENV['dir'])} ***"
48 end
49
50 namespace :styles do
51
52 desc "Run compass stats"
53 task :stats => ["stats:default"]
54
55 namespace :stats do
56
57 task :default do
58 puts "*** Running compass stats ***"
59 system "compass stats"
60 end
61
62 desc "Create a log of compass stats"
63 task :log do
64 t = DateTime.now
65 filename = "compass-stats-#{t.strftime("%Y%m%d")}-#{t.strftime("%H%M%S")}.log"
66 log_dir = "log"
67 puts "*** Logging stats ***"
68 system "compass stats > #{log_dir}/#{filename}"
69 puts "Created #{log_dir}/#{filename}"
70 end
71
72 end
73
74 desc "Clear the styles"
75 task :clear => ["compile:clear"]
76
77 desc "Watch the styles and compile new changes"
78 task :watch do
79 system "compass watch"
80 end
81
82 desc "List the styles"
83 task :list do
84 system "ls -lh public/stylesheets"
85 end
86
87 desc "Compile new styles"
88 task :compile => ["compile:default"]
89
90 namespace :compile do
91
92 task :clear do
93 puts "*** Clearing styles ***"
94 system "rm -Rfv public/stylesheets/*"
95 end
96
97 task :default => :clear do
98 puts "*** Compiling styles ***"
99 system "compass compile"
100 end
101
102 desc "Compile new styles for production"
103 task :production => :clear do
104 puts "*** Compiling styles ***"
105 system "compass compile --output-style compressed --force"
106 end
107
108 end
109
110 end
Something went wrong with that request. Please try again.