tidy_reset 0.1.14 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe315012fd76fed565ec642b41aaccd8c4d51dae
4
- data.tar.gz: 0704497370a0bbd0538a3980db2b9123618f2107
3
+ metadata.gz: 2e0313e131ba96280fb6f3100d8ea0a5e4ed521a
4
+ data.tar.gz: f215bca5d14824c6681e4202fbc9775b7a9f2f49
5
5
  SHA512:
6
- metadata.gz: 993878166be13bb37b0c93d8040e40ebd030ea31ea611724ee3bde0ddd85b8819610b9313d05da2c12f3724d1f427b836a28c8f4b0fbeec32bbd0ee2117723fb
7
- data.tar.gz: ca974b7b162700741f04bd2b5a38fa7a7d15db22b2637ab1d7bb5ca884d7afdb6d55595db53e1b30edc0c86388fc356759747e939c8d7b953affd161b9b04271
6
+ metadata.gz: e8f6f024bb5aaf2ddb8ca12c6ab187178235a7cd59fb43957d122641455d8cbc46b4d4d4aa2d1c43b7379282f403663a6c24c4419b4d784e71d6b88356317baf
7
+ data.tar.gz: a650adcd02edabb81326b58ecff2b033603ce1a71320e57bce1d4b240e45208e29a717002d2322a9405417a988cc84a7a4c56c851cca081b9369b5d6962b36a4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.14
1
+ 0.1.17
data/lib/tidy_reset.rb CHANGED
@@ -22,8 +22,24 @@ module TidyReset
22
22
  end
23
23
  end
24
24
 
25
- def app_name(postfix)
26
- "#{configuration.app}-#{postfix}"
25
+ def app_name(stage)
26
+ "#{configuration.app}-#{stage}"
27
+ end
28
+
29
+ def dyno_config
30
+ YAML.load_file("#{Rails.root}/config/tidy/dynos.yml")
31
+ end
32
+
33
+ def app_stop(stage)
34
+ execute("heroku maintenance:on --app #{app_name(stage)}")
35
+ scale_command = dyno_config[stage].inject("") { |command, config| command += "#{config.first}='0' " }
36
+ execute("heroku ps:scale #{scale_command} --app #{app_name(stage)}")
37
+ end
38
+
39
+ def app_start(stage)
40
+ execute("heroku maintenance:off --app #{app_name(stage)}")
41
+ scale_command = dyno_config[stage].inject("") { |command, config| command += "#{config.first}='#{config.last}' " }
42
+ execute("heroku ps:scale #{scale_command} --app #{app_name(stage)}")
27
43
  end
28
44
 
29
45
  def master_connection_from_db_config(db_config)
@@ -1,6 +1,6 @@
1
1
  namespace :tidy do
2
2
  desc "Makes application pristine."
3
- task :all, [:stage] => [:validate, :dynos, :vars, :git, :db, :cache, :restart] do |t, args|
3
+ task :all, [:stage] => [:validate, :app_stop, :vars, :git, :db, :cache, :restart, :app_start] do |t, args|
4
4
  # Executes all tasks
5
5
  end
6
6
 
@@ -27,12 +27,14 @@ namespace :tidy do
27
27
  end
28
28
  end
29
29
 
30
- desc "Scales the application dynos to a default configuration."
31
- task :dynos, [:stage] => [:validate] do |t, args|
32
- app = TidyReset.app_name(args.stage)
33
- yaml_config = YAML.load_file("#{Rails.root}/config/tidy/dynos.yml")
34
- scale_command = yaml_config[args.stage].inject("") { |command, config| command += "#{config.first}='#{config.last}' " }
35
- TidyReset.execute("heroku ps:scale #{scale_command} --app #{app}")
30
+ desc "Enables maintenance mode. Scales all dynos to 0."
31
+ task :app_stop, [:stage] => [:validate] do |t, args|
32
+ TidyReset.app_stop(args.stage)
33
+ end
34
+
35
+ desc "Disables maintenance mode. Scales all dynos to configuration."
36
+ task :app_start, [:stage] => [:validate] do |t, args|
37
+ TidyReset.app_start(args.stage)
36
38
  end
37
39
 
38
40
  desc "Sets default environment variables."
data/tidy_reset.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: tidy_reset 0.1.14 ruby lib
5
+ # stub: tidy_reset 0.1.17 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "tidy_reset"
9
- s.version = "0.1.14"
9
+ s.version = "0.1.17"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Thinknear"]
14
- s.date = "2014-08-21"
14
+ s.date = "2014-08-29"
15
15
  s.description = "Reset dynos, environment variables, deploys master git branch, and purges the database."
16
16
  s.email = "software@thinknear.com"
17
17
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tidy_reset
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thinknear
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-21 00:00:00.000000000 Z
11
+ date: 2014-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler