wpcap 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/Guardfile +46 -0
- data/README.md +4 -4
- data/lib/wpcap/command.rb +86 -57
- data/lib/wpcap/recipes/templates/{deploy-stage.rb.erb → deploy_stage.rb.erb} +0 -0
- data/lib/wpcap/recipes/wordpress.rb +1 -0
- data/lib/wpcap/version.rb +1 -1
- data/spec/binary/wpcap_spec.rb +65 -0
- data/spec/spec_helper.rb +28 -0
- data/spec/test_payloads/existing/wp-config.php +90 -0
- data/spec/test_payloads/existing/wp-load.php +63 -0
- data/spec/test_payloads/new/wp-load.php +63 -0
- data/wpcap.gemspec +7 -0
- metadata +128 -4
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour --profile
|
data/Guardfile
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'rspec' do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
|
9
|
+
# Rails example
|
10
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
11
|
+
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
12
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
13
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
14
|
+
watch('config/routes.rb') { "spec/routing" }
|
15
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
16
|
+
|
17
|
+
# Capybara features specs
|
18
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
19
|
+
|
20
|
+
# Turnip features and steps
|
21
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
22
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
guard 'rspec' do
|
27
|
+
watch(%r{^spec/.+_spec\.rb$})
|
28
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
29
|
+
watch('spec/spec_helper.rb') { "spec" }
|
30
|
+
|
31
|
+
# Rails example
|
32
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
33
|
+
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
34
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
35
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
36
|
+
watch('config/routes.rb') { "spec/routing" }
|
37
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
38
|
+
|
39
|
+
# Capybara features specs
|
40
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
41
|
+
|
42
|
+
# Turnip features and steps
|
43
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
44
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
45
|
+
end
|
46
|
+
|
data/README.md
CHANGED
data/lib/wpcap/command.rb
CHANGED
@@ -1,64 +1,93 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
def self.create(args)
|
10
|
-
@application = args.first
|
11
|
-
@wp_root = File.join( (args[1].nil? ? Dir.pwd : args[1]) , @application.to_s)
|
12
|
-
locale = args[2].nil? ? "en_US" : args[2]
|
13
|
-
puts @wp_root
|
14
|
-
if File.directory? "#{@wp_root}"
|
15
|
-
puts "Project Folder Already Exists"
|
16
|
-
return
|
17
|
-
end
|
18
|
-
`mkdir -p #{@wp_root}`
|
19
|
-
`cd #{@wp_root} && mkdir app`
|
20
|
-
|
21
|
-
if File.exists? @wp_root + 'app/wp-load.php'
|
22
|
-
puts "This folder seems to already contain wordpress files. "
|
23
|
-
return
|
1
|
+
module Wpcap
|
2
|
+
class Command
|
3
|
+
require 'shellwords'
|
4
|
+
require 'wpcap/utility'
|
5
|
+
require 'net/http'
|
6
|
+
|
7
|
+
def self.run(command, args)
|
8
|
+
Wpcap::Command.send(command, args)
|
24
9
|
end
|
25
10
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
11
|
+
def self.create(args)
|
12
|
+
@application = args.first.to_s.downcase
|
13
|
+
@wp_root = File.join( (args[1].nil? ? Dir.pwd : args[1]) , @application)
|
14
|
+
@app_dir = @wp_root + "/app"
|
15
|
+
|
16
|
+
if File.directory? "#{@wp_root}"
|
17
|
+
warn "Project Folder Already Exists"
|
18
|
+
abort
|
19
|
+
end
|
20
|
+
|
21
|
+
FileUtils.mkdir_p(@wp_root)
|
22
|
+
|
23
|
+
install_wordpress @app_dir
|
24
|
+
|
25
|
+
self.setup
|
33
26
|
end
|
34
27
|
|
35
|
-
|
36
|
-
|
37
|
-
|
28
|
+
def self.build(args)
|
29
|
+
@wp_root = File.expand_path args.first
|
30
|
+
@application = File.dirname @wp_root
|
31
|
+
puts "Processing #{@wp_root} into a wpcap directory style"
|
32
|
+
unless File.exists? @wp_root + '/wp-load.php'
|
33
|
+
warn "This folder does not appear to be a wordpress directory. "
|
34
|
+
abort
|
35
|
+
end
|
38
36
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
37
|
+
FileUtils.mv @wp_root, @wp_root + "/app", :force => true
|
38
|
+
self.setup
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.setup
|
42
|
+
puts "Capifying your project and seting up config directories"
|
43
|
+
unless File.exists? "#{@app_dir}/wp-load.php"
|
44
|
+
warn "This does not Appear to be a wpcap project"
|
45
|
+
abort
|
46
|
+
end
|
47
|
+
|
48
|
+
self.capify(@wp_root)
|
49
|
+
|
50
|
+
FileUtils.mkdir_p "#{@wp_root}/config/deploy"
|
51
|
+
FileUtils.touch "#{@wp_root}/config/database.yml"
|
52
|
+
FileUtils.rm "#{@wp_root}/config/deploy.rb" if File.exists? "#{@wp_root}/config/deploy.rb"
|
53
|
+
FileUtils.cp "#{File.dirname(__FILE__)}/recipes/templates/deploy.rb.erb" , "#{@wp_root}/config/deploy.rb"
|
54
|
+
FileUtils.cp "#{File.dirname(__FILE__)}/recipes/templates/deploy_stage.rb.erb", "#{@wp_root}/config/deploy/staging.rb"
|
55
|
+
FileUtils.cp "#{File.dirname(__FILE__)}/recipes/templates/deploy_stage.rb.erb", "#{@wp_root}/config/deploy/production.rb"
|
56
|
+
|
57
|
+
puts "You are all Done, begin building your wordpress site in the app directory!"
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.help(cmd)
|
61
|
+
puts "`#{cmd}` is not a wpcap command."
|
62
|
+
puts "See `wpcap help` for a list of available commands."
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def self.install_wordpress(path)
|
68
|
+
unless Dir.exists?("/tmp/wordpress")
|
69
|
+
puts 'Downloading latest WordPress (en_US)...'
|
70
|
+
Net::HTTP.start("wordpress.org") do |http|
|
71
|
+
resp = http.get("/latest.tar.gz")
|
72
|
+
open("/tmp/latest.tar.gz", "wb") do |file|
|
73
|
+
file.write(resp.body)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
`tar -zxf /tmp/latest.tar.gz`
|
77
|
+
puts 'WordPress downloaded and extracted.'
|
78
|
+
end
|
79
|
+
|
80
|
+
FileUtils.mv "/tmp/wordpress/", "#{path}", :force => true
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.capify(path)
|
85
|
+
|
86
|
+
ARGV[0] = @wp_root
|
87
|
+
version = ">= 0"
|
88
|
+
|
89
|
+
gem 'capistrano', version
|
90
|
+
load Gem.bin_path('capistrano', 'capify', version)
|
48
91
|
end
|
49
|
-
|
50
|
-
`capify #{@wp_root}`
|
51
|
-
`touch #{@wp_root}/config/database.yml`
|
52
|
-
`rm #{@wp_root}/config/deploy.rb`
|
53
|
-
`cp #{File.dirname(__FILE__)}/recipes/templates/deploy.rb.erb #{@wp_root}/config/deploy.rb`
|
54
|
-
`mkdir -p #{@wp_root}/config/deploy`
|
55
|
-
`cp #{File.dirname(__FILE__)}/recipes/templates/deploy-stage.rb.erb #{@wp_root}/config/deploy/staging.rb`
|
56
|
-
`cp #{File.dirname(__FILE__)}/recipes/templates/deploy-stage.rb.erb #{@wp_root}/config/deploy/production.rb`
|
57
|
-
|
58
|
-
end
|
59
|
-
|
60
|
-
def self.help(cmd)
|
61
|
-
puts "`#{cmd}` is not a wpcap command."
|
62
|
-
puts "See `wpcap help` for a list of available commands."
|
63
92
|
end
|
64
|
-
end
|
93
|
+
end
|
File without changes
|
@@ -88,6 +88,7 @@ configuration.load do
|
|
88
88
|
task :symlink, :roles => :web, :except => { :no_release => true } do
|
89
89
|
run "ln -nfs #{shared_path}/uploads #{latest_release}/app/#{uploads_path}"
|
90
90
|
run "ln -nfs #{shared_path}/cache #{latest_release}/app/wp-content/cache"
|
91
|
+
run "rm #{shared_path}/config/nginx.conf"
|
91
92
|
run "ln -nfs #{shared_path}/config/nginx.conf #{latest_release}/app/nginx.conf"
|
92
93
|
end
|
93
94
|
|
data/lib/wpcap/version.rb
CHANGED
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'fakefs'
|
3
|
+
require 'wpcap/command'
|
4
|
+
|
5
|
+
|
6
|
+
module Wpcap
|
7
|
+
describe Command do
|
8
|
+
|
9
|
+
before :all do
|
10
|
+
puts "Preparing FakeFs for Tests"
|
11
|
+
wpcap_dir = File.expand_path "#{File.dirname(__FILE__)}../../../"
|
12
|
+
FakeFS::FileSystem.clone(wpcap_dir)
|
13
|
+
end
|
14
|
+
|
15
|
+
before :each do
|
16
|
+
Wpcap::Command.stub!(:capify).and_return(true)
|
17
|
+
FileUtils.rm_r "/tmp/google" if Dir.exists? "/tmp/google"
|
18
|
+
stub_request(:get, "http://wordpress.org/latest.tar.gz").
|
19
|
+
with(:headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
|
20
|
+
to_return(:status => 200, :body => "", :headers => {})
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
describe :create do
|
25
|
+
subject { Wpcap::Command.create(["google","/tmp"]) }
|
26
|
+
|
27
|
+
it "creates an project directory at the passed in path" do
|
28
|
+
prep_fake_wordpress(:new)
|
29
|
+
|
30
|
+
subject
|
31
|
+
Dir.exists?("/tmp/google").should eq true
|
32
|
+
Dir.exists?("/tmp/google/app").should eq true
|
33
|
+
end
|
34
|
+
|
35
|
+
it "has a new valid wordpress install " do
|
36
|
+
prep_fake_wordpress(:new)
|
37
|
+
subject
|
38
|
+
File.exists?("/tmp/google/app/wp-load.php").should eq true
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe :build do
|
43
|
+
subject { Wpcap::Command.build(["google"]) }
|
44
|
+
it "responds to the create command" do
|
45
|
+
|
46
|
+
Wpcap::Command.respond_to?(:build).should eq true
|
47
|
+
end
|
48
|
+
|
49
|
+
it "creates an project directory at the passed in path" do
|
50
|
+
prep_fake_wordpress(:existing)
|
51
|
+
subject
|
52
|
+
Dir.exists?("/tmp/google").should eq true
|
53
|
+
Dir.exists?("/tmp/google/app").should eq true
|
54
|
+
File.exists?("/tmp/google/app/wp-load.php").should eq true
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
def prep_fake_wordpress(type)
|
63
|
+
FileUtils.mkdir_p "/tmp/wordpress"
|
64
|
+
FileUtils.cp_r "spec/test_payloads/#{type}/." , "/tmp/wordpress"
|
65
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
|
7
|
+
Bundler.require(:default, :development)
|
8
|
+
require 'webmock/rspec'
|
9
|
+
|
10
|
+
# Requires supporting files with custom matchers and macros, etc,
|
11
|
+
# in ./support/ and its subdirectories.
|
12
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
13
|
+
|
14
|
+
#Run Once For Group (trying to speed things up. )
|
15
|
+
|
16
|
+
|
17
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
18
|
+
RSpec.configure do |config|
|
19
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
20
|
+
config.run_all_when_everything_filtered = true
|
21
|
+
#config.filter_run :focus
|
22
|
+
|
23
|
+
# Run specs in random order to surface order dependencies. If you find an
|
24
|
+
# order dependency and want to debug it, you can fix the order by providing
|
25
|
+
# the seed, which is printed after each run.
|
26
|
+
# --seed 1234
|
27
|
+
config.order = 'random'
|
28
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* The base configurations of the WordPress.
|
4
|
+
*
|
5
|
+
* This file has the following configurations: MySQL settings, Table Prefix,
|
6
|
+
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
|
7
|
+
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
|
8
|
+
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
|
9
|
+
*
|
10
|
+
* This file is used by the wp-config.php creation script during the
|
11
|
+
* installation. You don't have to use the web site, you can just copy this file
|
12
|
+
* to "wp-config.php" and fill in the values.
|
13
|
+
*
|
14
|
+
* @package WordPress
|
15
|
+
*/
|
16
|
+
|
17
|
+
// ** MySQL settings - You can get this info from your web host ** //
|
18
|
+
/** The name of the database for WordPress */
|
19
|
+
define('DB_NAME', 'database_name_here');
|
20
|
+
|
21
|
+
/** MySQL database username */
|
22
|
+
define('DB_USER', 'username_here');
|
23
|
+
|
24
|
+
/** MySQL database password */
|
25
|
+
define('DB_PASSWORD', 'password_here');
|
26
|
+
|
27
|
+
/** MySQL hostname */
|
28
|
+
define('DB_HOST', 'localhost');
|
29
|
+
|
30
|
+
/** Database Charset to use in creating database tables. */
|
31
|
+
define('DB_CHARSET', 'utf8');
|
32
|
+
|
33
|
+
/** The Database Collate type. Don't change this if in doubt. */
|
34
|
+
define('DB_COLLATE', '');
|
35
|
+
|
36
|
+
/**#@+
|
37
|
+
* Authentication Unique Keys and Salts.
|
38
|
+
*
|
39
|
+
* Change these to different unique phrases!
|
40
|
+
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
|
41
|
+
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
|
42
|
+
*
|
43
|
+
* @since 2.6.0
|
44
|
+
*/
|
45
|
+
define('AUTH_KEY', 'put your unique phrase here');
|
46
|
+
define('SECURE_AUTH_KEY', 'put your unique phrase here');
|
47
|
+
define('LOGGED_IN_KEY', 'put your unique phrase here');
|
48
|
+
define('NONCE_KEY', 'put your unique phrase here');
|
49
|
+
define('AUTH_SALT', 'put your unique phrase here');
|
50
|
+
define('SECURE_AUTH_SALT', 'put your unique phrase here');
|
51
|
+
define('LOGGED_IN_SALT', 'put your unique phrase here');
|
52
|
+
define('NONCE_SALT', 'put your unique phrase here');
|
53
|
+
|
54
|
+
/**#@-*/
|
55
|
+
|
56
|
+
/**
|
57
|
+
* WordPress Database Table prefix.
|
58
|
+
*
|
59
|
+
* You can have multiple installations in one database if you give each a unique
|
60
|
+
* prefix. Only numbers, letters, and underscores please!
|
61
|
+
*/
|
62
|
+
$table_prefix = 'wp_';
|
63
|
+
|
64
|
+
/**
|
65
|
+
* WordPress Localized Language, defaults to English.
|
66
|
+
*
|
67
|
+
* Change this to localize WordPress. A corresponding MO file for the chosen
|
68
|
+
* language must be installed to wp-content/languages. For example, install
|
69
|
+
* de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
|
70
|
+
* language support.
|
71
|
+
*/
|
72
|
+
define('WPLANG', '');
|
73
|
+
|
74
|
+
/**
|
75
|
+
* For developers: WordPress debugging mode.
|
76
|
+
*
|
77
|
+
* Change this to true to enable the display of notices during development.
|
78
|
+
* It is strongly recommended that plugin and theme developers use WP_DEBUG
|
79
|
+
* in their development environments.
|
80
|
+
*/
|
81
|
+
define('WP_DEBUG', false);
|
82
|
+
|
83
|
+
/* That's all, stop editing! Happy blogging. */
|
84
|
+
|
85
|
+
/** Absolute path to the WordPress directory. */
|
86
|
+
if ( !defined('ABSPATH') )
|
87
|
+
define('ABSPATH', dirname(__FILE__) . '/');
|
88
|
+
|
89
|
+
/** Sets up WordPress vars and included files. */
|
90
|
+
require_once(ABSPATH . 'wp-settings.php');
|
@@ -0,0 +1,63 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* Bootstrap file for setting the ABSPATH constant
|
4
|
+
* and loading the wp-config.php file. The wp-config.php
|
5
|
+
* file will then load the wp-settings.php file, which
|
6
|
+
* will then set up the WordPress environment.
|
7
|
+
*
|
8
|
+
* If the wp-config.php file is not found then an error
|
9
|
+
* will be displayed asking the visitor to set up the
|
10
|
+
* wp-config.php file.
|
11
|
+
*
|
12
|
+
* Will also search for wp-config.php in WordPress' parent
|
13
|
+
* directory to allow the WordPress directory to remain
|
14
|
+
* untouched.
|
15
|
+
*
|
16
|
+
* @internal This file must be parsable by PHP4.
|
17
|
+
*
|
18
|
+
* @package WordPress
|
19
|
+
*/
|
20
|
+
|
21
|
+
/** Define ABSPATH as this file's directory */
|
22
|
+
define( 'ABSPATH', dirname(__FILE__) . '/' );
|
23
|
+
|
24
|
+
error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
|
25
|
+
|
26
|
+
if ( file_exists( ABSPATH . 'wp-config.php') ) {
|
27
|
+
|
28
|
+
/** The config file resides in ABSPATH */
|
29
|
+
require_once( ABSPATH . 'wp-config.php' );
|
30
|
+
|
31
|
+
} elseif ( file_exists( dirname(ABSPATH) . '/wp-config.php' ) && ! file_exists( dirname(ABSPATH) . '/wp-settings.php' ) ) {
|
32
|
+
|
33
|
+
/** The config file resides one level above ABSPATH but is not part of another install */
|
34
|
+
require_once( dirname(ABSPATH) . '/wp-config.php' );
|
35
|
+
|
36
|
+
} else {
|
37
|
+
|
38
|
+
// A config file doesn't exist
|
39
|
+
|
40
|
+
// Set a path for the link to the installer
|
41
|
+
if ( strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false )
|
42
|
+
$path = 'setup-config.php';
|
43
|
+
else
|
44
|
+
$path = 'wp-admin/setup-config.php';
|
45
|
+
|
46
|
+
define( 'WPINC', 'wp-includes' );
|
47
|
+
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
|
48
|
+
require_once( ABSPATH . WPINC . '/load.php' );
|
49
|
+
require_once( ABSPATH . WPINC . '/version.php' );
|
50
|
+
|
51
|
+
wp_check_php_mysql_versions();
|
52
|
+
wp_load_translations_early();
|
53
|
+
|
54
|
+
require_once( ABSPATH . WPINC . '/functions.php' );
|
55
|
+
|
56
|
+
// Die with an error message
|
57
|
+
$die = __( "There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started." ) . '</p>';
|
58
|
+
$die .= '<p>' . __( "Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>." ) . '</p>';
|
59
|
+
$die .= '<p>' . __( "You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file." ) . '</p>';
|
60
|
+
$die .= '<p><a href="' . $path . '" class="button">' . __( "Create a Configuration File" ) . '</a>';
|
61
|
+
|
62
|
+
wp_die( $die, __( 'WordPress › Error' ) );
|
63
|
+
}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* Bootstrap file for setting the ABSPATH constant
|
4
|
+
* and loading the wp-config.php file. The wp-config.php
|
5
|
+
* file will then load the wp-settings.php file, which
|
6
|
+
* will then set up the WordPress environment.
|
7
|
+
*
|
8
|
+
* If the wp-config.php file is not found then an error
|
9
|
+
* will be displayed asking the visitor to set up the
|
10
|
+
* wp-config.php file.
|
11
|
+
*
|
12
|
+
* Will also search for wp-config.php in WordPress' parent
|
13
|
+
* directory to allow the WordPress directory to remain
|
14
|
+
* untouched.
|
15
|
+
*
|
16
|
+
* @internal This file must be parsable by PHP4.
|
17
|
+
*
|
18
|
+
* @package WordPress
|
19
|
+
*/
|
20
|
+
|
21
|
+
/** Define ABSPATH as this file's directory */
|
22
|
+
define( 'ABSPATH', dirname(__FILE__) . '/' );
|
23
|
+
|
24
|
+
error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
|
25
|
+
|
26
|
+
if ( file_exists( ABSPATH . 'wp-config.php') ) {
|
27
|
+
|
28
|
+
/** The config file resides in ABSPATH */
|
29
|
+
require_once( ABSPATH . 'wp-config.php' );
|
30
|
+
|
31
|
+
} elseif ( file_exists( dirname(ABSPATH) . '/wp-config.php' ) && ! file_exists( dirname(ABSPATH) . '/wp-settings.php' ) ) {
|
32
|
+
|
33
|
+
/** The config file resides one level above ABSPATH but is not part of another install */
|
34
|
+
require_once( dirname(ABSPATH) . '/wp-config.php' );
|
35
|
+
|
36
|
+
} else {
|
37
|
+
|
38
|
+
// A config file doesn't exist
|
39
|
+
|
40
|
+
// Set a path for the link to the installer
|
41
|
+
if ( strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false )
|
42
|
+
$path = 'setup-config.php';
|
43
|
+
else
|
44
|
+
$path = 'wp-admin/setup-config.php';
|
45
|
+
|
46
|
+
define( 'WPINC', 'wp-includes' );
|
47
|
+
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
|
48
|
+
require_once( ABSPATH . WPINC . '/load.php' );
|
49
|
+
require_once( ABSPATH . WPINC . '/version.php' );
|
50
|
+
|
51
|
+
wp_check_php_mysql_versions();
|
52
|
+
wp_load_translations_early();
|
53
|
+
|
54
|
+
require_once( ABSPATH . WPINC . '/functions.php' );
|
55
|
+
|
56
|
+
// Die with an error message
|
57
|
+
$die = __( "There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started." ) . '</p>';
|
58
|
+
$die .= '<p>' . __( "Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>." ) . '</p>';
|
59
|
+
$die .= '<p>' . __( "You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file." ) . '</p>';
|
60
|
+
$die .= '<p><a href="' . $path . '" class="button">' . __( "Create a Configuration File" ) . '</a>';
|
61
|
+
|
62
|
+
wp_die( $die, __( 'WordPress › Error' ) );
|
63
|
+
}
|
data/wpcap.gemspec
CHANGED
@@ -16,4 +16,11 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.version = Wpcap::VERSION
|
17
17
|
gem.add_dependency('capistrano')
|
18
18
|
gem.add_dependency('railsless-deploy')
|
19
|
+
gem.add_dependency('thor')
|
20
|
+
gem.add_development_dependency('guard')
|
21
|
+
gem.add_development_dependency('guard-rspec')
|
22
|
+
gem.add_development_dependency('webmock')
|
23
|
+
gem.add_development_dependency('rb-fsevent')
|
24
|
+
gem.add_development_dependency('rspec')
|
25
|
+
gem.add_development_dependency('fakefs')
|
19
26
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wpcap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
@@ -43,6 +43,118 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: thor
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: guard
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: guard-rspec
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: webmock
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rb-fsevent
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: rspec
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: fakefs
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ! '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
type: :development
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
46
158
|
description: A Tool to Setup, Maintain, and Deploy Capistrano Driven Wordpress Sites
|
47
159
|
email:
|
48
160
|
- russell@burningpony.com
|
@@ -52,7 +164,9 @@ extensions: []
|
|
52
164
|
extra_rdoc_files: []
|
53
165
|
files:
|
54
166
|
- .gitignore
|
167
|
+
- .rspec
|
55
168
|
- Gemfile
|
169
|
+
- Guardfile
|
56
170
|
- LICENSE
|
57
171
|
- README.md
|
58
172
|
- Rakefile
|
@@ -68,8 +182,8 @@ files:
|
|
68
182
|
- lib/wpcap/recipes/nginx.rb
|
69
183
|
- lib/wpcap/recipes/php.rb
|
70
184
|
- lib/wpcap/recipes/server.rb
|
71
|
-
- lib/wpcap/recipes/templates/deploy-stage.rb.erb
|
72
185
|
- lib/wpcap/recipes/templates/deploy.rb.erb
|
186
|
+
- lib/wpcap/recipes/templates/deploy_stage.rb.erb
|
73
187
|
- lib/wpcap/recipes/templates/maintenance.html.erb
|
74
188
|
- lib/wpcap/recipes/templates/mysql.yml.erb
|
75
189
|
- lib/wpcap/recipes/templates/nginx_php.erb
|
@@ -79,6 +193,11 @@ files:
|
|
79
193
|
- lib/wpcap/recipes/wordpress.rb
|
80
194
|
- lib/wpcap/utility.rb
|
81
195
|
- lib/wpcap/version.rb
|
196
|
+
- spec/binary/wpcap_spec.rb
|
197
|
+
- spec/spec_helper.rb
|
198
|
+
- spec/test_payloads/existing/wp-config.php
|
199
|
+
- spec/test_payloads/existing/wp-load.php
|
200
|
+
- spec/test_payloads/new/wp-load.php
|
82
201
|
- wpcap.gemspec
|
83
202
|
homepage: https://github.com/rposborne/wpcap
|
84
203
|
licenses: []
|
@@ -105,4 +224,9 @@ signing_key:
|
|
105
224
|
specification_version: 3
|
106
225
|
summary: A Tool to Setup, Maintain, and Deploy Capistrano Driven Wordpress Sites on
|
107
226
|
any cloud server or linux macine
|
108
|
-
test_files:
|
227
|
+
test_files:
|
228
|
+
- spec/binary/wpcap_spec.rb
|
229
|
+
- spec/spec_helper.rb
|
230
|
+
- spec/test_payloads/existing/wp-config.php
|
231
|
+
- spec/test_payloads/existing/wp-load.php
|
232
|
+
- spec/test_payloads/new/wp-load.php
|