projectdx_pipeline 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.2.1
@@ -34,7 +34,10 @@ class ProjectdxPipeline::DatabaseConfigurationTemplate
34
34
  attr_accessor :database_prefix
35
35
 
36
36
  # a string that will suffix the name of each database, defaults to the
37
- # hostname of the machine on which this code is running
37
+ # hostname of the machine on which this code is running, but will remove the
38
+ # "rf-pdx-" prefix and the "(.dyn).renewfund.com" suffix, and it will truncate
39
+ # the result to be no longer than 63 characters due to PostgreSQL's limitation
40
+ # on the lenght of database names.
38
41
  attr_accessor :client_id
39
42
 
40
43
  # Instantiates a new configuration template. If a +template_file+ is
@@ -73,7 +76,12 @@ class ProjectdxPipeline::DatabaseConfigurationTemplate
73
76
  end
74
77
 
75
78
  def client_id #:nodoc:
76
- @client_id ||= Socket.gethostname.gsub(/\W/, '_')
79
+ @client_id ||= begin
80
+ client_id = Socket.gethostname.gsub(/\W/, '_')
81
+ client_id.sub!(/^rf_pdx_/, '')
82
+ client_id.sub!(/(_dyn)?_renewfund_com$/, '')
83
+ client_id.slice(0..62)
84
+ end
77
85
  end
78
86
 
79
87
  def self.read_template(template_file) #:nodoc:
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{projectdx_pipeline}
8
- s.version = "1.2.0"
7
+ s.name = "projectdx_pipeline"
8
+ s.version = "1.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Renewable Funding"]
12
- s.date = %q{2012-02-17}
13
- s.description = %q{Common pipeline tasks and libraries to be used for all components of the ProjectDX platform}
14
- s.email = %q{devteam@renewfund.com}
12
+ s.date = "2012-02-28"
13
+ s.description = "Common pipeline tasks and libraries to be used for all components of the ProjectDX platform"
14
+ s.email = "devteam@renewfund.com"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
17
  "README.rdoc"
@@ -45,11 +45,11 @@ Gem::Specification.new do |s|
45
45
  "spec/file_spec.rb",
46
46
  "spec/spec_helper.rb"
47
47
  ]
