forked from onnimonni/dash
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce3ccad
commit 39adbc7
Showing
1 changed file
with
34 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -473,6 +473,8 @@ HEREDOC | |
|
||
#puts args.inspect | ||
|
||
themename=args['sitename'].tr('-',''); | ||
|
||
case args['type'] | ||
when "wordpress" | ||
# setup wordpress project | ||
|
@@ -483,9 +485,9 @@ HEREDOC | |
puts `git clone [email protected]:devgeniem/wp-project.git #{args['sitename']}` | ||
if args['theme'] | ||
puts "Cloning theme from #{args['theme']}..." | ||
puts `git clone #{args['theme']} #{args['sitename']}/web/app/themes/#{args['sitename']}` | ||
puts `git clone #{args['theme']} #{args['sitename']}/web/app/themes/#{themename}` | ||
puts "Removing .git directory from theme..." | ||
`rm -rf #{args['sitename']}/web/app/themes/#{args['sitename']}/.git` | ||
`rm -rf #{args['sitename']}/web/app/themes/#{themename}/.git` | ||
puts "" | ||
else | ||
# TODO: get default theme url from ~/.gdev/gdevconf.yml | ||
|
@@ -507,27 +509,28 @@ HEREDOC | |
end | ||
} | ||
end | ||
# replace all THEMENAME and PROJECTNAME references from all files from this project to your project name | ||
# replace all THEMENAME (namespace) references from all files from this project to your project name | ||
puts "Replacing 'THEMENAME' strings from all project files with '#{args['sitename']}'..." | ||
themename_file_names = [ | ||
"#{args['sitename']}/.drone.yml", | ||
"#{args['sitename']}/config/application.php", | ||
"#{args['sitename']}/docker-compose.yml", | ||
"#{args['sitename']}/web/app/themes/#{args['sitename']}/lib/extras.php", | ||
"#{args['sitename']}/web/app/themes/#{args['sitename']}/lib/images.php", | ||
"#{args['sitename']}/web/app/themes/#{args['sitename']}/lib/setup.php", | ||
"#{args['sitename']}/web/app/themes/#{args['sitename']}/package.json", | ||
"#{args['sitename']}/web/app/themes/#{args['sitename']}/style.css" | ||
"#{args['sitename']}/web/app/themes/#{themename}/lib/extras.php", | ||
"#{args['sitename']}/web/app/themes/#{themename}/lib/images.php", | ||
"#{args['sitename']}/web/app/themes/#{themename}/lib/setup.php", | ||
"#{args['sitename']}/web/app/themes/#{themename}/package.json", | ||
"#{args['sitename']}/web/app/themes/#{themename}/style.css" | ||
] | ||
themename_file_names.each do |file_name| | ||
text = File.read(file_name) | ||
new_contents = text.gsub(/THEMENAME/, "#{args['sitename']}") | ||
# remove dashes from namespace strings | ||
new_contents = text.gsub(/THEMENAME/, "#{args['sitename'].tr('-','')}") | ||
File.open(file_name, "w") {|file| file.puts new_contents } | ||
end | ||
puts "Replacing 'themename-textdomain' strings from all project files with '#{args['sitename'].downcase}-td'..." | ||
textdomain_file_names = [ | ||
"#{args['sitename']}/web/app/themes/#{args['sitename']}/lib/setup.php", | ||
"#{args['sitename']}/web/app/themes/#{args['sitename']}/style.css" | ||
"#{args['sitename']}/web/app/themes/#{themename}/lib/setup.php", | ||
"#{args['sitename']}/web/app/themes/#{themename}/style.css" | ||
] | ||
textdomain_file_names.each do |file_name| | ||
text = File.read(file_name) | ||
|
@@ -562,28 +565,10 @@ HEREDOC | |
# install theme npm modules | ||
if args['npm_install'] | ||
puts "Installing theme node modules..." | ||
puts `cd #{args["sitename"]}/web/app/themes/#{args["sitename"]}; npm install` | ||
puts `cd #{args["sitename"]}/web/app/themes/#{themename}; npm install` | ||
puts "" | ||
end | ||
|
||
# TODO: seed (install wp) | ||
#puts "Waiting for 10 seconds to be sure that docker instances are up and running..." | ||
#sleep(10) | ||
#puts "Running scripts/seed.sh..." | ||
#puts `cd #{args["sitename"]}; gdev run web ./scripts/seed.sh` | ||
#puts "" | ||
|
||
# temporary fix for redis-cache plugin, remove this when plugin works | ||
#puts "Copying object-cache.php in place (temporary fix for redis-cache plugin)..." | ||
#`cp #{args["sitename"]}/web/app/object-cache.php #{args["sitename"]}/web/app/plugins/redis-cache/includes` | ||
#puts "" | ||
|
||
|
||
# gdev reload | ||
#puts "Reloading gdev..." | ||
#puts `cd #{args["sitename"]}; gdev reload` | ||
#puts "" | ||
|
||
# set git repository | ||
if args['git'] == "" | ||
puts "NO GIT REPOSITORY GIVEN!" | ||
|
@@ -599,6 +584,16 @@ HEREDOC | |
puts `cd #{args["sitename"]}; gdev up` | ||
puts "" | ||
|
||
# running seed | ||
if args['run_seed'] | ||
puts "Waiting for 10 seconds to be sure that docker instances are up and running..." | ||
sleep(10) | ||
puts "" | ||
puts "Running seed (Installing WordPress)..." | ||
puts `cd #{args["sitename"]}; gdev exec scripts/seed.sh` | ||
puts "" | ||
end | ||
|
||
puts "Point your browser to https://#{args['sitename'].downcase}.test/wp-admin and log in" | ||
|
||
# TODO: help for setting up stage and production | ||
|
@@ -711,6 +706,15 @@ HEREDOC | |
project['npm_install']=false | ||
end | ||
puts "" | ||
# run seed after setup? | ||
puts "Run seed after installation? (Y/N)" | ||
run_seed=gets.chomp | ||
if ['Y','y'].include?(run_seed) | ||
project['run_seed']=true | ||
else | ||
project['run_seed']=false | ||
end | ||
puts "" | ||
# set stage cluster domain | ||
if defaults['stage'] | ||
puts "Flynn stage cloud address ("+defaults['stage']+default_marker+"):" | ||
|