dotcloud 0.0.2 → 0.0.3

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/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
1
  gem 'activesupport', '~> 3.0.0'
2
2
  gem 'jeweler', '~> 1.6.0'
3
- gem 'i18n', '~> 0.6.0'
3
+ gem 'i18n', '~> 0.5.0'
@@ -2,7 +2,7 @@ GEM
2
2
  specs:
3
3
  activesupport (3.0.8)
4
4
  git (1.2.5)
5
- i18n (0.6.0)
5
+ i18n (0.5.0)
6
6
  jeweler (1.6.2)
7
7
  bundler (~> 1.0)
8
8
  git (>= 1.2.5)
@@ -13,6 +13,6 @@ PLATFORMS
13
13
  ruby
14
14
 
15
15
  DEPENDENCIES
16
- activesupport (~> 3.0.8)
17
- i18n (~> 0.6.0)
18
- jeweler (~> 1.6.2)
16
+ activesupport (~> 3.0.0)
17
+ i18n (~> 0.5.0)
18
+ jeweler (~> 1.6.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -41,9 +41,13 @@ module DotCloud
41
41
  end
42
42
 
43
43
  private
44
+ def get_host
45
+ Socket.gethostname
46
+ end
47
+
44
48
  REGEX = /([a-zA-Z]+)-default-(.*)-([0-9]+)/
45
49
  def do_match
46
- @host = Socket.gethostname
50
+ @host = get_host
47
51
  match = REGEX.match(@host)
48
52
  unless match
49
53
  puts "#{@host} did not match regex"
@@ -40,6 +40,7 @@ class DslTest < Test::Unit::TestCase
40
40
  DotCloud::Host.instance.reset
41
41
  DotCloud::Host.instance.send :instance_variable_set, :@namespace, 'na'
42
42
  DotCloud.run
43
+ DotCloud::Host.instance.reset
43
44
  assert_nil @namespace
44
45
  assert_nil @service
45
46
 
@@ -47,6 +48,7 @@ class DslTest < Test::Unit::TestCase
47
48
  DotCloud::Host.instance.send :instance_variable_set, :@namespace, 'na'
48
49
  DotCloud::Host.instance.send :instance_variable_set, :@service, 'sb'
49
50
  DotCloud.run
51
+ DotCloud::Host.instance.reset
50
52
  assert_equal 'na', @namespace
51
53
  assert_equal 'sb', @service
52
54
  end
@@ -0,0 +1,35 @@
1
+ require 'test/test_helper'
2
+
3
+ # TODO: replace with mocks or some other better method
4
+ $host = nil
5
+ module DotCloud
6
+ class Host
7
+ def get_host
8
+ $host
9
+ end
10
+ end
11
+ end
12
+
13
+ class HostTest < Test::Unit::TestCase
14
+ def setup
15
+ $host = nil
16
+ hi.reset
17
+ end
18
+
19
+ def hi
20
+ DotCloud::Host.instance
21
+ end
22
+
23
+ def test_invalid
24
+ assert_nil hi.namespace
25
+ assert_nil hi.service
26
+ assert_nil hi.id
27
+ end
28
+
29
+ def test_parse
30
+ $host = 'fundecho-default-www-0'
31
+ assert_equal 'fundecho', hi.namespace
32
+ assert_equal 'www', hi.service
33
+ assert_equal 0, hi.id
34
+ end
35
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dotcloud
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nitay Joffe
@@ -57,12 +57,12 @@ dependencies:
57
57
  requirements:
58
58
  - - ~>
59
59
  - !ruby/object:Gem::Version
60
- hash: 7
60
+ hash: 11
61
61
  segments:
62
62
  - 0
63
- - 6
63
+ - 5
64
64
  - 0
65
- version: 0.6.0
65
+ version: 0.5.0
66
66
  name: i18n
67
67
  version_requirements: *id003
68
68
  prerelease: false
@@ -86,6 +86,7 @@ files:
86
86
  - lib/dotcloud/dsl.rb
87
87
  - lib/dotcloud/host.rb
88
88
  - test/dsl_test.rb
89
+ - test/host_test.rb
89
90
  - test/test_helper.rb
90
91
  has_rdoc: true
91
92
  homepage: http://github.com/nitay/dotcloud