pave 0.2.2 → 0.3.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 +4 -4
- data/Gemfile.lock +1 -1
- data/bin/pave +31 -36
- data/lib/pave/concrete.rb +27 -31
- data/lib/pave/database.rb +29 -0
- data/lib/pave/version.rb +1 -1
- data/lib/pave/virtual_host.rb +16 -16
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dca6ce62e803a633172e15f128a10c1db7ddb46e
|
4
|
+
data.tar.gz: 6abf652c95be62aa92e2229c31299376a76c6aa1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99e429cd2172c75461de4812b0f614a29597d0d34b02c733a057877c5010e59e8b73a9b8e21f2d7d2515d906381068af99bd6fb4cbbc3ea017aa8531b6dae74b
|
7
|
+
data.tar.gz: 73b1a73e6e88ec5f22b81c16478a3b8b90ba98bed9d79cbc9119fbdb2e3183b42511d7e5f3bb370fa0e5b0a80dd32933fe12cf6f0c3828eb38bb7cddfc1356d1
|
data/Gemfile.lock
CHANGED
data/bin/pave
CHANGED
@@ -12,8 +12,8 @@ default_command :help
|
|
12
12
|
command :new do |c|
|
13
13
|
c.syntax = "pave new APP_PATH [options]"
|
14
14
|
c.description = "Create a new Concrete5 project."
|
15
|
-
c.action do |args
|
16
|
-
Pave::Concrete.create(args.first
|
15
|
+
c.action do |args|
|
16
|
+
Pave::Concrete.create(args.first)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -27,10 +27,10 @@ end
|
|
27
27
|
|
28
28
|
command :setup do |c|
|
29
29
|
c.syntax = "pave setup APP_PATH"
|
30
|
-
c.description = "Setup
|
30
|
+
c.description = "Setup folders for project."
|
31
31
|
c.action do |args|
|
32
|
-
name = args.first || Dir.
|
33
|
-
Pave::Concrete.new(name).
|
32
|
+
name = args.first || Dir.pwd
|
33
|
+
Pave::Concrete.new(name).set_up_folders
|
34
34
|
end
|
35
35
|
end
|
36
36
|
alias_command :"setup:app", :setup
|
@@ -39,17 +39,8 @@ command :"setup:git" do |c|
|
|
39
39
|
c.syntax = "pave setup:git APP_PATH"
|
40
40
|
c.description = "Setup git repo for project."
|
41
41
|
c.action do |args|
|
42
|
-
name = args.first || Dir.
|
43
|
-
Pave::Concrete.new(name).
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
command :"setup:symlinks" do |c|
|
48
|
-
c.syntax = "pave setup:symlinks APP_PATH"
|
49
|
-
c.description = "Setup app folder symlinks for project."
|
50
|
-
c.action do |args|
|
51
|
-
name = args.first || Dir.getwd
|
52
|
-
Pave::Concrete.new(name).symlink_folders
|
42
|
+
name = args.first || Dir.pwd
|
43
|
+
Pave::Concrete.new(name).set_up_git
|
53
44
|
end
|
54
45
|
end
|
55
46
|
|
@@ -57,7 +48,7 @@ command :"setup:permissions" do |c|
|
|
57
48
|
c.syntax = "pave setup:permissions APP_PATH"
|
58
49
|
c.description = "Setup folder permissions for project."
|
59
50
|
c.action do |args|
|
60
|
-
name = args.first || Dir.
|
51
|
+
name = args.first || Dir.pwd
|
61
52
|
Pave::Concrete.new(name).modify_folder_permissions
|
62
53
|
end
|
63
54
|
end
|
@@ -67,7 +58,7 @@ command :"setup:clean" do |c|
|
|
67
58
|
c.syntax = "pave setup:cleanup APP_PATH"
|
68
59
|
c.description = "Remove unused folders from project."
|
69
60
|
c.action do |args|
|
70
|
-
name = args.first || Dir.
|
61
|
+
name = args.first || Dir.pwd
|
71
62
|
Pave::Concrete.new(name).remove_extra_folders
|
72
63
|
end
|
73
64
|
end
|
@@ -77,7 +68,8 @@ command :"virtualhost:create" do |c|
|
|
77
68
|
c.syntax = "pave virtualhost:create VHOST"
|
78
69
|
c.description = "Setup virtual host for Concrete5 project."
|
79
70
|
c.action do |args|
|
80
|
-
|
71
|
+
host = args.first || "#{File.basename(Dir.pwd)}.site"
|
72
|
+
Pave::VirtualHost.new(host).create_vhost
|
81
73
|
end
|
82
74
|
end
|
83
75
|
alias_command :"vh:create", :"virtualhost:create"
|
@@ -86,7 +78,8 @@ command :"virtualhost:remove" do |c|
|
|
86
78
|
c.syntax = "pave virtualhost:remove VHOST"
|
87
79
|
c.description = "Delete virtual host."
|
88
80
|
c.action do |args|
|
89
|
-
|
81
|
+
host = args.first || "#{File.basename(Dir.pwd)}.site"
|
82
|
+
Pave::VirtualHost.new(host).remove_vhost
|
90
83
|
end
|
91
84
|
end
|
92
85
|
alias_command :"vh:remove", :"virtualhost:remove"
|
@@ -94,51 +87,53 @@ alias_command :"virtualhost:delete", :"virtualhost:remove"
|
|
94
87
|
alias_command :"vh:delete", :"virtualhost:remove"
|
95
88
|
|
96
89
|
command :"virtualhost:backup" do |c|
|
97
|
-
c.syntax = "pave virtualhost:backup
|
90
|
+
c.syntax = "pave virtualhost:backup"
|
98
91
|
c.description = "Back up virtual hosts file. Restore with `pave virtualhost:restore`."
|
99
|
-
c.action do
|
100
|
-
Pave::VirtualHost.new(
|
92
|
+
c.action do
|
93
|
+
Pave::VirtualHost.new("").backup_vhost
|
101
94
|
end
|
102
95
|
end
|
103
96
|
alias_command :"vh:backup", :"virtualhost:backup"
|
104
97
|
|
105
98
|
command :"virtualhost:restore" do |c|
|
106
|
-
c.syntax = "pave virtualhost:restore
|
99
|
+
c.syntax = "pave virtualhost:restore"
|
107
100
|
c.description = "Restore previously backed up virtual hosts file."
|
108
|
-
c.action do
|
109
|
-
Pave::VirtualHost.new(
|
101
|
+
c.action do
|
102
|
+
Pave::VirtualHost.new("").restore_vhost
|
110
103
|
end
|
111
104
|
end
|
112
105
|
alias_command :"vh:restore", :"virtualhost:restore"
|
113
106
|
|
114
107
|
command :"virtualhost:restart" do |c|
|
115
|
-
c.syntax = "pave virtualhost:restart
|
108
|
+
c.syntax = "pave virtualhost:restart"
|
116
109
|
c.description = "Restarts apache."
|
117
|
-
c.action do
|
118
|
-
Pave::VirtualHost.new.restart_apache
|
110
|
+
c.action do
|
111
|
+
Pave::VirtualHost.new("").restart_apache
|
119
112
|
end
|
120
113
|
end
|
121
114
|
alias_command :"vh:restart", :"virtualhost:restart"
|
122
115
|
|
123
116
|
command :"db:create" do |c|
|
124
|
-
c.syntax = "pave db:create"
|
117
|
+
c.syntax = "pave db:create DATABASE"
|
125
118
|
c.description = "Create the Concrete5 project's database."
|
126
119
|
c.action do |args|
|
127
|
-
|
120
|
+
name = args.first || "#{File.basename(Dir.pwd)}"
|
121
|
+
Pave::Database.create(name)
|
128
122
|
end
|
129
123
|
end
|
130
124
|
|
131
125
|
command :"db:dump" do |c|
|
132
|
-
c.syntax = "pave db:dump"
|
133
|
-
c.description = "Create SQL dump of the
|
126
|
+
c.syntax = "pave db:dump DATABASE"
|
127
|
+
c.description = "Create SQL dump of the project's database."
|
134
128
|
c.action do |args|
|
135
|
-
|
129
|
+
name = args.first || "#{File.basename(Dir.pwd)}"
|
130
|
+
Pave::Database.new(name).dump
|
136
131
|
end
|
137
132
|
end
|
138
133
|
|
139
134
|
command :"db:download" do |c|
|
140
135
|
c.syntax = "pave db:download"
|
141
|
-
c.description = "Download the
|
136
|
+
c.description = "Download the project's live database and replace local database."
|
142
137
|
c.action do |args|
|
143
138
|
say "`db:download` command not implemented yet."
|
144
139
|
end
|
@@ -146,7 +141,7 @@ end
|
|
146
141
|
|
147
142
|
command :"db:upload" do |c|
|
148
143
|
c.syntax = "pave db:upload"
|
149
|
-
c.description = "Upload the
|
144
|
+
c.description = "Upload the project's local database and replace the live database."
|
150
145
|
c.action do |args|
|
151
146
|
say "`db:upload` command not implemented yet."
|
152
147
|
end
|
data/lib/pave/concrete.rb
CHANGED
@@ -4,7 +4,7 @@ module Pave
|
|
4
4
|
|
5
5
|
attr_accessor :name
|
6
6
|
|
7
|
-
def self.create(name
|
7
|
+
def self.create(name)
|
8
8
|
say ""
|
9
9
|
return say "Options should be given after the application name. For details run: `pave help`" unless name.size > 0
|
10
10
|
say "Setting up Concrete5 in folder #{name}."
|
@@ -17,8 +17,8 @@ module Pave
|
|
17
17
|
|
18
18
|
def setup
|
19
19
|
clone_concrete5
|
20
|
-
|
21
|
-
|
20
|
+
set_up_folders
|
21
|
+
set_up_git
|
22
22
|
create_virtual_host
|
23
23
|
self
|
24
24
|
end
|
@@ -34,23 +34,20 @@ module Pave
|
|
34
34
|
say "* Concrete5 downloaded and unzipped into ./#{name}."
|
35
35
|
end
|
36
36
|
|
37
|
-
def
|
37
|
+
def set_up_folders
|
38
38
|
say "* Setting up folders..."
|
39
|
-
sh "mkdir #{name}/app"
|
40
|
-
|
41
|
-
symlink_folders
|
42
39
|
remove_extra_folders
|
43
40
|
modify_folder_permissions
|
44
41
|
end
|
45
42
|
|
46
|
-
def
|
43
|
+
def set_up_git
|
47
44
|
say "* Setting up git..."
|
48
45
|
sh "touch #{name}/.gitignore"
|
49
46
|
gitignored_folders.each{ |folder| sh "echo '#{folder}' >> #{name}/.gitignore" }
|
50
|
-
|
47
|
+
gitkeep_folders.each{ |folder| sh "touch #{name}/#{folder}/.keep" }
|
51
48
|
sh "touch #{name}/files/.keep"
|
52
49
|
sh "touch #{name}/updates/.keep"
|
53
|
-
sh "cd #{name} && git init && git add -A && git commit -m 'Initial'"
|
50
|
+
# sh "cd #{name} && git init && git add -A && git commit -m 'Initial'"
|
54
51
|
end
|
55
52
|
|
56
53
|
def gitignored_folders
|
@@ -64,39 +61,38 @@ module Pave
|
|
64
61
|
]
|
65
62
|
end
|
66
63
|
|
67
|
-
def sudo?
|
68
|
-
`whoami` == "root"
|
69
|
-
end
|
70
|
-
|
71
64
|
def create_virtual_host
|
72
|
-
|
73
|
-
|
65
|
+
say "* Setting up virtual host..."
|
66
|
+
if Pave::VirtualHost.new("#{name}.site").create_vhost
|
67
|
+
say "Successfully setup virtual host #{name}.site."
|
74
68
|
else
|
75
|
-
say "Virtual host not set up. Run `
|
69
|
+
say "Virtual host not set up. Run `pave vh:create #{name}.site` to create it."
|
76
70
|
end
|
77
71
|
end
|
78
72
|
|
73
|
+
def in_project_dir?
|
74
|
+
File.basename(Dir.pwd) == name
|
75
|
+
end
|
76
|
+
|
79
77
|
def modify_folder_permissions
|
80
|
-
|
81
|
-
|
78
|
+
say "* Modifying folder permissions..."
|
79
|
+
|
80
|
+
successful = world_writable_folders.map do |folder|
|
81
|
+
sh "sudo chmod -R 777 #{in_project_dir? ? folder.to_s : name + '/' + folder.to_s}"
|
82
|
+
end.count{ |x| x != 0 } == 0
|
83
|
+
|
84
|
+
if successful
|
85
|
+
say "Successfully modified folder permissions."
|
86
|
+
else
|
87
|
+
say "Folder permissions not set up. Run `pave setup:permissions` to set them."
|
82
88
|
end
|
83
89
|
end
|
84
90
|
|
85
91
|
def world_writable_folders
|
86
|
-
|
87
|
-
:config,
|
88
|
-
:packages,
|
89
|
-
:files
|
90
|
-
]
|
91
|
-
end
|
92
|
-
|
93
|
-
def symlink_folders
|
94
|
-
symlinked_folders.each do |folder|
|
95
|
-
sh "ln -s #{name}/#{folder} app/#{folder}"
|
96
|
-
end
|
92
|
+
%w{ config packages files }
|
97
93
|
end
|
98
94
|
|
99
|
-
def
|
95
|
+
def gitkeep_folders
|
100
96
|
[
|
101
97
|
:blocks,
|
102
98
|
:elements,
|
data/lib/pave/database.rb
CHANGED
@@ -4,6 +4,35 @@ module Pave
|
|
4
4
|
class Database
|
5
5
|
include Pave::Shell
|
6
6
|
|
7
|
+
attr_accessor :name
|
7
8
|
|
9
|
+
def self.create(name)
|
10
|
+
say ""
|
11
|
+
return say "Options should be given after the database name. For details run: `pave help`" unless name && name.size > 0
|
12
|
+
say "Creating mysql database: #{name}."
|
13
|
+
new(name).setup
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(name)
|
17
|
+
@name = name
|
18
|
+
end
|
19
|
+
|
20
|
+
def setup
|
21
|
+
sh "mysql -uroot -e 'CREATE DATABASE #{name}'"
|
22
|
+
end
|
23
|
+
|
24
|
+
def dump
|
25
|
+
say "Creating dump of #{name} at #{Dir.pwd}/#{Time.now.strftime("%Y-%m-%d")}-#{name}.sql.gz"
|
26
|
+
sh "mysqldump -uroot #{name} | gzip > #{Time.now.strftime("%Y-%m-%d")}-#{name}.sql.gz"
|
27
|
+
end
|
28
|
+
|
29
|
+
def download(host, user, password)
|
30
|
+
# Download the project's live database and replace local database.
|
31
|
+
# sh "mysqldump -h#{host} -u#{user} -p#{password} #{name} | mysql -uroot #{name}"
|
32
|
+
end
|
33
|
+
|
34
|
+
def upload
|
35
|
+
# Upload the project's local database and replace the live database.
|
36
|
+
end
|
8
37
|
end
|
9
38
|
end
|
data/lib/pave/version.rb
CHANGED
data/lib/pave/virtual_host.rb
CHANGED
@@ -11,17 +11,10 @@ module Pave
|
|
11
11
|
@hostname = host
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
add_vhost_to_conf && add_hosts_entry && restart_apache && say("Created virtual host for #{hostname}.")
|
19
|
-
end
|
20
|
-
|
21
|
-
def remove_vhost
|
22
|
-
return say "No virtual host backup found. Run `pave vh:backup` before adding a virtual host." unless check_backup
|
23
|
-
|
24
|
-
remove_vhost_from_conf && remove_hosts_entry && restart_apache && say("Removed virtual host for #{hostname}.")
|
14
|
+
def restart_apache
|
15
|
+
`sudo apachectl restart`
|
16
|
+
say "Apache restarted."
|
17
|
+
true
|
25
18
|
end
|
26
19
|
|
27
20
|
def backup_vhost
|
@@ -46,10 +39,17 @@ module Pave
|
|
46
39
|
say "Restored vhosts conf and host file."
|
47
40
|
end
|
48
41
|
|
49
|
-
def
|
50
|
-
|
51
|
-
say "
|
52
|
-
|
42
|
+
def create_vhost
|
43
|
+
return say "No virtual host backup found. Run `pave vh:backup` before adding a virtual host." unless check_backup
|
44
|
+
return say "No host name provided. Run `pave help` for more details." unless hostname.size > 0
|
45
|
+
|
46
|
+
add_vhost_to_conf && add_hosts_entry && restart_apache && say("Created virtual host for #{hostname}.")
|
47
|
+
end
|
48
|
+
|
49
|
+
def remove_vhost
|
50
|
+
return say "No virtual host backup found. Run `pave vh:backup` before adding a virtual host." unless check_backup
|
51
|
+
|
52
|
+
remove_vhost_from_conf && remove_hosts_entry && restart_apache && say("Removed virtual host for #{hostname}.")
|
53
53
|
end
|
54
54
|
|
55
55
|
private
|
@@ -121,7 +121,7 @@ module Pave
|
|
121
121
|
end
|
122
122
|
|
123
123
|
def project_folder
|
124
|
-
Dir.
|
124
|
+
Dir.pwd
|
125
125
|
end
|
126
126
|
|
127
127
|
def vhosts_file_array
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pave
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamon Holmgren
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-12-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
128
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.0.
|
129
|
+
rubygems_version: 2.0.14
|
130
130
|
signing_key:
|
131
131
|
specification_version: 4
|
132
132
|
summary: Provides a set of command line tools for Concrete5.
|