engineyard-dnsimple 0.1.1 → 0.1.2

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.
@@ -1,10 +1,15 @@
1
1
  # ChangeLog
2
2
 
3
- ## v0.1.1
3
+ ## v0.1.2 - 2011/5/22
4
+
5
+ * Cucumber scenario is now working against http://test.dnsimple.com
6
+ * Worth rereleasing gem just to celebrate
7
+
8
+ ## v0.1.1 - 2011/5/22
4
9
 
5
10
  * Create .myapp.com and www.myapp.com A records
6
11
 
7
- ## v0.1.0
12
+ ## v0.1.0 - 2011/5/22
8
13
 
9
14
  * Initial release
10
15
  * Basic implementation of `ey-dnsimple assign DOMAIN`
data/README.md CHANGED
@@ -9,10 +9,11 @@ Setup `ey` and `dnsimple` gems and credentials (see below).
9
9
 
10
10
  $ ey-dnsimple assign myapp.com
11
11
  Assigning myapp.com --> 1.2.3.4 (drnic/myapp_production)
12
- Created A record for myapp.com (id:12345)
13
- Complete!
14
- Found 1 records for myapp.com
12
+ Assigning www.myapp.com --> 1.2.3.4 (drnic/myapp_production)
13
+
14
+ Found 2 records for myapp.com
15
15
  .myapp.com (A)-> 1.2.3.4 (ttl:, id:12345)
16
+ www.myapp.com (A)-> 1.2.3.4 (ttl:, id:12346)
16
17
 
17
18
  If an AppCloud environment cannot be automatically detected, explicitly pass -e or -a flags
18
19
  like the `ey` CLI itself:
@@ -4,24 +4,23 @@ Feature: Assign DNS to environment IP address
4
4
  Background:
5
5
  Given I have setup my engineyard email/password for API access
6
6
  And I have "two apps" in AppCloud
7
- And I expect to create DNSimple::Record with attributes:
8
- | domain | myapp.com |
9
- | content | 174.129.7.113 |
10
- | record_type | A |
7
+ And I have setup my dnsimple credentials
8
+ And I have DNSimple domain "myapp.com"
11
9
 
12
10
  Scenario: Assign DNS A Record to an environment
13
11
  When I run local executable "ey-dnsimple" with arguments "assign myapp.com --account main --environment giblets"
14
- Then I should see exactly
12
+ Then I should see matching
15
13
  """
16
- Fetching environment information...
14
+ Fetching AppCloud environment information...
15
+ Found environment giblets on account main with IP 174.129.7.113
17
16
  Assigning myapp.com --> 174.129.7.113 (main/giblets)
18
- Created A record for banjowilliams.com (id:40434)
17
+ Created A record for myapp.com (id:\d+)
19
18
  Assigning www.myapp.com --> 174.129.7.113 (main/giblets)
20
- Created A record for banjowilliams.com (id:40435)
19
+ Created A record for myapp.com (id:\d+)
21
20
  Complete!
22
21
  Found 2 records for myapp.com
23
- .myapp.com (A)-> 174.129.7.113 (ttl:0, id:40434)
24
- www.myapp.com (A)-> 174.129.7.113 (ttl:0, id:40435)
22
+ .myapp.com (A)-> 174.129.7.113 (ttl:60, id:\d+)
23
+ www.myapp.com (A)-> 174.129.7.113 (ttl:60, id:\d+)
25
24
  """
26
25
 
27
26
 
@@ -123,6 +123,13 @@ Then /^I should see exactly$/ do |text|
123
123
  actual_output.should == text
124
124
  end
125
125
 
126
+ Then /^I should see matching$/ do |text|
127
+ regexp = Regexp.new(text.gsub("(", '\(').gsub(")", '\)'))
128
+ actual_output = File.read(@stdout)
129
+ actual_output.should match(regexp)
130
+ end
131
+
132
+
126
133
  Then /^I should see all (\d+) tests pass/ do |expected_test_count|
