wslave 0.0.6 → 0.0.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0bd267fe6e85c5da4a8660d36415c40f543bd93
4
- data.tar.gz: a11f2db80b92c0327ae5aad246a926e1456d747d
3
+ metadata.gz: 9301533e2766b919d24287111a858a5a80d3a714
4
+ data.tar.gz: f057b59fe6c6c4ffafb07f3ec7da628e9e057233
5
5
  SHA512:
6
- metadata.gz: 75e1a7272015416635c401b615d5cd4bdc333cf23b08aacb3c280bc3824cc4687edf7302ee41450d2fcbd985f3d9b3ee75f3b2b6b834f4f1ebe52c86228f57c9
7
- data.tar.gz: 022ef2121be713f2c2886a6150be81dddbae26cf289e31af8960e773c3e6d268d3dcad48bb97bc57867bca114bb701b31766c0e1e50c46f98d48e9acfb2c1e05
6
+ metadata.gz: 2b581ee81a0d4a5ba975dd35c79f71e8ebbc9a16766907f25287a01034ad7677417e6aa762ab8668e98fea375e940d2be6896bae7480ded806dc00e1d2c47440
7
+ data.tar.gz: 79501ea3b87d441db67c4e71ccb4d60a0a62b1fc46a25888925fbdbc3ca7ff0d71721980d340d1d3c513978b1575cfa8af92486e08cf4dc49ad4fbd1b80e1c21
data/bin/wslave CHANGED
@@ -13,6 +13,13 @@ class WSlaveCLI < Thor
13
13
  WSlaveNew.new(real_path, options['version'])
14
14
  end
15
15
 
16
+ desc 'update', "Updates toolchain"
17
+ long_desc "Updates toolchain. Will not overwrite existing configuration files."
18
+ def update()
19
+ require_relative '../lib/wslave_update'
20
+ WSlaveUpdate.new()
21
+ end
22
+
16
23
  desc 'sage NAME', "Generate a theme with NAME"
17
24
  long_desc "Generates a theme base with sage in the themes directory with the given" \
18
25
  "NAME. A random name will be generated if you do not specify a NAME."
data/lib/wslave_new.rb CHANGED
@@ -6,14 +6,16 @@ class WSlaveNew
6
6
  def initialize(path, version)
7
7
  puts '⚙ Initializing Toolchain・・・'
8
8
 
9
- tc_path = File.expand_path "#{__dir__}/../base/"
9
+ base_path = File.expand_path "#{__dir__}/../base/"
10
+ template_path = File.expand_path "#{__dir__}/../templates/"
10
11
 
11
12
  FileUtils.mkdir_p path
12
13
 
13
14
  Dir.chdir path
14
15
 
15
16
  puts " > Setting up WordPress WSlave setup in: #{path}"
16
- FileUtils.cp_r Dir.glob("#{tc_path}/*"), path
17
+ FileUtils.cp_r Dir.glob("#{base_path}/*"), path
18
+ FileUtils.cp_r Dir.glob("#{template_path}/*"), path
17
19
 
18
20
  spec = Gem::Specification::load("#{__dir__}/../wslave.gemspec")
19
21
  File.open("#{path}/config/.wslave", 'w') {|f| f.write(spec.version)}
@@ -23,14 +25,19 @@ class WSlaveNew
23
25
  `cd #{path} && git submodule add git://github.com/WordPress/WordPress.git public/wordpress`
24
26
  `cd #{path}/public/wordpress && git checkout #{version}-branch` if version != ''
25
27
  `cd #{path} && git submodule update --init --recursive public/wordpress`
28
+
29
+ puts " > Preparing detached content directory"
26
30
  FileUtils.cp_r("#{path}/public/wordpress/wp-content", "#{path}/public/wp-content")
27
- FileUtils.mkdir("#{path}/public/wordpress/wp-content/uploads")
28
- FileUtils.touch("#{path}/public/wordpress/wp-content/uploads/.gitkeep")
29
- FileUtils.mkdir("#{path}/public/wordpress/wp-content/upgrade")
30
- FileUtils.touch("#{path}/public/wordpress/wp-content/upgrade/.gitkeep")
31
+ FileUtils.mkdir("#{path}/public/wp-content/uploads")
32
+ FileUtils.touch("#{path}/public/wp-content/uploads/.gitkeep")
33
+ FileUtils.mkdir("#{path}/public/wp-content/upgrade")
34
+ FileUtils.touch("#{path}/public/wp-content/upgrade/.gitkeep")
31
35
  Dir.chdir path
36
+
37
+ puts " > Setting permissions"
32
38
  WSlaveTools.set_dev_perms
33
39
 
34
40
  `cd #{path} && git add --all && git commit -am "Add and initialize WordPress#{version}"`
41
+ puts " > Done!"
35
42
  end
36
43
  end
@@ -0,0 +1,37 @@
1
+ require 'fileutils'
2
+ require 'rubygems'
3
+ require_relative 'wslave_tools'
4
+
5
+ class WSlaveUpdate
6
+ def initialize()
7
+ puts '⚙ Updating Toolchain・・・'
8
+
9
+ path = Dir.pwd
10
+ if !File.exist?("#{path}/config/.wslave")
11
+ puts "!!!This command must be run in a WSlave generated project!!!"
12
+ return
13
+ end
14
+
15
+ base_path = File.expand_path "#{__dir__}/../base/"
16
+ template_path = File.expand_path "#{__dir__}/../templates/"
17
+
18
+
19
+ Dir.chdir path
20
+
21
+ FileUtils.cp("#{base_path}/Capfile", "#{path}/Capfile")
22
+ FileUtils.cp("#{base_path}/Gemfile", "#{path}/Gemfile")
23
+ FileUtils.cp("#{base_path}/Rakefile", "#{path}/Rakefile")
24
+ FileUtils.cp("#{base_path}/Dockerfile", "#{path}/Dockerfile")
25
+ FileUtils.cp("#{base_path}/docker-compose.yml", "#{path}/docker-compose.yml")
26
+ FileUtils.cp_r(Dir.glob("#{base_path}/config/*"), "#{path}/config")
27
+ FileUtils.cp("#{template_path}/config/database.yml", "#{path}/config/database.yml") unless File.exist? "#{path}/config/database.yml"
28
+ FileUtils.cp("#{template_path}/config/definitions.yml", "#{path}/config/definitions.yml") unless File.exist? "#{path}/config/definitions.yml"
29
+
30
+ spec = Gem::Specification::load("#{__dir__}/../wslave.gemspec")
31
+ FileUtils.rm("#{path}/config/.wslave")
32
+ File.open("#{path}/config/.wslave", 'w') {|f| f.write(spec.version)}
33
+
34
+ Dir.chdir path
35
+ WSlaveTools.set_dev_perms
36
+ end
37
+ end
data/wslave.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'wslave'
3
- s.version = '0.0.6'
3
+ s.version = '0.0.7'
4
4
  s.licenses = ['GPL-3.0', 'AGPL-3.0']
5
5
  s.summary = '"Word Slave" generates and controls a WordPress installation'
6
6
  s.description = 'Word Slave includes the wslave command and a control library to generate a ' \
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wslave
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rei Kagetsuki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-07 00:00:00.000000000 Z
11
+ date: 2017-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -94,6 +94,7 @@ files:
94
94
  - lib/wslave_new.rb
95
95
  - lib/wslave_sage.rb
96
96
  - lib/wslave_tools.rb
97
+ - lib/wslave_update.rb
97
98
  - templates/config/database.yml
98
99
  - templates/config/definitions.yml
99
100
  - wslave.gemspec