deploy_tasks 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.markdown CHANGED
@@ -6,7 +6,19 @@ RAILS_APP like this:
6
6
 
7
7
  RAILS_APP = 'my_fabulous_app'
8
8
 
9
+ Heroku
10
+ ------
11
+
12
+ You get the following rake tasks:
13
+
14
+ * deploy:production
15
+ * deploy:staging
16
+ * deploy:juice (if you use juicer)
17
+
18
+ The deploy tasks pull translations from webtranslateit.com if you use it, juice
19
+ your assets with juicer and finally deploy, if everything's committed.
20
+
9
21
  License
10
- =======
22
+ -------
11
23
 
12
24
  MIT License - Thomas Maurer
data/lib/deploy_tasks.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rails/railtie'
2
2
 
3
3
  module DeployTasks
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
 
6
6
  class Base < Rails::Railtie
7
7
  rake_tasks do
@@ -19,24 +19,56 @@ namespace :deploy do
19
19
  task :production do
20
20
  message '>> Are you sure to deploy to production? (type yes): ', true
21
21
  if STDIN.gets.chomp == 'yes'
22
- if Rake::Task['trans:fetch:all'].present?
22
+ if working_tree_dirty?
23
+ message 'Please clean your dirty tree!'; exit
24
+ end
25
+
26
+ if pull_translations?
23
27
  message 'Pulling translations..'
24
28
  Rake::Task['trans:fetch:all'].execute
29
+
30
+ if working_tree_dirty?
31
+ message 'Please commit the pulled translations!'; exit
32
+ end
25
33
  end
26
34
 
27
- if working_tree_dirty?
28
- message 'Please clean your dirty tree!'; exit
35
+ if run_juicer?
36
+ message 'Juicing CSS and JavaScript..'
37
+ Rake::Task['deploy:juice'].execute
38
+
39
+ if working_tree_dirty?
40
+ message 'Please commit the juiced assets!'; exit
41
+ end
29
42
  end
30
43
 
31
44
  push_to('production')
32
- migrate_database_of_app('calculate')
33
- open_app('calculate')
45
+ migrate_database_of_app(RAILS_APP)
46
+ open_app(RAILS_APP)
34
47
  end
35
48
  end
36
49
 
50
+ desc 'Generate minified CSS and JavaScript files'
51
+ task :juice do
52
+ # css
53
+ options = '--force --document-root public/'
54
+ puts `cd #{Rails.root} && juicer merge #{options} public/stylesheets/application.css`
55
+
56
+ # js
57
+ options = '--force -i -s -m closure_compiler --document-root public/'
58
+ puts `cd #{Rails.root} && juicer merge #{options} public/javascripts/application.js`
59
+ end
60
+
37
61
  def working_tree_dirty?
38
62
  `cd #{Rails.root} && git status --short -uno`.present?
39
63
  end
64
+
65
+ def pull_translations?
66
+ Rake::Task['trans:fetch:all'].present?
67
+ end
68
+
69
+ def run_juicer?
70
+ `which juicer`.present?
71
+ end
40
72
 
41
73
  def push_to(env)
42
74
  message "Pushing to #{env}.."
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deploy_tasks
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Thomas Maurer