127
134
  expected = %r{^#{expected_test_count} tests, \d+ assertions, 0 failures, 0 errors}
128
135
  actual_output = File.read(@stdout)
@@ -1,9 +1,9 @@
1
- Given /^I expect to create DNSimple::Record with attributes:$/ do |table|
2
- record = table.rows_hash
3
- p [record.delete("domain"), record.delete("name") || "",
4
- record.delete("record_type") || "A", record.delete("content"), record]
5
- # DNSimple::Record.create(record.delete("domain"), record.delete("name") || "",
6
- # record.delete("record_type") || "A", record.delete("content"), record)
1
+ Given /^I have setup my dnsimple credentials$/ do
2
+ setup_dnsimple_credentials
3
+ end
4
+
5
+ Given /^I have DNSimple domain "([^"]*)"$/ do |domain|
6
+ create_dnsimple_domain domain
7
7
  end
8
8
 
9
9
 
@@ -0,0 +1,25 @@
1
+ module DNSimpleHelpers
2
+ def setup_dnsimple_credentials
3
+ config_file = File.expand_path('~/.dnsimple')
4
+ unless File.exists? config_file
5
+ File.open(config_file, "w") do |file|
6
+ file << <<-EOS.gsub(/^\s{8}/, '')
7
+ username: ossgrants+dnsimple@engineyard.com
8
+ password: dnsimple1
9
+ site: https://test.dnsimple.com/
10
+ EOS
11
+ end
12
+ end
13
+ require "dnsimple"
14
+ DNSimple::Client.load_credentials(config_file)
15
+ end
16
+
17
+ def create_dnsimple_domain(domain)
18
+ begin
19
+ ::DNSimple::Commands::DeleteDomain.new.execute([domain])
20
+ rescue
21
+ end
22
+ ::DNSimple::Commands::CreateDomain.new.execute([domain])
23
+ end
24
+ end
25
+ World(DNSimpleHelpers)
@@ -1,6 +1,8 @@
1
1
  $:.unshift(File.expand_path(File.dirname(__FILE__) + '/../../lib'))
2
2
  require 'bundler/setup'
3
3
  require 'engineyard-dnsimple'
4
+ require 'dnsimple'
5
+ require 'dnsimple/cli'
4
6
 
5
7
  path = ENV['PATH']
6
8
 
@@ -24,9 +24,10 @@ module EngineYard
24
24
  method_option :environment, :aliases => ["-e"], :desc => "Environment in which to deploy this application", :type => :string
25
25
  method_option :account, :aliases => ["-c"], :desc => "Name of the account you want to deploy in"
26
26
  def assign(domain)
27
- say "Fetching environment information..."; $stdout.flush
27
+ say "Fetching AppCloud environment information..."; $stdout.flush
28
28
 
29
29
  environment = fetch_environment(options[:environment], options[:account])
30
+ account_name, env_name = environment.account.name, environment.name
30
31
  unless environment.instances.first
31
32
  error "Environment #{account_name}/#{env_name} has no booted instances."
32
33
  end
@@ -36,7 +37,6 @@ module EngineYard
36
37
  error "Cannot determine public IP from current hostname #{public_hostname}"
37
38
  end
38
39
 
39
- account_name, env_name = environment.account.name, environment.name
40
40
  public_ip = "#{$1}.#{$2}.#{$3}.#{$4}"
41
41
 
42
42
  say "Found environment #{env_name} on account #{account_name} with IP #{public_ip}"
@@ -1,5 +1,5 @@
1
1
  module EngineYard
2
2
  module DNSimple
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engineyard-dnsimple
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dr Nic Williams
@@ -220,6 +220,7 @@ files:
220
220
  - features/step_definitions/dnsimple_steps.rb
221
221
  - features/step_definitions/ey_api_steps.rb
222
222
  - features/support/common.rb
223
+ - features/support/dnsimple.rb
223
224
  - features/support/engineyard.rb
224
225
  - features/support/env.rb
225
226
  - features/support/matchers.rb
@@ -267,6 +268,7 @@ test_files:
267
268
  - features/step_definitions/dnsimple_steps.rb
268
269
  - features/step_definitions/ey_api_steps.rb
269
270
  - features/support/common.rb
271
+ - features/support/dnsimple.rb
270
272
  - features/support/engineyard.rb
271
273
  - features/support/env.rb
272
274
  - features/support/matchers.rb