wordpress-deploy 1.0.0.alpha2 → 1.0.0.rc1

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.
Files changed (40) hide show
  1. data/.gitignore +7 -1
  2. data/Guardfile +1 -16
  3. data/README.md +56 -0
  4. data/lib/wordpress_deploy.rb +43 -9
  5. data/lib/wordpress_deploy/cli/helpers.rb +6 -3
  6. data/lib/wordpress_deploy/cli/utility.rb +56 -33
  7. data/lib/wordpress_deploy/config.rb +77 -0
  8. data/lib/wordpress_deploy/database/mysql.rb +281 -20
  9. data/lib/wordpress_deploy/environment.rb +85 -43
  10. data/lib/wordpress_deploy/environments.rb +89 -0
  11. data/lib/wordpress_deploy/logger.rb +3 -3
  12. data/lib/wordpress_deploy/{transfer_protocols → storage}/ftp.rb +52 -116
  13. data/lib/wordpress_deploy/storage/local.rb +12 -0
  14. data/lib/wordpress_deploy/version.rb +1 -1
  15. data/lib/wordpress_deploy/wordpress/salts.rb +68 -0
  16. data/spec/data/blue.rb +52 -0
  17. data/spec/data/development.rb +49 -0
  18. data/spec/data/green.rb +52 -0
  19. data/spec/data/production.rb +52 -0
  20. data/spec/data/red.rb +52 -0
  21. data/spec/data/wp-config.php +90 -0
  22. data/spec/spec_helper.rb +16 -5
  23. data/spec/wordpress_deploy/cli/utility_spec.rb +48 -0
  24. data/spec/{environment_spec.rb → wordpress_deploy/config_spec.rb} +9 -7
  25. data/spec/wordpress_deploy/database/mysql_spec.rb +147 -0
  26. data/spec/wordpress_deploy/environment_spec.rb +96 -0
  27. data/spec/wordpress_deploy/environments_spec.rb +65 -0
  28. data/spec/wordpress_deploy/storage/ftp_spec.rb +58 -0
  29. data/spec/wordpress_deploy/storage/local_spec.rb +0 -0
  30. data/spec/wordpress_deploy/wordpress/salts_spec.rb +70 -0
  31. data/{spec/data/wp-config-sample.php → templates/wp-config.erb} +17 -17
  32. data/wordpress_deploy.gemspec +7 -6
  33. metadata +64 -30
  34. data/Gemfile.lock +0 -83
  35. data/lib/wordpress_deploy/wordpress/configuration.rb +0 -196
  36. data/spec/data/ftp.yml +0 -4
  37. data/spec/data/wp-config.yml +0 -128
  38. data/spec/database/mysql_spec.rb +0 -93
  39. data/spec/transfer_protocols/ftp_spec.rb +0 -193
  40. data/spec/wordpress/configuration_spec.rb +0 -202
