Skip to content

Commit

Permalink
textdomain replaces to theme
Browse files Browse the repository at this point in the history
  • Loading branch information
villepietarinen committed Apr 5, 2017
1 parent 5f88115 commit d9c8b54
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions bin/gdev
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,15 @@ HEREDOC
new_contents = text.gsub(/THEMENAME/, "#{args['sitename']}")
File.open(file_name, "w") {|file| file.puts new_contents }
end
textdomain_file_names = [
"#{args['sitename']}/web/app/themes/#{args['sitename']}/lib/setup.php",
"#{args['sitename']}/web/app/themes/#{args['sitename']}/style.css"
]
textdomain_file_names.each do |file_name|
text = File.read(file_name)
new_contents = text.gsub(/themename-textdomain/, "#{args['sitename'].downcase}-textdomain")
File.open(file_name, "w") {|file| file.puts new_contents }
end
projectname_file_names = [
"#{args['sitename']}/.drone.yml"
]
Expand All @@ -533,8 +542,6 @@ HEREDOC
File.open(file_name, "w") {|file| file.puts new_contents }
end

# TODO: replace themename-textdomain (lowercase) from lib/setup.php and style.css

# change project test address in docker-compose.yml for example wordpress.test -> client-name.test
docker_compose = File.read("#{args['sitename']}/docker-compose.yml")
docker_compose_replace = docker_compose.gsub(/wordpress.test/, "#{args['sitename']}.test")
Expand Down Expand Up @@ -657,10 +664,10 @@ HEREDOC
project = Hash.new
puts "----------------------= Create new project =---------------------"

puts "Sitename (lowercase characters, dashes and numbers only):"
puts "Sitename (normal characters, dashes and numbers only):"
project['sitename']=gets.chomp
unless validate_string(project['sitename'])
puts "Sitename (lowercase characters, dashes and numbers only):"
puts "Sitename (normal characters, dashes and numbers only):"
project['sitename']=gets.chomp
end
puts ""
Expand Down

0 comments on commit d9c8b54

Please sign in to comment.