tidy_reset 0.1.23 → 0.1.24
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/tidy_reset/application_manager.rb +3 -3
- data/lib/tidy_reset.rb +9 -1
- data/spec/tidy_reset/tidy_reset_spec.rb +11 -2
- data/tidy_reset.gemspec +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e4be60e9fd7b99c31bd8ffff061911dcfa61f26
|
4
|
+
data.tar.gz: 1085ff55b83971aac52ff1be6719911e8b83af09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d5c85c33315bb752eafa77f2ab06b09f60ac77fcaf1be9aee9f7a229ca49aee9ea751ecc4b86d0b8a689a660f5b1b53d520bb10feec6c92ef52bf7471133239
|
7
|
+
data.tar.gz: b094be0064f1f3daaac1d5eca10760d72632988d17143af2b2444182eaf145a87d654fe73055cf5e4b09bf39a21949a66df0c40080beacf96af9cda0edca37d7
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.24
|
@@ -2,12 +2,12 @@ require 'platform-api'
|
|
2
2
|
|
3
3
|
module TidyReset
|
4
4
|
class ApplicationManager
|
5
|
-
attr_accessor :name
|
5
|
+
attr_accessor :name, :token
|
6
6
|
|
7
7
|
def initialize(options)
|
8
8
|
@name = options.fetch(:name)
|
9
|
-
token = options.fetch(:token)
|
10
|
-
@heroku = PlatformAPI.connect_oauth(token)
|
9
|
+
@token = options.fetch(:token)
|
10
|
+
@heroku = PlatformAPI.connect_oauth(@token)
|
11
11
|
end
|
12
12
|
|
13
13
|
def enable_maintenance_mode
|
data/lib/tidy_reset.rb
CHANGED
@@ -82,11 +82,19 @@ module TidyReset
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def create_application_manager(application_name)
|
85
|
-
token = configuration.token
|
85
|
+
token = if configuration.token
|
86
|
+
configuration.token
|
87
|
+
else
|
88
|
+
auth_token_cli
|
89
|
+
end
|
86
90
|
raise NoTokenException unless token
|
87
91
|
self::ApplicationManager.new(name: application_name, token: token)
|
88
92
|
end
|
89
93
|
|
94
|
+
def auth_token_cli
|
95
|
+
Bundler.with_clean_env { `heroku auth:token`.chomp }
|
96
|
+
end
|
97
|
+
|
90
98
|
def master_connection_from_db_config(db_config)
|
91
99
|
# Get connection to master/maintenance database 'postgres'
|
92
100
|
pool = ActiveRecord::Base.send(establish_connection_method, db_config.merge(
|
@@ -72,11 +72,20 @@ describe "TidyReset" do
|
|
72
72
|
end
|
73
73
|
TidyReset.create_application_manager('application-name').should be_a TidyReset::ApplicationManager
|
74
74
|
end
|
75
|
-
it "should
|
75
|
+
it "should use the configuration token if it is set" do
|
76
76
|
TidyReset.configure do |config|
|
77
|
+
config.token = 'abc'
|
78
|
+
end
|
79
|
+
app_manager = TidyReset.create_application_manager('application-name')
|
80
|
+
app_manager.token.should == 'abc'
|
81
|
+
end
|
82
|
+
it "should use the heroku command to get the current user's token if the configuraiton is not set" do
|
83
|
+
TidyReset.configure do |config|
|
77
84
|
config.token = nil
|
78
85
|
end
|
79
|
-
|
86
|
+
TidyReset.should_receive(:auth_token_cli).and_return('def')
|
87
|
+
app_manager = TidyReset.create_application_manager('application-name')
|
88
|
+
app_manager.token.should == 'def'
|
80
89
|
end
|
81
90
|
end
|
82
91
|
end
|
data/tidy_reset.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
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.
|
5
|
+
# stub: tidy_reset 0.1.24 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "tidy_reset"
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.24"
|
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"]
|