heroku-domainr 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  module Heroku
2
2
  module Plugins
3
3
  module Domainr
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
6
6
  end
7
7
  end
@@ -7,20 +7,34 @@ module Heroku
7
7
  @@heroku_client = nil
8
8
 
9
9
  def domains_add(domain)
10
- heroku_client.add_domain(Heroku::Plugins::Domainr::Config.heroku_app, domain)
10
+ unless config_not_defined?
11
+ heroku_client.add_domain(Heroku::Plugins::Domainr::Config.heroku_app, domain)
12
+ else
13
+ log("Skipping domain #{domain} creation because config is not defined")
14
+ end
11
15
  end
12
16
 
13
17
  def domains_remove(domain)
14
- heroku_client.remove_domain(Heroku::Plugins::Domainr::Config.heroku_app, domain)
18
+ unless config_not_defined?
19
+ heroku_client.remove_domain(Heroku::Plugins::Domainr::Config.heroku_app, domain)
20
+ else
21
+ log("Skipping domain #{domain} removal because config is not defined")
22
+ end
15
23
  end
16
24
 
17
25
  def domains_clear()
18
- heroku_client.remove_domains(Heroku::Plugins::Domainr::Config.heroku_app)
26
+ unless config_not_defined?
27
+ heroku_client.remove_domains(Heroku::Plugins::Domainr::Config.heroku_app)
28
+ else
29
+ log("Skipping domain clearing because config is not defined")
30
+ end
19
31
  end
20
32
 
21
33
  def heroku_client
22
- @@heroku_client || @@heroku_client = Heroku::Client.new(Heroku::Plugins::Domainr::Config.heroku_user,
23
- Heroku::Plugins::Domainr::Config.heroku_pass)
34
+ unless config_not_defined?
35
+ @@heroku_client || @@heroku_client = Heroku::Client.new(Heroku::Plugins::Domainr::Config.heroku_user,
36
+ Heroku::Plugins::Domainr::Config.heroku_pass)
37
+ end
24
38
  end
25
39
 
26
40
  def self.config
@@ -28,6 +42,9 @@ module Heroku
28
42
  end
29
43
 
30
44
  private
45
+ def config_not_defined?
46
+ Heroku::Plugins::Domainr::Config.heroku_user.nil? || Heroku::Plugins::Domainr::Config.heroku_pass.nil? || Heroku::Plugins::Domainr::Config.heroku_app.nil?
47
+ end
31
48
 
32
49
  def log(message)
33
50
  if defined?(Rails)
@@ -6,7 +6,9 @@ RSpec.configure do |config|
6
6
  end
7
7
 
8
8
  Heroku::Plugins::Domainr.config do |c|
9
- c.heroku_app = "app_name"
9
+ c.heroku_app = "app_name"
10
+ c.heroku_user = "jan"
11
+ c.heroku_pass = "haslo"
10
12
  end
11
13
 
12
14
  class DomainrImpl
@@ -34,4 +36,13 @@ describe Heroku::Plugins::Domainr do
34
36
  mock(@fake_heroku_client).remove_domains("app_name")
35
37
  @domainr.domains_clear()
36
38
  end
39
+
40
+ it "should not call heroku client if app name is not specified" do
41
+ Heroku::Plugins::Domainr.config do |c|
42
+ c.heroku_app = nil
43
+ end
44
+ @domainr.domains_add("alamakota")
45
+ @domainr.domains_remove("alamakota")
46
+ @domainr.domains_clear()
47
+ end
37
48
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Marcin Naglik
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-05-09 00:00:00 +02:00
17
+ date: 2011-05-11 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency