Class: WSlaveUpdate
- Inherits:
-
Object
- Object
- WSlaveUpdate
- Defined in:
- lib/wslave_update.rb
Instance Method Summary collapse
-
#initialize ⇒ WSlaveUpdate
constructor
A new instance of WSlaveUpdate.
Constructor Details
#initialize ⇒ WSlaveUpdate
Returns a new instance of WSlaveUpdate.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/wslave_update.rb', line 6 def initialize() puts '⚙ Updating Toolchain・・・' path = Dir.pwd if !File.exist?("#{path}/config/.wslave") puts "!!!This command must be run in a WSlave generated project!!!" return end base_path = File. "#{__dir__}/../base/" template_path = File. "#{__dir__}/../templates/" Dir.chdir path FileUtils.cp("#{base_path}/Capfile", "#{path}/Capfile") # FileUtils.cp("#{base_path}/Gemfile", "#{path}/Gemfile") FileUtils.cp("#{base_path}/Rakefile", "#{path}/Rakefile") FileUtils.cp_r("#{base_path}/docker", "#{path}/") FileUtils.cp("#{base_path}/docker-compose.yml", "#{path}/docker-compose.yml") FileUtils.cp("#{base_path}/public/.htaccess", "#{path}/public/.htaccess") FileUtils.cp("#{base_path}/public/wp-config.php", "#{path}/public/wp-config.php") FileUtils.cp_r(Dir.glob("#{base_path}/config/*"), "#{path}/config") FileUtils.cp("#{template_path}/config/database.yml", "#{path}/config/database.yml") unless File.exist? "#{path}/config/database.yml" FileUtils.cp("#{template_path}/config/definitions.yml", "#{path}/config/definitions.yml") unless File.exist? "#{path}/config/definitions.yml" spec = Gem::Specification::load("#{__dir__}/../wslave.gemspec") FileUtils.rm("#{path}/config/.wslave") File.open("#{path}/config/.wslave", 'w') {|f| f.write(spec.version)} Dir.chdir path WSlaveTools.set_dev_perms(path) end |