pave 0.0.12 → 0.2.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/.ruby-version +1 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +5 -4
- data/README.md +14 -16
- data/Rakefile +10 -10
- data/bin/pave +85 -75
- data/lib/pave/concrete.rb +96 -0
- data/lib/pave/shell.rb +14 -0
- data/lib/pave/version.rb +1 -1
- data/lib/pave/virtual_host.rb +170 -0
- data/lib/pave.rb +9 -94
- data/pave.gemspec +9 -9
- data/test/pave_test.rb +1 -1
- metadata +12 -8
- data/test/tc_something.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f856d10abc2ef812268cfd9838876e5b3392107d
|
4
|
+
data.tar.gz: e51a2f195e69ffb54a0bcde8a229b030200ba74a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4320ecbf4630da42f381aee1e4a2cf9830e4f5c6580f50a214c09dd32666675aaf79e6d197401b4b4648cb392ac64818b35ead685efcb1488de459c01a70a1f8
|
7
|
+
data.tar.gz: 8d27581e28f41771480801e18d318d35d85ff905809a501dfe3bbbe7546d03842d4df0d90f4d8a899cd785f3d82f212cfcbb5e23b6af2372829d781058080b96
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.0.0
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pave (0.0
|
5
|
-
|
4
|
+
pave (0.1.0)
|
5
|
+
commander (~> 4.1.5)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
+
commander (4.1.5)
|
11
|
+
highline (~> 1.6.11)
|
12
|
+
highline (1.6.20)
|
10
13
|
json (1.8.0)
|
11
|
-
methadone (1.3.0)
|
12
|
-
bundler
|
13
14
|
rake (0.9.6)
|
14
15
|
rdoc (4.0.1)
|
15
16
|
json (~> 1.4)
|
data/README.md
CHANGED
@@ -10,34 +10,32 @@ Provides a set of command line tools for Concrete5.
|
|
10
10
|
|
11
11
|
## Usage
|
12
12
|
|
13
|
+
Create a new Concrete5 website:
|
14
|
+
|
13
15
|
$ pave new mywebsite
|
14
16
|
|
17
|
+
This:
|
18
|
+
|
15
19
|
1. Downloads Concrete 5.6.2.1
|
16
20
|
2. Unzips it into `mywebsite`
|
17
21
|
3. Removes extra folders
|
18
22
|
4. Builds an app folder of commonly used folders (symlinked into the root folder so Concrete5 can find them)
|
19
23
|
5. Initializes a Git repo and adds the first ("Initial") commit.
|
20
24
|
|
21
|
-
|
22
|
-
|
23
|
-
Updates pave to the latest version.
|
25
|
+
Other commands:
|
24
26
|
|
25
|
-
$ pave
|
26
|
-
|
27
|
-
Outputs
|
27
|
+
$ pave --help
|
28
|
+
|
29
|
+
Outputs common tasks that pave can do.
|
28
30
|
|
29
31
|
## TODO
|
30
32
|
|
31
|
-
1.
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
7. Do live database download & replace local one. `pave db download` (confirmation first)
|
38
|
-
8. Do local database upload & replace remote one. `pave db upload` (confirmation first)
|
39
|
-
9.
|
40
|
-
|
33
|
+
1. ? Create database (`pave database mydatabase`)
|
34
|
+
1. Tell user to go set up Concrete5 in-browser once virtual host and db is set up
|
35
|
+
1. Uninstall? `pave remove mywebsite` (including virtual host)
|
36
|
+
1. Do database dumps. `pave db dump`
|
37
|
+
1. Do live database download & replace local one. `pave db download` (confirmation first)
|
38
|
+
1. Do local database upload & replace remote one. `pave db upload` (confirmation first)
|
41
39
|
|
42
40
|
|
43
41
|
## Contributing
|
data/Rakefile
CHANGED
@@ -23,15 +23,15 @@ def dump_load_path
|
|
23
23
|
puts "Found in #{path}"
|
24
24
|
end
|
25
25
|
end
|
26
|
-
require
|
27
|
-
require
|
26
|
+
require "bundler"
|
27
|
+
require "rake/clean"
|
28
28
|
|
29
|
-
require
|
29
|
+
require "rake/testtask"
|
30
30
|
|
31
|
-
require
|
32
|
-
require
|
33
|
-
gem
|
34
|
-
require
|
31
|
+
require "cucumber"
|
32
|
+
require "cucumber/rake/task"
|
33
|
+
gem "rdoc" # we need the installed RDoc gem, not the system one
|
34
|
+
require "rdoc/task"
|
35
35
|
|
36
36
|
include Rake::DSL
|
37
37
|
|
@@ -39,13 +39,13 @@ Bundler::GemHelper.install_tasks
|
|
39
39
|
|
40
40
|
|
41
41
|
Rake::TestTask.new do |t|
|
42
|
-
t.pattern =
|
42
|
+
t.pattern = "test/tc_*.rb"
|
43
43
|
end
|
44
44
|
|
45
45
|
Rake::RDocTask.new do |rd|
|
46
|
-
|
46
|
+
|
47
47
|
rd.main = "README.rdoc"
|
48
|
-
|
48
|
+
|
49
49
|
rd.rdoc_files.include("lib/**/*.rb","bin/**/*")
|
50
50
|
end
|
51
51
|
|
data/bin/pave
CHANGED
@@ -1,94 +1,104 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require 'methadone'
|
5
|
-
require 'pave.rb'
|
3
|
+
require "pave.rb"
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
program :name, "Pave"
|
6
|
+
program :version, Pave::VERSION
|
7
|
+
program :description, "Provides a set of command line tools for Concrete5."
|
8
|
+
program :help, "Authors", "Jamon Holmgren <jamon@clearsightstudio.com>, Ryan Linton <ryanl@clearsightstudio.com>"
|
11
9
|
|
12
|
-
|
13
|
-
# your program code here
|
14
|
-
# You can access CLI options via
|
15
|
-
# the options Hash
|
16
|
-
case command.to_sym
|
17
|
-
when :new then Pave::Concrete.create(opt)
|
18
|
-
when :update then update_gem
|
19
|
-
when :help then show_help
|
20
|
-
when :virtualhost then info "`virtualhost` command not implemented yet."
|
21
|
-
when :dbcreate then info "`dbcreate` command not implemented yet."
|
22
|
-
when :db then info "`db` command not implemented yet."
|
23
|
-
when :version then info "pave version #{Pave::VERSION} - by Jamon Holmgren"
|
24
|
-
else show_help
|
25
|
-
end
|
10
|
+
default_command :help
|
26
11
|
|
27
|
-
|
12
|
+
command :new do |c|
|
13
|
+
c.syntax = "pave new APP_PATH [options]"
|
14
|
+
c.description = "Create a new Concrete5 project."
|
15
|
+
c.action do |args, options|
|
16
|
+
Pave::Concrete.create(args.first, options)
|
28
17
|
end
|
18
|
+
end
|
29
19
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
20
|
+
command :update do |c|
|
21
|
+
c.syntax = "pave update"
|
22
|
+
c.description = "Update pave to the latest version."
|
23
|
+
c.action do
|
24
|
+
Pave.update
|
34
25
|
end
|
26
|
+
end
|
35
27
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
info " new <websitename>"
|
42
|
-
info " Downloads and configures a new Concrete5 website."
|
43
|
-
info " update"
|
44
|
-
info " Updates the pave gem to the latest version."
|
45
|
-
info ""
|
46
|
-
info "Future commands (not implemented yet):"
|
47
|
-
info " virtualhost <domain>"
|
48
|
-
info " Sets up a new virtualhost on Apache, pointing to the current folder."
|
49
|
-
info " dbcreate <dbname>"
|
50
|
-
info " Sets up a new database on the local MySQL instance."
|
51
|
-
info " db dump"
|
52
|
-
info " Dumps the current database to a local file."
|
53
|
-
info " db download"
|
54
|
-
info " Downloads the remote database and replaces the local database with it."
|
55
|
-
info " db upload"
|
56
|
-
info " Uploads the local database to the remote one, replacing what's there."
|
28
|
+
command :"virtualhost:create" do |c|
|
29
|
+
c.syntax = "pave virtualhost:create VHOST"
|
30
|
+
c.description = "Setup virtual host for Concrete5 project."
|
31
|
+
c.action do |args|
|
32
|
+
Pave::VirtualHost.new(args.first).create_vhost
|
57
33
|
end
|
34
|
+
end
|
35
|
+
alias_command :"vh:create", :"virtualhost:create"
|
58
36
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
sleep 2
|
65
|
-
info "Done."
|
37
|
+
command :"virtualhost:remove" do |c|
|
38
|
+
c.syntax = "pave virtualhost:remove VHOST"
|
39
|
+
c.description = "Delete virtual host."
|
40
|
+
c.action do |args|
|
41
|
+
Pave::VirtualHost.new(args.first).remove_vhost
|
66
42
|
end
|
43
|
+
end
|
44
|
+
alias_command :"vh:remove", :"virtualhost:remove"
|
45
|
+
alias_command :"virtualhost:delete", :"virtualhost:remove"
|
46
|
+
alias_command :"vh:delete", :"virtualhost:remove"
|
67
47
|
|
68
|
-
|
48
|
+
command :"virtualhost:backup" do |c|
|
49
|
+
c.syntax = "pave virtualhost:backup VHOST"
|
50
|
+
c.description = "Back up virtual hosts file. Restore with `pave virtualhost:restore`."
|
51
|
+
c.action do |args|
|
52
|
+
Pave::VirtualHost.new(args.first).backup_vhost
|
53
|
+
end
|
54
|
+
end
|
55
|
+
alias_command :"vh:backup", :"virtualhost:backup"
|
56
|
+
|
57
|
+
command :"virtualhost:restore" do |c|
|
58
|
+
c.syntax = "pave virtualhost:restore VHOST"
|
59
|
+
c.description = "Restore previously backed up virtual hosts file."
|
60
|
+
c.action do |args|
|
61
|
+
Pave::VirtualHost.new(args.first).restore_vhost
|
62
|
+
end
|
63
|
+
end
|
64
|
+
alias_command :"vh:restore", :"virtualhost:restore"
|
69
65
|
|
70
|
-
|
66
|
+
command :"virtualhost:restart" do |c|
|
67
|
+
c.syntax = "pave virtualhost:restart VHOST"
|
68
|
+
c.description = "Restarts apache."
|
69
|
+
c.action do |args|
|
70
|
+
Pave::VirtualHost.new.restart_apache
|
71
|
+
end
|
72
|
+
end
|
71
73
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
# on("--[no-]switch","Some switch")
|
80
|
-
#
|
81
|
-
# Or, just call OptionParser methods on opts
|
82
|
-
#
|
83
|
-
# Require an argument
|
84
|
-
arg :command
|
85
|
-
#
|
86
|
-
# # Make an argument optional
|
87
|
-
arg :opt, :optional
|
74
|
+
command :"db:create" do |c|
|
75
|
+
c.syntax = "pave db:create"
|
76
|
+
c.description = "Create the Concrete5 project's database."
|
77
|
+
c.action do |args|
|
78
|
+
say "`db:create` command not implemented yet."
|
79
|
+
end
|
80
|
+
end
|
88
81
|
|
89
|
-
|
82
|
+
command :"db:dump" do |c|
|
83
|
+
c.syntax = "pave db:dump"
|
84
|
+
c.description = "Create SQL dump of the Concrete5 project's database."
|
85
|
+
c.action do |args|
|
86
|
+
say "`db:dump` command not implemented yet."
|
87
|
+
end
|
88
|
+
end
|
90
89
|
|
91
|
-
|
90
|
+
command :"db:download" do |c|
|
91
|
+
c.syntax = "pave db:download"
|
92
|
+
c.description = "Download the Concrete5 project's live database and replace local database."
|
93
|
+
c.action do |args|
|
94
|
+
say "`db:download` command not implemented yet."
|
95
|
+
end
|
96
|
+
end
|
92
97
|
|
93
|
-
|
98
|
+
command :"db:upload" do |c|
|
99
|
+
c.syntax = "pave db:upload"
|
100
|
+
c.description = "Upload the Concrete5 project's local database and replace the live database."
|
101
|
+
c.action do |args|
|
102
|
+
say "`db:upload` command not implemented yet."
|
103
|
+
end
|
94
104
|
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
module Pave
|
2
|
+
class Concrete
|
3
|
+
include Pave::Shell
|
4
|
+
|
5
|
+
attr_accessor :name
|
6
|
+
|
7
|
+
def self.create(name, options)
|
8
|
+
say ""
|
9
|
+
say "Setting up Concrete5 in folder #{name}."
|
10
|
+
new(name).setup
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(name)
|
14
|
+
@name = name
|
15
|
+
end
|
16
|
+
|
17
|
+
def setup
|
18
|
+
clone_concrete5
|
19
|
+
set_up_app_folder
|
20
|
+
initialize_git
|
21
|
+
create_virtual_host
|
22
|
+
self
|
23
|
+
end
|
24
|
+
|
25
|
+
def clone_concrete5
|
26
|
+
say "* Downloading Concrete5 version 5.6.2.1..."
|
27
|
+
sh "curl http://www.concrete5.org/download_file/-/view/58379/8497 -o c5.zip > /dev/null"
|
28
|
+
say ""
|
29
|
+
say "* Unzipping..."
|
30
|
+
sh "unzip c5.zip"
|
31
|
+
sh "rm c5.zip"
|
32
|
+
sh "mv concrete5.6.2.1 #{name}"
|
33
|
+
say "* Concrete5 downloaded and unzipped into ./#{name}."
|
34
|
+
end
|
35
|
+
|
36
|
+
def set_up_app_folder
|
37
|
+
say "* Setting up folders..."
|
38
|
+
sh "mkdir #{name}/app"
|
39
|
+
|
40
|
+
symlink_folders
|
41
|
+
remove_extra_folders
|
42
|
+
end
|
43
|
+
|
44
|
+
def initialize_git
|
45
|
+
say "* Setting up git..."
|
46
|
+
sh "echo 'files/cache/*' > #{name}/.gitignore"
|
47
|
+
sh "echo 'files/tmp/*' >> #{name}/.gitignore"
|
48
|
+
sh "cd #{name} && git init && git add -A && git commit -m 'Initial'"
|
49
|
+
end
|
50
|
+
|
51
|
+
def create_virtual_host
|
52
|
+
# /private/etc/apache2/extra/httpd-vhosts.conf
|
53
|
+
# <VirtualHost *:80>
|
54
|
+
# ServerName "mywebsite.site"
|
55
|
+
# DocumentRoot "<pwd>/mywebsite.dev"
|
56
|
+
# </VirtualHost>
|
57
|
+
end
|
58
|
+
|
59
|
+
def symlink_folders
|
60
|
+
symlinked_folders.each do |folder|
|
61
|
+
sh "mv #{name}/#{folder} #{name}/app/#{folder}"
|
62
|
+
sh "ln -s app/#{folder} #{name}/#{folder}"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def symlinked_folders
|
67
|
+
[
|
68
|
+
:blocks,
|
69
|
+
:elements,
|
70
|
+
:jobs,
|
71
|
+
:page_types,
|
72
|
+
:single_pages,
|
73
|
+
:themes,
|
74
|
+
:packages,
|
75
|
+
]
|
76
|
+
end
|
77
|
+
|
78
|
+
def remove_extra_folders
|
79
|
+
sh "rmdir #{name}/" + removed_folders.join(" #{name}/")
|
80
|
+
end
|
81
|
+
|
82
|
+
def removed_folders
|
83
|
+
[
|
84
|
+
:tools,
|
85
|
+
:libraries,
|
86
|
+
:models,
|
87
|
+
:css,
|
88
|
+
:controllers,
|
89
|
+
:helpers,
|
90
|
+
:js,
|
91
|
+
:languages,
|
92
|
+
:mail,
|
93
|
+
]
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
data/lib/pave/shell.rb
ADDED
data/lib/pave/version.rb
CHANGED
@@ -0,0 +1,170 @@
|
|
1
|
+
require "pave/shell"
|
2
|
+
require "fileutils"
|
3
|
+
|
4
|
+
module Pave
|
5
|
+
class VirtualHost
|
6
|
+
include Pave::Shell
|
7
|
+
|
8
|
+
attr_accessor :hostname
|
9
|
+
|
10
|
+
def initialize(host)
|
11
|
+
@hostname = host
|
12
|
+
end
|
13
|
+
|
14
|
+
def create_vhost
|
15
|
+
return say "No virtual host backup found. Run `pave vh:backup` before adding a virtual host." unless check_backup
|
16
|
+
|
17
|
+
add_vhost_to_conf && add_hosts_entry && restart_apache && say("Created virtual host for #{hostname}.")
|
18
|
+
end
|
19
|
+
|
20
|
+
def remove_vhost
|
21
|
+
return say "No virtual host backup found. Run `pave vh:backup` before adding a virtual host." unless check_backup
|
22
|
+
|
23
|
+
remove_vhost_from_conf && remove_hosts_entry && restart_apache && say("Removed virtual host for #{hostname}.")
|
24
|
+
end
|
25
|
+
|
26
|
+
def backup_vhost
|
27
|
+
File.delete(vhosts_conf_file_backup) if File.exist?(vhosts_conf_file_backup)
|
28
|
+
FileUtils.cp vhosts_conf_file, vhosts_conf_file_backup
|
29
|
+
File.delete(hosts_file_backup) if File.exist?(hosts_file_backup)
|
30
|
+
FileUtils.cp hosts_file, hosts_file_backup
|
31
|
+
say "Backed up vhosts conf and hosts file. Use `pave vh:restore` to restore them."
|
32
|
+
end
|
33
|
+
|
34
|
+
def restore_vhost
|
35
|
+
return say "Couldn't find vhosts backup." unless File.exist?(vhosts_conf_file_backup)
|
36
|
+
File.delete(vhosts_conf_file)
|
37
|
+
FileUtils.cp vhosts_conf_file_backup, vhosts_conf_file
|
38
|
+
|
39
|
+
return say "Couldn't find host file backup." unless File.exist?(hosts_file_backup)
|
40
|
+
File.delete(hosts_file)
|
41
|
+
FileUtils.cp hosts_file_backup, hosts_file
|
42
|
+
|
43
|
+
restart_apache
|
44
|
+
|
45
|
+
say "Restored vhosts conf and host file."
|
46
|
+
end
|
47
|
+
|
48
|
+
def restart_apache
|
49
|
+
code = sh "sudo apachectl restart"
|
50
|
+
say "Apache restarted."
|
51
|
+
true
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def add_hosts_entry
|
57
|
+
File.open(hosts_file, "a") do |f|
|
58
|
+
f.puts "127.0.0.1 #{hostname}"
|
59
|
+
f.puts "fe80::1%lo0 #{hostname}"
|
60
|
+
end
|
61
|
+
true
|
62
|
+
end
|
63
|
+
|
64
|
+
def remove_hosts_entry
|
65
|
+
host_array = hosts_file_array.map do |line|
|
66
|
+
if line.include?("127.0.0.1 #{hostname}") || line.include?("fe80::1%lo0 #{hostname}")
|
67
|
+
nil
|
68
|
+
else
|
69
|
+
line
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
File.open(hosts_file, "w") do |f|
|
74
|
+
f.puts host_array.compact.join("\n")
|
75
|
+
end
|
76
|
+
true
|
77
|
+
end
|
78
|
+
|
79
|
+
def add_vhost_to_conf
|
80
|
+
File.open(vhosts_conf_file, "a") do |f|
|
81
|
+
f.puts virtual_host_entry
|
82
|
+
end
|
83
|
+
true
|
84
|
+
end
|
85
|
+
|
86
|
+
def remove_vhost_from_conf
|
87
|
+
vhost_array = vhosts_file_array
|
88
|
+
vhost_line = vhost_array.index { |l| l.include?("ServerName \"#{hostname}\"") }
|
89
|
+
if vhost_line
|
90
|
+
# Sanity check
|
91
|
+
return say("Error: vhost appears malformed. Couldn't find \"<Directory\" on line #{vhost_line + 2}") unless vhost_array[vhost_line - 6].include?("<Directory")
|
92
|
+
return say("Error: vhost appears malformed. Couldn't find \"</VirtualHost>\" on line #{vhost_line + 2}") unless vhost_array[vhost_line + 2].include?("</VirtualHost")
|
93
|
+
|
94
|
+
# Set all those lines to nil (so we can compact them later)
|
95
|
+
((vhost_line - 6)..(vhost_line + 3)).each {|i| vhost_array[i] = nil }
|
96
|
+
File.open(vhosts_conf_file, "w") do |f|
|
97
|
+
f.puts vhost_array.compact.join("\n")
|
98
|
+
end
|
99
|
+
true
|
100
|
+
else
|
101
|
+
say "Didn't find #{hostname} in the vhost file."
|
102
|
+
false
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def check_backup
|
107
|
+
File.exist?(vhosts_conf_file_backup)
|
108
|
+
end
|
109
|
+
|
110
|
+
def virtual_host_entry
|
111
|
+
"\n<Directory \"#{project_folder}\">\n" <<
|
112
|
+
" Allow From All\n" <<
|
113
|
+
" AllowOverride All\n" <<
|
114
|
+
" Options +Indexes\n" <<
|
115
|
+
"</Directory>\n" <<
|
116
|
+
"<VirtualHost *:80>\n" <<
|
117
|
+
" ServerName \"#{hostname}\"\n" <<
|
118
|
+
" DocumentRoot \"#{project_folder}\"\n" <<
|
119
|
+
"</VirtualHost>\n"
|
120
|
+
end
|
121
|
+
|
122
|
+
def project_folder
|
123
|
+
Dir.getwd
|
124
|
+
end
|
125
|
+
|
126
|
+
def vhosts_file_array
|
127
|
+
File.open(vhosts_conf_file).map {|l| l.rstrip}
|
128
|
+
end
|
129
|
+
|
130
|
+
def hosts_file_array
|
131
|
+
File.open(hosts_file).map {|l| l.rstrip}
|
132
|
+
end
|
133
|
+
|
134
|
+
def vhosts_conf_file
|
135
|
+
"/etc/apache2/extra/httpd-vhosts.conf"
|
136
|
+
end
|
137
|
+
|
138
|
+
def vhosts_conf_file_backup
|
139
|
+
vhosts_conf_file + ".backup"
|
140
|
+
end
|
141
|
+
|
142
|
+
def hosts_file
|
143
|
+
"/etc/hosts"
|
144
|
+
end
|
145
|
+
|
146
|
+
def hosts_file_backup
|
147
|
+
hosts_file + ".backup"
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
|
154
|
+
# /etc/apache2/extra/httpd-vhosts.conf
|
155
|
+
# <Directory "/Users/jh/Code/Web/fishalaskamagazine.dev/">
|
156
|
+
# Allow From All
|
157
|
+
# AllowOverride All
|
158
|
+
# Options +Indexes
|
159
|
+
# </Directory>
|
160
|
+
# <VirtualHost *:80>
|
161
|
+
# ServerName "fishalaskamag.site"
|
162
|
+
# DocumentRoot "/Users/jh/Code/Web/fishalaskamagazine.dev"
|
163
|
+
# </VirtualHost>
|
164
|
+
|
165
|
+
# Update hosts file with IP
|
166
|
+
# sudo apachectl restart
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
data/lib/pave.rb
CHANGED
@@ -1,99 +1,14 @@
|
|
1
|
+
require "commander/import"
|
1
2
|
require "pave/version"
|
3
|
+
require "pave/shell"
|
4
|
+
require "pave/concrete"
|
5
|
+
require "pave/virtual_host"
|
2
6
|
|
3
7
|
module Pave
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
attr_accessor :name
|
9
|
-
|
10
|
-
def self.create(name)
|
11
|
-
info ""
|
12
|
-
info "Setting up Concrete5 in folder #{name}."
|
13
|
-
new(name).setup
|
14
|
-
end
|
15
|
-
|
16
|
-
def initialize(name)
|
17
|
-
@name = name
|
18
|
-
end
|
19
|
-
|
20
|
-
def setup
|
21
|
-
clone_concrete5
|
22
|
-
set_up_app_folder
|
23
|
-
initialize_git
|
24
|
-
create_virtual_host
|
25
|
-
self
|
26
|
-
end
|
27
|
-
|
28
|
-
def clone_concrete5
|
29
|
-
info "* Downloading Concrete5 version 5.6.2.1..."
|
30
|
-
sh "curl http://www.concrete5.org/download_file/-/view/58379/8497 -o c5.zip > /dev/null"
|
31
|
-
info ""
|
32
|
-
info "* Unzipping..."
|
33
|
-
sh "unzip c5.zip"
|
34
|
-
sh "rm c5.zip"
|
35
|
-
sh "mv concrete5.6.2.1 #{name}"
|
36
|
-
info "* Concrete5 downloaded and unzipped into ./#{name}."
|
37
|
-
end
|
38
|
-
|
39
|
-
def set_up_app_folder
|
40
|
-
info "* Setting up folders..."
|
41
|
-
sh "mkdir #{name}/app"
|
42
|
-
|
43
|
-
symlink_folders
|
44
|
-
remove_extra_folders
|
45
|
-
end
|
46
|
-
|
47
|
-
def initialize_git
|
48
|
-
info "* Setting up git..."
|
49
|
-
sh "echo 'files/cache/*' > #{name}/.gitignore"
|
50
|
-
sh "echo 'files/tmp/*' >> #{name}/.gitignore"
|
51
|
-
sh "cd #{name} && git init && git add -A && git commit -m 'Initial'"
|
52
|
-
end
|
53
|
-
|
54
|
-
def create_virtual_host
|
55
|
-
# /private/etc/apache2/extra/httpd-vhosts.conf
|
56
|
-
# <VirtualHost *:80>
|
57
|
-
# ServerName "mywebsite.site"
|
58
|
-
# DocumentRoot "<pwd>/mywebsite.dev"
|
59
|
-
# </VirtualHost>
|
60
|
-
end
|
61
|
-
|
62
|
-
def symlink_folders
|
63
|
-
symlinked_folders.each do |folder|
|
64
|
-
sh "mv #{name}/#{folder} #{name}/app/#{folder}"
|
65
|
-
sh "ln -s app/#{folder} #{name}/#{folder}"
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def symlinked_folders
|
70
|
-
[
|
71
|
-
:blocks,
|
72
|
-
:elements,
|
73
|
-
:jobs,
|
74
|
-
:page_types,
|
75
|
-
:single_pages,
|
76
|
-
:themes,
|
77
|
-
:packages,
|
78
|
-
]
|
79
|
-
end
|
80
|
-
|
81
|
-
def remove_extra_folders
|
82
|
-
sh "rmdir #{name}/" + removed_folders.join(" #{name}/")
|
83
|
-
end
|
84
|
-
|
85
|
-
def removed_folders
|
86
|
-
[
|
87
|
-
:tools,
|
88
|
-
:libraries,
|
89
|
-
:models,
|
90
|
-
:css,
|
91
|
-
:controllers,
|
92
|
-
:helpers,
|
93
|
-
:js,
|
94
|
-
:languages,
|
95
|
-
:mail,
|
96
|
-
]
|
97
|
-
end
|
8
|
+
def update
|
9
|
+
say "Updating pave..."
|
10
|
+
`gem update pave`
|
11
|
+
($? == 0) ? (say "Updated") : (say "Update failed. Run `gem update pave` manually.")
|
98
12
|
end
|
13
|
+
module_function :update
|
99
14
|
end
|
data/pave.gemspec
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require "pave/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "pave"
|
8
8
|
spec.version = Pave::VERSION
|
9
|
-
spec.authors = ["Jamon Holmgren"]
|
10
|
-
spec.email = ["jamon@clearsightstudio.com"]
|
9
|
+
spec.authors = ["Jamon Holmgren", "Ryan Linton"]
|
10
|
+
spec.email = ["jamon@clearsightstudio.com", "ryanl@clearsightstudio.com"]
|
11
11
|
spec.description = %q{Provides a set of command line tools for Concrete5.}
|
12
12
|
spec.summary = %q{Provides a set of command line tools for Concrete5.}
|
13
13
|
spec.homepage = "https://github.com/jamonholmgren/pave"
|
@@ -18,9 +18,9 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency(
|
24
|
-
spec.add_development_dependency(
|
25
|
-
spec.add_dependency(
|
21
|
+
spec.add_development_dependency("bundler", "~> 1.3")
|
22
|
+
spec.add_development_dependency("rake")
|
23
|
+
spec.add_development_dependency("rdoc")
|
24
|
+
spec.add_development_dependency("rake", "~> 0.9.2")
|
25
|
+
spec.add_dependency("commander", "~> 4.1.5")
|
26
26
|
end
|
data/test/pave_test.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pave
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamon Holmgren
|
8
|
+
- Ryan Linton
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-
|
12
|
+
date: 2013-11-20 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
@@ -67,28 +68,30 @@ dependencies:
|
|
67
68
|
- !ruby/object:Gem::Version
|
68
69
|
version: 0.9.2
|
69
70
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
71
|
+
name: commander
|
71
72
|
requirement: !ruby/object:Gem::Requirement
|
72
73
|
requirements:
|
73
74
|
- - ~>
|
74
75
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
76
|
+
version: 4.1.5
|
76
77
|
type: :runtime
|
77
78
|
prerelease: false
|
78
79
|
version_requirements: !ruby/object:Gem::Requirement
|
79
80
|
requirements:
|
80
81
|
- - ~>
|
81
82
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
83
|
+
version: 4.1.5
|
83
84
|
description: Provides a set of command line tools for Concrete5.
|
84
85
|
email:
|
85
86
|
- jamon@clearsightstudio.com
|
87
|
+
- ryanl@clearsightstudio.com
|
86
88
|
executables:
|
87
89
|
- pave
|
88
90
|
extensions: []
|
89
91
|
extra_rdoc_files: []
|
90
92
|
files:
|
91
93
|
- .gitignore
|
94
|
+
- .ruby-version
|
92
95
|
- Gemfile
|
93
96
|
- Gemfile.lock
|
94
97
|
- LICENSE.txt
|
@@ -96,10 +99,12 @@ files:
|
|
96
99
|
- Rakefile
|
97
100
|
- bin/pave
|
98
101
|
- lib/pave.rb
|
102
|
+
- lib/pave/concrete.rb
|
103
|
+
- lib/pave/shell.rb
|
99
104
|
- lib/pave/version.rb
|
105
|
+
- lib/pave/virtual_host.rb
|
100
106
|
- pave.gemspec
|
101
107
|
- test/pave_test.rb
|
102
|
-
- test/tc_something.rb
|
103
108
|
homepage: https://github.com/jamonholmgren/pave
|
104
109
|
licenses:
|
105
110
|
- MIT
|
@@ -120,10 +125,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
125
|
version: '0'
|
121
126
|
requirements: []
|
122
127
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.
|
128
|
+
rubygems_version: 2.0.3
|
124
129
|
signing_key:
|
125
130
|
specification_version: 4
|
126
131
|
summary: Provides a set of command line tools for Concrete5.
|
127
132
|
test_files:
|
128
133
|
- test/pave_test.rb
|
129
|
-
- test/tc_something.rb
|