wpmake 0.0.1
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/CHANGELOG +3 -0
- data/Gemfile +0 -0
- data/README.md +2 -0
- data/Rakefile +1 -0
- data/bin/wpmake +9 -0
- data/lib/wpmake/bootstrap.rb +123 -0
- data/lib/wpmake/text_helpers.rb +41 -0
- data/lib/wpmake/version.rb +3 -0
- data/pagodafiles/Boxfile +19 -0
- data/pagodafiles/wp-config.php +90 -0
- data/spec/bootstrap_spec.rb +0 -0
- data/spec/spec_helper.rb +0 -0
- data/wpmake.gemspec +22 -0
- metadata +61 -0
data/CHANGELOG
ADDED
data/Gemfile
ADDED
File without changes
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/wpmake
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
if File.symlink?("/usr/local/bin/wpmake")
|
4
|
+
require File.expand_path(File.dirname(File.readlink("/usr/local/bin/wpmake")) + "/../lib/wpmake/text_helpers")
|
5
|
+
require File.expand_path(File.dirname(File.readlink("/usr/local/bin/wpmake")) + "/../lib/wpmake/bootstrap")
|
6
|
+
else
|
7
|
+
require File.expand_path('../../lib/WPmake/text_helpers', __FILE__)
|
8
|
+
require File.expand_path('../../lib/WPmake/bootstrap', __FILE__)
|
9
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require 'pp'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
module WPMake
|
6
|
+
class Bootstrap
|
7
|
+
include WPMake::TextHelpers
|
8
|
+
|
9
|
+
attr_reader :site_title
|
10
|
+
attr_reader :banner
|
11
|
+
attr_reader :remote_provider
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
@site_title = ARGV[0]
|
15
|
+
@banner = "Usage: wpmake [site name]"
|
16
|
+
@remote_provider ||= "pagoda"
|
17
|
+
end
|
18
|
+
|
19
|
+
def routine
|
20
|
+
require_site_name
|
21
|
+
check_dependency_presence
|
22
|
+
check_dependency_versions
|
23
|
+
|
24
|
+
directory_setup
|
25
|
+
provider_setup
|
26
|
+
end
|
27
|
+
|
28
|
+
def require_site_name
|
29
|
+
if @site_title.nil?
|
30
|
+
abort(@banner)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def check_dependency_presence
|
35
|
+
begin
|
36
|
+
check_ruby = `ruby -v`
|
37
|
+
check_mysql = `mysql -V`
|
38
|
+
check_php = `php -v`
|
39
|
+
check_wget = `wget -V`
|
40
|
+
check_pagoda = `pagoda --version`
|
41
|
+
rescue Errno::ENOENT
|
42
|
+
missing_dependency = "#{$!}".split(/-/)[1]
|
43
|
+
exit_msg = "#{missing_dependency} not installed!"
|
44
|
+
|
45
|
+
if missing_dependency.match(/ruby/)
|
46
|
+
exit_msg = exit_msg + WPMake::TextHelpers::RUBY_INSTALL_MSG
|
47
|
+
elsif missing_dependency.match(/mysql/)
|
48
|
+
exit_msg = exit_msg + WPMake::TextHelpers::MYSQL_INSTALL_MSG
|
49
|
+
elsif missing_dependency.match(/php/)
|
50
|
+
exit_msg = exit_msg + WPMake::TextHelpers::PHP_INSTALL_MSG
|
51
|
+
elsif missing_dependency.match(/wget/)
|
52
|
+
exit_msg = exit_msg + WPMake::TextHelpers::WGET_INSTALL_MSG
|
53
|
+
elsif missing_dependency.match(/pagoda/)
|
54
|
+
exit_msg = exit_msg + WPMake::TextHelpers::PAGODA_INSTALL_MSG
|
55
|
+
end
|
56
|
+
|
57
|
+
abort(exit_msg)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def check_dependency_versions
|
62
|
+
puts "Checking dependency versions..."
|
63
|
+
ruby_version = `ruby -v`.split(/ /)[1]
|
64
|
+
mysql_version = `mysql -V`.split(/ /)[5].gsub(/,/, "")
|
65
|
+
php_version = `php -v`.split(/ /)[1]
|
66
|
+
php_major_version = php_version.split(/\./)[0..1].join("").to_i
|
67
|
+
mysql_major_version = mysql_version.split(/\./)[0].to_i
|
68
|
+
|
69
|
+
puts "Ruby version: #{ruby_version}... ok!"
|
70
|
+
if mysql_major_version >= 5
|
71
|
+
puts "Mysql version: #{mysql_version}... ok!"
|
72
|
+
else
|
73
|
+
abort(WPMake::TextHelpers::MYSQL_UPGRADE_MSG)
|
74
|
+
end
|
75
|
+
if php_major_version > 43
|
76
|
+
puts "PHP version: #{php_version}... ok!"
|
77
|
+
else
|
78
|
+
abort(WPMake::TextHelpers::PHP_UPGRADE_MSG)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def directory_setup
|
83
|
+
pwd = `pwd`.strip + "/" + @site_title
|
84
|
+
wp_latest_url = "http://wordpress.org/latest.zip"
|
85
|
+
|
86
|
+
FileUtils.mkdir(pwd)
|
87
|
+
`wget -P #{@site_title} #{wp_latest_url}`
|
88
|
+
`unzip #{@site_title}/latest.zip -d #{@site_title}`
|
89
|
+
FileUtils.mv(Dir.glob("#{@site_title}/wordpress/*"), "#{@site_title}")
|
90
|
+
FileUtils.rm_rf("#{@site_title}/wordpress")
|
91
|
+
end
|
92
|
+
|
93
|
+
def provider_setup
|
94
|
+
if @remote_provider == "pagoda"
|
95
|
+
working_dir = `pwd`.strip + "/#{@site_title}"
|
96
|
+
pagoda_dir = "#{working_dir}/pagoda"
|
97
|
+
|
98
|
+
puts "Copying config files..."
|
99
|
+
`cp #{File.expand_path("../../../pagodafiles/Boxfile", __FILE__)} #{@site_title}`
|
100
|
+
FileUtils.mkdir(pagoda_dir)
|
101
|
+
`cp #{File.expand_path("../../../pagodafiles/wp-config.php", __FILE__)} #{@site_title}/pagoda`
|
102
|
+
|
103
|
+
puts "Initializing git repo..."
|
104
|
+
Dir.chdir(working_dir)
|
105
|
+
`git init`
|
106
|
+
`git add .`
|
107
|
+
`git commit -am "Initial commit"`
|
108
|
+
|
109
|
+
puts "Creating empty repository at pagoda box..."
|
110
|
+
`pagoda create dba-#{@site_title}`
|
111
|
+
|
112
|
+
puts "Pushing to pagoda box..."
|
113
|
+
`git push pagoda master`
|
114
|
+
else
|
115
|
+
# do stuff for other providers
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
make = WPMake::Bootstrap.new
|
123
|
+
make.routine
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module WPMake
|
2
|
+
module TextHelpers
|
3
|
+
RUBY_INSTALL_MSG =
|
4
|
+
"\nTo install:
|
5
|
+
\n1) brew install curl
|
6
|
+
\n2) bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
|
7
|
+
\n3) add this to the BOTTOM of your ~/.bashrc (or ~/.zshrc):\n" +
|
8
|
+
' [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"' +
|
9
|
+
"\n4) . ~/.bashrc
|
10
|
+
\n5) rvm install 1.9.3 --with-gcc=clang"
|
11
|
+
MYSQL_INSTALL_MSG =
|
12
|
+
"\nTo install:
|
13
|
+
\nbrew update
|
14
|
+
\nbrew install mysql"
|
15
|
+
PHP_INSTALL_MSG =
|
16
|
+
"\nTo install:
|
17
|
+
\n brew update
|
18
|
+
\nbrew tap homebrew/dupes
|
19
|
+
\nbrew tap josegonzalez/homebrew-php
|
20
|
+
\nbrew install php54
|
21
|
+
\n*** if you need custom modules or whatever run: brew options php54"
|
22
|
+
WGET_INSTALL_MSG =
|
23
|
+
"\nTo install:
|
24
|
+
\nbrew update
|
25
|
+
\nbrew install wget"
|
26
|
+
PAGODA_INSTALL_MSG =
|
27
|
+
"\nTo install:
|
28
|
+
\nsudo gem install pagoda"
|
29
|
+
|
30
|
+
MYSQL_UPGRADE_MSG =
|
31
|
+
"\nTo upgrade MySQL:
|
32
|
+
\nbrew update
|
33
|
+
\nbrew upgrade mysql OR brew install mysql"
|
34
|
+
PHP_UPGRADE_MSG =
|
35
|
+
"\nTo upgrade PHP:
|
36
|
+
\nbrew update
|
37
|
+
\nbrew tap homebrew/dupes
|
38
|
+
\nbrew tap josegonzalez/homebrew-php
|
39
|
+
\nbrew install php54"
|
40
|
+
end
|
41
|
+
end
|
data/pagodafiles/Boxfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
web1:
|
2
|
+
name: wp-web
|
3
|
+
shared_writable_dirs:
|
4
|
+
- wp-content/uploads/
|
5
|
+
php_version: 5.3.8
|
6
|
+
php_extensions:
|
7
|
+
- mysql
|
8
|
+
- gd
|
9
|
+
- curl
|
10
|
+
- json
|
11
|
+
- imagick
|
12
|
+
- magickwand
|
13
|
+
- mbstring
|
14
|
+
php_display_errors: "1"
|
15
|
+
after_build:
|
16
|
+
- "mv pagoda/wp-config.php wp-config.php"
|
17
|
+
db1:
|
18
|
+
name: wp-db
|
19
|
+
type: mysql
|
@@ -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', $_SERVER["DB1_NAME"]);
|
20
|
+
|
21
|
+
/** MySQL database username */
|
22
|
+
define('DB_USER', $_SERVER["DB1_USER"]);
|
23
|
+
|
24
|
+
/** MySQL database password */
|
25
|
+
define('DB_PASSWORD', $_SERVER["DB1_PASS"]);
|
26
|
+
|
27
|
+
/** MySQL hostname */
|
28
|
+
define('DB_HOST', $_SERVER["DB1_HOST"]);
|
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', 'CZXqM3v7WG1Xg,W)zj(0/%g=nS;.W6$AWdU0NctIoUhl]17(7Wu_eZbQy^2+MJxj');
|
46
|
+
define('SECURE_AUTH_KEY', '_aBS&c?Y[UhSd~Ifm*&cM)kV8}L/q-N(M1n}5/c)k7GQ!d!j@XP5JoHho*x8^nuU');
|
47
|
+
define('LOGGED_IN_KEY', '-hdA}nu~x_UL,O:zXtr7LgC~20679M/y4}HKY/Y 7O.m(<i+l60-=a&l89*;(e_o');
|
48
|
+
define('NONCE_KEY', 'jGYrCMkk]0Cm/oiT5_b_(ykYv]<5Ez ?w:;*p#Ga=li:HRmwjAvX_VH]0=BTN^XY');
|
49
|
+
define('AUTH_SALT', '!W%^P4QSn[s+y(Do`;SdvK S+?`,V`6K2+8xsTeAnHG4]T;3KikJJ00 #3F =<Z(');
|
50
|
+
define('SECURE_AUTH_SALT', '5GFYpUPex.81bS{=S0SCC-%e ~-//YUl[Y@(/k24`1c]71CXxQaZSL0X`*>_|x;U');
|
51
|
+
define('LOGGED_IN_SALT', 'ih2o:)(Kg}8*Ym)%42D;7_RnZ*P&NgSzyfzVoK^kmz+-m4J=sr4(h?IJ!CkKc,RV');
|
52
|
+
define('NONCE_SALT', 'n_cy./u^U l6-#Xzn3g%n*%#m#HoO=Pl:8:6KiFmhhW(FlS#anjX/8)6B9nm5R4d');
|
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');
|
File without changes
|
data/spec/spec_helper.rb
ADDED
File without changes
|
data/wpmake.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "wpmake/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "wpmake"
|
7
|
+
s.version = WPMake::VERSION
|
8
|
+
s.authors = ["Alan Sebastian"]
|
9
|
+
s.email = ["asebastian2@gmail.com"]
|
10
|
+
s.homepage = "http://github.com/asebastian/wpmake"
|
11
|
+
s.summary = %q{Makes wordpress install}
|
12
|
+
s.description = %q{Makes a fresh wordpress install with some defaults}
|
13
|
+
|
14
|
+
#s.rubyforge_project = "wpmake"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
end
|
22
|
+
|
metadata
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: wpmake
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Alan Sebastian
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-11-01 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Makes a fresh wordpress install with some defaults
|
15
|
+
email:
|
16
|
+
- asebastian2@gmail.com
|
17
|
+
executables:
|
18
|
+
- wpmake
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- CHANGELOG
|
23
|
+
- Gemfile
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- bin/wpmake
|
27
|
+
- lib/wpmake/bootstrap.rb
|
28
|
+
- lib/wpmake/text_helpers.rb
|
29
|
+
- lib/wpmake/version.rb
|
30
|
+
- pagodafiles/Boxfile
|
31
|
+
- pagodafiles/wp-config.php
|
32
|
+
- spec/bootstrap_spec.rb
|
33
|
+
- spec/spec_helper.rb
|
34
|
+
- wpmake.gemspec
|
35
|
+
homepage: http://github.com/asebastian/wpmake
|
36
|
+
licenses: []
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options: []
|
39
|
+
require_paths:
|
40
|
+
- lib
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
none: false
|
49
|
+
requirements:
|
50
|
+
- - ! '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
requirements: []
|
54
|
+
rubyforge_project:
|
55
|
+
rubygems_version: 1.8.24
|
56
|
+
signing_key:
|
57
|
+
specification_version: 3
|
58
|
+
summary: Makes wordpress install
|
59
|
+
test_files:
|
60
|
+
- spec/bootstrap_spec.rb
|
61
|
+
- spec/spec_helper.rb
|