gentheme 0.1.0
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 +7 -0
- data/.gitignore +13 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +63 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/gentheme +46 -0
- data/bin/setup +7 -0
- data/gentheme.gemspec +31 -0
- data/lib/gentheme/version.rb +3 -0
- data/lib/gentheme.rb +301 -0
- metadata +159 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5558d66a0c5057412a253df8a26d634ca9784135
|
4
|
+
data.tar.gz: f73b4b8f40ad34ec6514d92fb7c6f74960cfb306
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2df82293b94dcda96097865cfe78232012b2e63728f9e5e865cf632123e95ff13609c65a90feedf3bdb09d7ce4f7df9b3323d0448ec3ae1147679e62811317f2
|
7
|
+
data.tar.gz: 0bded37eead6504c639a40b791988c4430b379897e79a819bf9d76ea5a1c5187300308f2e4e77199b25dc60eace652fa9fa5efa88382a1ef6d203c81cdb6e48e
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gentheme
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.1.1
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Michele Gobbi
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# Gentheme
|
2
|
+
|
3
|
+
This ruby gem make available a shell command, "gentheme" which will permit you to generate a wordpress theme designed for theme authors.
|
4
|
+
|
5
|
+
## Requirements
|
6
|
+
|
7
|
+
This gem was tested only on OSX systems, so no warranties are given on other systems.
|
8
|
+
The requirements needed to be already installed on the system are:
|
9
|
+
- npm: node.js and his packet manager
|
10
|
+
- virtualhost.sh: a simple shell script that permit to write etc/hosts and etc/apache2/virtualhost to create the virtual host
|
11
|
+
- wp_cli: a shell command for manage wordpress installations
|
12
|
+
- mysql server: you've to run the server
|
13
|
+
|
14
|
+
Before start gentheme make sure you've all the requirements installed and working.
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
Add this line to your application's Gemfile:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
gem 'gentheme'
|
22
|
+
```
|
23
|
+
|
24
|
+
And then execute:
|
25
|
+
|
26
|
+
$ bundle
|
27
|
+
|
28
|
+
Or install it yourself as:
|
29
|
+
|
30
|
+
$ gem install gentheme
|
31
|
+
|
32
|
+
## Usage
|
33
|
+
|
34
|
+
Run
|
35
|
+
|
36
|
+
```gentheme install themename```
|
37
|
+
|
38
|
+
to create a folder ```themename``` inside which will be all the resources. The installation process could take some minutes because all resources are downloaded from the internet and there are a lot of npm packages required.
|
39
|
+
|
40
|
+
Once finished, open your broser at ```http://themename``` and you'll see your starter theme.
|
41
|
+
|
42
|
+
## Structure
|
43
|
+
|
44
|
+
The theme is created in the ```themename/app``` folder.
|
45
|
+
|
46
|
+
A Wordpress is installed in the ```themename/wordpress``` folder.
|
47
|
+
|
48
|
+
Wordpress is already installed and the theme is already activated on it.
|
49
|
+
|
50
|
+
## Start editing your theme
|
51
|
+
|
52
|
+
Follow the instructions at [gulp-webapp](https://github.com/yeoman/generator-gulp-webapp) to start editing your theme.
|
53
|
+
Remember that your theme is a [Underscore Theme](http://underscores.me/).
|
54
|
+
|
55
|
+
## Contributing
|
56
|
+
|
57
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/dynamick/gentheme. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
58
|
+
|
59
|
+
|
60
|
+
## License
|
61
|
+
|
62
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
63
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "gentheme"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/gentheme
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'gentheme'
|
4
|
+
require 'slop'
|
5
|
+
|
6
|
+
opts = Slop::Options.new
|
7
|
+
opts.banner = "Usage: gentheme [options] command"
|
8
|
+
opts.separator ""
|
9
|
+
opts.separator "Commands:"
|
10
|
+
opts.separator ""
|
11
|
+
opts.separator "\tinstall themename: start installing a theme inside a folder named themename"
|
12
|
+
opts.separator ""
|
13
|
+
opts.separator "Available options:"
|
14
|
+
opts.string "-p", "--path", "a path", default: `pwd`.strip
|
15
|
+
opts.bool "-v", "--verbose", "enable verbose mode", default: true
|
16
|
+
opts.on '--version', 'print the version' do
|
17
|
+
puts Gentheme::VERSION
|
18
|
+
exit
|
19
|
+
end
|
20
|
+
parser = Slop::Parser.new(opts)
|
21
|
+
options = parser.parse(ARGV)
|
22
|
+
command = options.arguments[0] rescue nil
|
23
|
+
if command.nil?
|
24
|
+
puts options.to_hash
|
25
|
+
puts options.arguments
|
26
|
+
puts opts
|
27
|
+
exit
|
28
|
+
end
|
29
|
+
|
30
|
+
case command
|
31
|
+
when "install"
|
32
|
+
themename = options.arguments[1] rescue nil
|
33
|
+
if !themename.nil?
|
34
|
+
generator = Gentheme::Generator.new(themename, options)
|
35
|
+
generator.start
|
36
|
+
|
37
|
+
$stderr.puts "Generated new WP Theme structure for #{generator.name}"
|
38
|
+
else
|
39
|
+
puts "Please specify a name for your Wordpress Theme"
|
40
|
+
puts "example:"
|
41
|
+
puts "gentheme install mythemename"
|
42
|
+
end
|
43
|
+
else
|
44
|
+
puts "Unknown command"
|
45
|
+
end
|
46
|
+
|
data/bin/setup
ADDED
data/gentheme.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'gentheme/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "gentheme"
|
8
|
+
spec.version = Gentheme::VERSION
|
9
|
+
spec.authors = ["Michele Gobbi"]
|
10
|
+
spec.email = ["info@dynamick.it"]
|
11
|
+
|
12
|
+
spec.summary = 'Wordpress theme generator for theme developers'
|
13
|
+
spec.description = 'A full featured WP theme generator designed for theme developers who want to sell their theme, such as Themeforest.'
|
14
|
+
spec.homepage = "https://github.com/dynamick/gentheme"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "rspec"
|
27
|
+
spec.add_dependency "tty"
|
28
|
+
spec.add_dependency "tty-which"
|
29
|
+
spec.add_dependency "slop"
|
30
|
+
spec.add_dependency "mysql2"
|
31
|
+
end
|
data/lib/gentheme.rb
ADDED
@@ -0,0 +1,301 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'tty'
|
4
|
+
require 'tty-which'
|
5
|
+
require 'yaml'
|
6
|
+
require 'mysql2'
|
7
|
+
|
8
|
+
require "gentheme/version"
|
9
|
+
|
10
|
+
module Gentheme
|
11
|
+
class Generator
|
12
|
+
|
13
|
+
attr_reader :root_path
|
14
|
+
|
15
|
+
def initialize(name, options)
|
16
|
+
@name = name
|
17
|
+
@root_path = options[:path]
|
18
|
+
@verbose = options[:verbose]
|
19
|
+
@npm = false
|
20
|
+
@wp_cli = false
|
21
|
+
@virtualhost = false
|
22
|
+
|
23
|
+
@status_file = "gentheme.conf"
|
24
|
+
@default_status = {
|
25
|
+
general: {
|
26
|
+
project_name: name,
|
27
|
+
generator: 'gentheme',
|
28
|
+
generator_version: Gentheme::VERSION,
|
29
|
+
created_at: Time.now,
|
30
|
+
updated_at: Time.now
|
31
|
+
},
|
32
|
+
mysql: {
|
33
|
+
db_host: "127.0.0.1",
|
34
|
+
db_user: "root",
|
35
|
+
db_pass: "",
|
36
|
+
db_name: name
|
37
|
+
},
|
38
|
+
packages: {
|
39
|
+
|
40
|
+
}}
|
41
|
+
@status = read_status
|
42
|
+
if @status.nil?
|
43
|
+
@status = @default_status
|
44
|
+
write_status
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
def start
|
51
|
+
|
52
|
+
if check_requirements
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
# Create database
|
57
|
+
if !get_status(:create_database, :packages)
|
58
|
+
create_database
|
59
|
+
else
|
60
|
+
puts 'Database already created.'
|
61
|
+
end
|
62
|
+
|
63
|
+
# Install gulp-webapp
|
64
|
+
if !get_status(:gulp_webapp, :packages)
|
65
|
+
install_gulp_webapp if install_yeoman
|
66
|
+
else
|
67
|
+
puts 'Gulp-webapp is already installed'
|
68
|
+
end
|
69
|
+
|
70
|
+
#install wordpress
|
71
|
+
if !get_status(:wordpress, :packages)
|
72
|
+
install_wordpress
|
73
|
+
else
|
74
|
+
puts 'Wordpress is already installed'
|
75
|
+
end
|
76
|
+
|
77
|
+
# append wp gitignore
|
78
|
+
if !get_status(:wp_gitignore, :packages)
|
79
|
+
add_wp_gitignore
|
80
|
+
else
|
81
|
+
puts 'Wordpress is already added to gitignore'
|
82
|
+
end
|
83
|
+
|
84
|
+
# create a virtualhost
|
85
|
+
if !get_status(:virtualhost, :packages)
|
86
|
+
create_virtualhost
|
87
|
+
else
|
88
|
+
puts 'Virtualhost already created'
|
89
|
+
end
|
90
|
+
|
91
|
+
# create a starter theme
|
92
|
+
if !get_status(:starter_theme, :packages)
|
93
|
+
create_starter_theme
|
94
|
+
else
|
95
|
+
puts 'Starter theme already created'
|
96
|
+
end
|
97
|
+
|
98
|
+
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
def get_status(field, namespace)
|
104
|
+
if read_status && !namespace.nil? && !field.nil?
|
105
|
+
@status[namespace.to_sym][field.to_sym]
|
106
|
+
else
|
107
|
+
nil
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def set_status(field, value, namespace)
|
112
|
+
if !namespace.nil? && !field.nil?
|
113
|
+
@status[namespace.to_sym][field.to_sym] = value
|
114
|
+
write_status
|
115
|
+
else
|
116
|
+
nil
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def read_status
|
121
|
+
YAML::load_file("#{base_path}/#{@status_file}") rescue nil
|
122
|
+
end
|
123
|
+
|
124
|
+
def write_status
|
125
|
+
system("#{enter_base_path}")
|
126
|
+
File.open("#{base_path}/#{@status_file}", 'w') { |f| f.puts @status.to_yaml }
|
127
|
+
end
|
128
|
+
|
129
|
+
|
130
|
+
def name
|
131
|
+
sanitized_name
|
132
|
+
end
|
133
|
+
|
134
|
+
|
135
|
+
def say_hello
|
136
|
+
shell = TTY::Shell.new
|
137
|
+
answer = shell.ask "What is your name?" do
|
138
|
+
argument :required
|
139
|
+
default 'Piotr'
|
140
|
+
validate /\w+\s\w+/
|
141
|
+
#valid ['Piotr', 'Piotrek']
|
142
|
+
modify :capitalize
|
143
|
+
end.read_string
|
144
|
+
puts "Hello world! #{@name}, this is your answer: #{answer}"
|
145
|
+
end
|
146
|
+
|
147
|
+
def check_requirements
|
148
|
+
@npm = TTY::Which.which('npm')
|
149
|
+
@wp_cli = TTY::Which.which('wp')
|
150
|
+
@virtualhost = TTY::Which.which('virtualhost.sh')
|
151
|
+
satisfy_requirements = (@npm.empty? && @wp_cli.empty? ? false : true)
|
152
|
+
if !satisfy_requirements
|
153
|
+
puts 'Error: Before proceding, you\'ve to install:'
|
154
|
+
puts '- npm: Node.js Packet Manager ' if @npm.empty?
|
155
|
+
puts '- wp_cli: Wordpress Command Line Tool ' if @wp_cli.empty?
|
156
|
+
puts '- virtualhost.sh: add a virtual host to your apache conf' if @virtualhost.empty?
|
157
|
+
else
|
158
|
+
puts 'Requirement satisfied! Good, now we could proceed installing wp...'
|
159
|
+
end
|
160
|
+
return satisfy_requirements
|
161
|
+
end
|
162
|
+
|
163
|
+
def create_database
|
164
|
+
if !get_status(:create_database, :packages)
|
165
|
+
puts 'Creating database'
|
166
|
+
db_host = get_status(:db_host, :mysql)
|
167
|
+
db_user = get_status(:db_user, :mysql)
|
168
|
+
db_pass = get_status(:db_pass, :mysql)
|
169
|
+
db_name = get_status(:db_name, :mysql)
|
170
|
+
client = Mysql2::Client.new(:host => db_host, :username => db_user, :password => db_pass)
|
171
|
+
if client
|
172
|
+
client.query("DROP DATABASE IF EXISTS #{db_name}")
|
173
|
+
client.query("CREATE DATABASE #{db_name}")
|
174
|
+
client.close
|
175
|
+
puts "Database #{name} created successfully."
|
176
|
+
set_status(:create_database, true, :packages)
|
177
|
+
else
|
178
|
+
puts "Can't connect to your database."
|
179
|
+
puts "Please edit #{@base_root}/gentheme.conf your mysql account connection."
|
180
|
+
end
|
181
|
+
else
|
182
|
+
puts "Database already created!"
|
183
|
+
end
|
184
|
+
|
185
|
+
end
|
186
|
+
|
187
|
+
|
188
|
+
def install_yeoman
|
189
|
+
installed_packages = []
|
190
|
+
yo = false
|
191
|
+
generator = false
|
192
|
+
installed = get_status(:yeoman, :packages)
|
193
|
+
if installed
|
194
|
+
puts 'Yeoman already installed...'
|
195
|
+
return true
|
196
|
+
else
|
197
|
+
if !@npm.empty?
|
198
|
+
puts 'Checking for yeoman and generator-gulp-webapp generator...'
|
199
|
+
#{}`#{npm} install --global yo generator-gulp-webapp`
|
200
|
+
result = `#{@npm} ll --global --parseable --silent yo generator-gulp-webapp`
|
201
|
+
raw_installed_packages = result.split("\n")
|
202
|
+
raw_installed_packages.each do |packs|
|
203
|
+
p = packs.split(':')
|
204
|
+
name = p[1].split('@')[0]
|
205
|
+
path = p[0]
|
206
|
+
version = p[1].split('@')[1]
|
207
|
+
installed_packages << {name: name, path: path, version: version}
|
208
|
+
|
209
|
+
generator = true if name == 'generator-gulp-webapp'
|
210
|
+
yo = true if name == 'yo'
|
211
|
+
end
|
212
|
+
if generator == false || yo == false
|
213
|
+
puts "Installing #{'yo' if !yo} #{'generator-gulp-webapp' if !generator}..."
|
214
|
+
result = system("#{@npm} install --silent #{'yo' if !yo} #{'generator-gulp-webapp' if !generator}")
|
215
|
+
puts result
|
216
|
+
else
|
217
|
+
puts 'OK: yeoman and generator-gulp-webapp found on your system'
|
218
|
+
end
|
219
|
+
set_status(:yeoman, true, :packages)
|
220
|
+
return true
|
221
|
+
else
|
222
|
+
puts 'Error: npm not found on you system.'
|
223
|
+
return false
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
def install_gulp_webapp
|
229
|
+
if !get_status(:gulp_webapp, :packages)
|
230
|
+
puts 'Installing gulp-webapp scaffold...'
|
231
|
+
system("#{enter_base_path} && yo gulp-webapp")
|
232
|
+
set_status(:gulp_webapp, true, :packages)
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
def install_wordpress
|
237
|
+
puts 'Installing Wordpress...'
|
238
|
+
if @wp_cli && !get_status(:wordpress, :packages)
|
239
|
+
system("#{enter_base_path} && mkdir -p wordpress && #{@wp_cli} core download --path=./wordpress/")
|
240
|
+
set_status(:wordpress, true, :packages)
|
241
|
+
end
|
242
|
+
|
243
|
+
end
|
244
|
+
|
245
|
+
def add_wp_gitignore
|
246
|
+
puts 'appending wordpress to gitignore...'
|
247
|
+
if !get_status(:wp_gitignore, :packages)
|
248
|
+
system("#{enter_base_path} && echo '## Mac\n.DS_Store\n\n## WordPress\nwordpress\n' >> .gitignore")
|
249
|
+
set_status(:wp_gitignore, true, :packages)
|
250
|
+
end
|
251
|
+
|
252
|
+
end
|
253
|
+
|
254
|
+
def create_virtualhost
|
255
|
+
puts 'Creating virtualhost...'
|
256
|
+
if @virtualhost && !get_status(:virtualhost, :packages)
|
257
|
+
system("virtualhost.sh #{name} #{base_path}/wordpress")
|
258
|
+
set_status(:virtualhost, true, :packages)
|
259
|
+
end
|
260
|
+
|
261
|
+
end
|
262
|
+
|
263
|
+
def create_starter_theme
|
264
|
+
puts 'Creating starter theme...'
|
265
|
+
if !get_status(:starter_theme, :packages)
|
266
|
+
system("#{enter_base_path} && cd wordpress && wp core config --dbname=#{name} --dbuser=root --dbhost=127.0.0.1 --skip-check")
|
267
|
+
system("#{enter_base_path} && cd wordpress && wp core install --title=#{name} --admin_user=admin --admin_password=#{name} --admin_email=youremail@#{name}.example.com --url=http://#{name} ")
|
268
|
+
system("#{enter_base_path} && rm wordpress/wp-content/themes/#{name}")
|
269
|
+
system("#{enter_base_path} && mv app app_#{rand(10000)}")
|
270
|
+
system("#{enter_base_path} && mkdir app")
|
271
|
+
system("#{enter_base_path} && cd wordpress && wp scaffold _s #{name} --activate")
|
272
|
+
system("#{enter_base_path} && mv wordpress/wp-content/themes/#{name}/* app/")
|
273
|
+
system("#{enter_base_path} && rmdir wordpress/wp-content/themes/#{name}")
|
274
|
+
system("#{enter_base_path} && ln -s #{base_path}/app/ wordpress/wp-content/themes/#{name}")
|
275
|
+
set_status(:starter_theme, true, :packages)
|
276
|
+
end
|
277
|
+
|
278
|
+
end
|
279
|
+
|
280
|
+
private
|
281
|
+
|
282
|
+
def base_path
|
283
|
+
File.join(@root_path, @name)
|
284
|
+
end
|
285
|
+
|
286
|
+
def enter_base_path
|
287
|
+
cmd = "mkdir -p #{base_path} && cd $_"
|
288
|
+
#{}`#{cmd}`
|
289
|
+
#cmd
|
290
|
+
end
|
291
|
+
|
292
|
+
|
293
|
+
def sanitized_name
|
294
|
+
@name.gsub(/([A-Z])([a-z])/, '_\1\2').sub(/^_/, '').downcase
|
295
|
+
end
|
296
|
+
|
297
|
+
|
298
|
+
end
|
299
|
+
|
300
|
+
|
301
|
+
end
|
metadata
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gentheme
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michele Gobbi
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: tty
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: tty-which
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: slop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: mysql2
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: A full featured WP theme generator designed for theme developers who
|
112
|
+
want to sell their theme, such as Themeforest.
|
113
|
+
email:
|
114
|
+
- info@dynamick.it
|
115
|
+
executables: []
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- ".gitignore"
|
120
|
+
- ".rspec"
|
121
|
+
- ".ruby-gemset"
|
122
|
+
- ".ruby-version"
|
123
|
+
- ".travis.yml"
|
124
|
+
- CODE_OF_CONDUCT.md
|
125
|
+
- Gemfile
|
126
|
+
- LICENSE.txt
|
127
|
+
- README.md
|
128
|
+
- Rakefile
|
129
|
+
- bin/console
|
130
|
+
- bin/gentheme
|
131
|
+
- bin/setup
|
132
|
+
- gentheme.gemspec
|
133
|
+
- lib/gentheme.rb
|
134
|
+
- lib/gentheme/version.rb
|
135
|
+
homepage: https://github.com/dynamick/gentheme
|
136
|
+
licenses:
|
137
|
+
- MIT
|
138
|
+
metadata: {}
|
139
|
+
post_install_message:
|
140
|
+
rdoc_options: []
|
141
|
+
require_paths:
|
142
|
+
- lib
|
143
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
requirements: []
|
154
|
+
rubyforge_project:
|
155
|
+
rubygems_version: 2.2.2
|
156
|
+
signing_key:
|
157
|
+
specification_version: 4
|
158
|
+
summary: Wordpress theme generator for theme developers
|
159
|
+
test_files: []
|