48
- s.homepage = %q{http://github.com/projectdx/projectdx_pipeline}
48
+ s.homepage = "http://github.com/projectdx/projectdx_pipeline"
49
49
  s.licenses = ["MIT"]
50
50
  s.require_paths = ["lib"]
51
- s.rubygems_version = %q{1.5.2}
52
- s.summary = %q{Rake tasks for ProjectDX deployment pipeline}
51
+ s.rubygems_version = "1.8.15"
52
+ s.summary = "Rake tasks for ProjectDX deployment pipeline"
53
53
 
54
54
  if s.respond_to? :specification_version then
55
55
  s.specification_version = 3
@@ -90,6 +90,31 @@ describe ProjectdxPipeline::DatabaseConfigurationTemplate do
90
90
  template = ProjectdxPipeline::DatabaseConfigurationTemplate.new
91
91
  template.client_id.should == 'foo_bar'
92
92
  end
93
+
94
+ it 'removes the string "rf-pdx-" from front of hostname if present' do
95
+ Socket.stub!(:gethostname => 'rf-pdx-my-awesome-friggin-machine')
96
+ template = ProjectdxPipeline::DatabaseConfigurationTemplate.new
97
+ template.client_id.should == 'my_awesome_friggin_machine'
98
+ end
99
+
100
+ it 'removes the ".renewfund.com" string from the end of the hostname if present' do
101
+ Socket.stub!(:gethostname => 'machine.renewfund.com')
102
+ template = ProjectdxPipeline::DatabaseConfigurationTemplate.new
103
+ template.client_id.should == 'machine'
104
+ end
105
+
106
+ it 'removes the ".dyn.renewfund.com" string from the end of the hostname if present' do
107
+ Socket.stub!(:gethostname => 'machine.dyn.renewfund.com')
108
+ template = ProjectdxPipeline::DatabaseConfigurationTemplate.new
109
+ template.client_id.should == 'machine'
110
+ end
111
+
112
+ it 'does not return a string longer than 63 characters (due to a postgresql limitation)' do
113
+ name = "rf-pdx-" + (('a'..'z').to_a * 4).join('') + "dyn.renewfund.com"
114
+ Socket.stub!(:gethostname => name)
115
+ template = ProjectdxPipeline::DatabaseConfigurationTemplate.new
116
+ template.client_id.should == (('a'..'z').to_a * 4)[0..62].join('')
117
+ end
93
118
  end
94
119
 
95
120
  describe '#render_to_file' do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: projectdx_pipeline
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 0
10
- version: 1.2.0
9
+ - 1
10
+ version: 1.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Renewable Funding
@@ -15,11 +15,9 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-17 00:00:00 -08:00
19
- default_executable:
18
+ date: 2012-02-28 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- name: capistrano
23
21
  version_requirements: &id001 !ruby/object:Gem::Requirement
24
22
  none: false
25
23
  requirements:
@@ -31,11 +29,11 @@ dependencies:
31
29
  - 9
32
30
  - 0
33
31
  version: 2.9.0
32
+ name: capistrano
34
33
  prerelease: false
35
34
  type: :runtime
36
35
  requirement: *id001
37
36
  - !ruby/object:Gem::Dependency
38
- name: capistrano-ext
39
37
  version_requirements: &id002 !ruby/object:Gem::Requirement
40
38
  none: false
41
39
  requirements:
@@ -47,11 +45,11 @@ dependencies:
47
45
  - 2
48
46
  - 1
49
47
  version: 1.2.1
48
+ name: capistrano-ext
50
49
  prerelease: false
51
50
  type: :runtime
52
51
  requirement: *id002
53
52
  - !ruby/object:Gem::Dependency
54
- name: rspec
55
53
  version_requirements: &id003 !ruby/object:Gem::Requirement
56
54
  none: false
57
55
  requirements:
@@ -63,11 +61,11 @@ dependencies:
63
61
  - 3
64
62
  - 0
65
63
  version: 2.3.0
64
+ name: rspec
66
65
  prerelease: false
67
66
  type: :development
68
67
  requirement: *id003
69
68
  - !ruby/object:Gem::Dependency
70
- name: bundler
71
69
  version_requirements: &id004 !ruby/object:Gem::Requirement
72
70
  none: false
73
71
  requirements:
@@ -79,11 +77,11 @@ dependencies:
79
77
  - 0
80
78
  - 0
81
79
  version: 1.0.0
80
+ name: bundler
82
81
  prerelease: false
83
82
  type: :development
84
83
  requirement: *id004
85
84
  - !ruby/object:Gem::Dependency
86
- name: jeweler
87
85
  version_requirements: &id005 !ruby/object:Gem::Requirement
88
86
  none: false
89
87
  requirements:
@@ -95,11 +93,11 @@ dependencies:
95
93
  - 6
96
94
  - 4
97
95
  version: 1.6.4
96
+ name: jeweler
98
97
  prerelease: false
99
98
  type: :development
100
99
  requirement: *id005
101
100
  - !ruby/object:Gem::Dependency
102
- name: rcov
103
101
  version_requirements: &id006 !ruby/object:Gem::Requirement
104
102
  none: false
105
103
  requirements:
@@ -109,6 +107,7 @@ dependencies:
109
107
  segments:
110
108
  - 0
111
109
  version: "0"
110
+ name: rcov
112
111
  prerelease: false
113
112
  type: :development
114
113
  requirement: *id006
@@ -149,7 +148,6 @@ files:
149
148
  - spec/database_configuration_template_spec.rb
150
149
  - spec/file_spec.rb
151
150
  - spec/spec_helper.rb
152
- has_rdoc: true
153
151
  homepage: http://github.com/projectdx/projectdx_pipeline
154
152
  licenses:
155
153
  - MIT
@@ -179,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
177
  requirements: []
180
178
 
181
179
  rubyforge_project:
182
- rubygems_version: 1.5.2
180
+ rubygems_version: 1.8.15
183
181
  signing_key:
184
182
  specification_version: 3
185
183
  summary: Rake tasks for ProjectDX deployment pipeline