@@ -1,202 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe WordpressDeploy::Wordpress::Configuration do
4
- it { should respond_to :name }
5
- it { should respond_to :name= }
6
- it { should respond_to :available_names }
7
- it { should respond_to :names }
8
- it { should respond_to :template }
9
- it { should respond_to :output }
10
- it { should respond_to :save! }
11
- it { should respond_to :port }
12
- it { should respond_to :port? }
13
- it { should respond_to :host }
14
- it { should respond_to :socket }
15
- it { should respond_to :socket? }
16
-
17
- it { should respond_to :DB_NAME }
18
- it { should respond_to :DB_USER }
19
- it { should respond_to :DB_PASSWORD }
20
- it { should respond_to :DB_HOST }
21
- it { should respond_to :DB_CHARSET }
22
- it { should respond_to :DB_COLLATE }
23
- it { should respond_to :WPLANG }
24
- it { should respond_to :WP_DEBUG }
25
- it { should respond_to :AUTH_KEY }
26
- it { should respond_to :SECURE_AUTH_KEY }
27
- it { should respond_to :LOGGED_IN_KEY }
28
- it { should respond_to :NONCE_KEY }
29
- it { should respond_to :AUTH_SALT }
30
- it { should respond_to :SECURE_AUTH_SALT }
31
- it { should respond_to :LOGGED_IN_SALT }
32
- it { should respond_to :NONCE_SALT }
33
-
34
- its(:template) { should =~ /wp-config-sample.php$/ }
35
- its(:output) { should =~ /wp-config.php$/ }
36
-
37
- its(:names) { should have(5).strings }
38
- its(:names) { should include "development" }
39
- its(:names) { should include "production" }
40
- its(:names) { should include "red" }
41
- its(:names) { should include "green" }
42
- its(:names) { should include "blue" }
43
- its(:available_names) { should have(5).strings }
44
- its(:available_names) { should include "development" }
45
- its(:available_names) { should include "production" }
46
- its(:available_names) { should include "red" }
47
- its(:available_names) { should include "green" }
48
- its(:available_names) { should include "blue" }
49
-
50
- it "should allow creation of new configuration by name" do
51
- config = WordpressDeploy::Wordpress::Configuration.new "red"
52
- config.name.should eq "red"
53
- end
54
-
55
- it "should only allow configuration names found in the yaml file" do
56
- ["production", "development", "red", "green", "blue"].each do |name|
57
- subject.name = name
58
- subject.name.should eq name
59
- end
60
- [:production, nil].each do |name|
61
- subject.name = name
62
- subject.name.should_not eq name
63
- end
64
- end
65
-
66
- shared_examples "named configuration" do
67
- before(:each) { subject.name = name }
68
- its(:name) { should eq name }
69
- its(:DB_NAME) { should eq db_name }
70
- its(:DB_USER) { should eq db_user }
71
- its(:DB_PASSWORD) { should eq db_password }
72
- its(:DB_HOST) { should eq db_host }
73
- its(:DB_CHARSET) { should eq db_charset }
74
- its(:DB_COLLATE) { should eq db_collate }
75
- its(:WPLANG) { should eq wplang }
76
- its(:WP_DEBUG) { should be_true }
77
- its(:AUTH_KEY) { should be_salt }
78
- its(:SECURE_AUTH_KEY) { should be_salt }
79
- its(:LOGGED_IN_KEY) { should be_salt }
80
- its(:NONCE_KEY) { should be_salt }
81
- its(:AUTH_SALT) { should be_salt }
82
- its(:SECURE_AUTH_SALT) { should be_salt }
83
- its(:LOGGED_IN_SALT) { should be_salt }
84
- its(:NONCE_SALT) { should be_salt }
85
- its(:port) { should eq port_num }
86
- its(:port?) { should eq has_port }
87
- its(:host) { should eq host }
88
- its(:socket) { should eq socket }
89
- its(:socket?) { should eq has_socket }
90
- end
91
-
92
- context "development" do
93
- it_should_behave_like "named configuration" do
94
- let(:name) { "development" }
95
- let(:db_name) { "developer_database_name" }
96
- let(:db_user) { "root" }
97
- let(:db_password) { "q9&hu6Re_*dReWr_GAba_2wr89#2Ra8$" }
98
- let(:db_host) { "localhost" }
99
- let(:db_charset) { "utf8" }
100
- let(:db_collate) { "" }
101
- let(:wplang) { "" }
102
- let(:port_num) { 3306 }
103
- let(:has_port) { false }
104
- let(:host) { "localhost" }
105
- let(:socket) { "" }
106
- let(:has_socket) { false }
107
- end
108
- end
109
-
110
- context "production" do
111
- it_should_behave_like "named configuration" do
112
- let(:name) { 'production' }
113
- let(:db_name) { "production_database_name" }
114
- let(:db_user) { "some_user" }
115
- let(:db_password) { "trecuwawraJaZe6P@kucraDrachustUq" }
116
- let(:db_host) { "abbott.biz:6654" }
117
- let(:db_charset) { "utf8" }
118
- let(:db_collate) { "" }
119
- let(:wplang) { "" }
120
- let(:port_num) { 6654 }
121
- let(:has_port) { true }
122
- let(:host) { "abbott.biz" }
123
- let(:socket) { "" }
124
- let(:has_socket) { false }
125
- end
126
- end
127
-
128
- context "red" do
129
- it_should_behave_like "named configuration" do
130
- let(:name) { 'red' }
131
- let(:db_name) { "red" }
132
- let(:db_user) { "red_user" }
133
- let(:db_password) { "Bun__huPEMeBreM6tebRAp@eguzuQExe" }
134
- let(:db_host) { "hanerutherford.biz" }
135
- let(:db_charset) { "utf8" }
136
- let(:db_collate) { "" }
137
- let(:wplang) { "" }
138
- let(:port_num) { 3306 }
139
- let(:has_port) { false }
140
- let(:host) { "hanerutherford.biz" }
141
- let(:socket) { "" }
142
- let(:has_socket) { false }
143
- end
144
- end
145
-
146
- context "green" do
147
- it_should_behave_like "named configuration" do
148
- let(:name) { 'green' }
149
- let(:db_name) { "green" }
150
- let(:db_user) { "domenick.dare" }
151
- let(:db_password) { "Daw&HEWuzaz6sa&epHech_spAKucHaTH" }
152
- let(:db_host) { "yundt.org" }
153
- let(:db_charset) { "utf8" }
154
- let(:db_collate) { "" }
155
- let(:wplang) { "" }
156
- let(:port_num) { 3306 }
157
- let(:has_port) { false }
158
- let(:host) { "yundt.org" }
159
- let(:socket) { "" }
160
- let(:has_socket) { false }
161
- end
162
- end
163
-
164
- context "blue" do
165
- it_should_behave_like "named configuration" do
166
- let(:name) { 'blue' }
167
- let(:db_name) { "blue" }
168
- let(:db_user) { "harrison" }
169
- let(:db_password) { "w5@reba?9?pepuk7w9a#H86ustaGawE!" }
170
- let(:db_host) { "torphagenes.com:/tmp/mysql5.sock" }
171
- let(:db_charset) { "utf8" }
172
- let(:db_collate) { "" }
173
- let(:wplang) { "" }
174
- let(:port_num) { 3306 }
175
- let(:has_port) { false }
176
- let(:host) { "torphagenes.com" }
177
- let(:socket) { "/tmp/mysql5.sock" }
178
- let(:has_socket) { true }
179
- end
180
- end
181
-
182
- describe "saving configuration" do
183
- it "should create a file if it does not exist" do
184
- # Remove the file (even if it exists)
185
- FileUtils.rm subject.output if File.exists? subject.output
186
-
187
- # Try saving it
188
- subject.save!
189
-
190
- # Check that it now exists
191
- File.exists?(subject.output).should be_true
192
- end
193
-
194
- it "should be calling all of the configuration properties" do
195
- WordpressDeploy::Wordpress::Configuration::WP_CONFIGURATION_ALL.each do |attr|
196
- subject.should_receive(attr).exactly(1).times
197
- end
198
- subject.should_receive(:define).exactly(WordpressDeploy::Wordpress::Configuration::WP_CONFIGURATION_ALL.count).times
199
- subject.save!
200
- end
201
- end
202
- end