pave 0.13.0 → 0.14.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9aa6d9f3f5753a826b0fd82bf27a385bf9c4ca9a
4
- data.tar.gz: 9ea1ce191daf766aabc27136ed78c61c4669a031
3
+ metadata.gz: 6423c30e10bd3cce7b5c9553be520a618a3b1dbc
4
+ data.tar.gz: 4d8f1ceccab04847564725e83db66cff7b998904
5
5
  SHA512:
6
- metadata.gz: d575b3350c7758339e8ac7dad825d6125ab03a48b32436f08d61570e9040f29cf2627f83721df1a21d61aed8ec84484583a051486a98136b8190fd1b25b50680
7
- data.tar.gz: 0ee8107ee3a592f105d1001d7dd7c21540337d1f6ee37949ddeaf3e36742cbf73cd7fc9c681e575e22bf43a1c69343538f7fe235b982e8db9eec611c61c63847
6
+ metadata.gz: c6f5c361651019a1f86b4753e6359a5ba1c8d1840eccca9ab27139fd73272acf6564c9031471b4bc1a9292ff7492af6f46fb738cff19c89e279244c2762572a2
7
+ data.tar.gz: 51d878220d60ea3dab49d55a3ad4e719d99f56311f025dd9b1b1557dc79e2ad8aed398028ae11b913f2427a07e2161f687f0e3ffe82486fcaf4d7bd54237bbfd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pave (0.12.1)
4
+ pave (0.13.0)
5
5
  commander (~> 4.1)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -24,7 +24,7 @@ This:
24
24
  4. Adds a `.gitignore` and `.keep`s
25
25
  5. Attempts to create a virtual host `mywebsite.site`
26
26
 
27
- ## Deployments
27
+ ## Deployment
28
28
 
29
29
  $ pave deploy:setup
30
30
 
@@ -40,9 +40,9 @@ Deploys feature-branch to staging remote.
40
40
 
41
41
  ## Database
42
42
 
43
- $ pave db:create mydatabase
43
+ $ pave db:create [mydatabase]
44
44
 
45
- Creates a local MySQL database called `mydatabase`
45
+ Creates a local MySQL database called `mydatabase`. Omitting the database name will create a database with the same name as the current directory.
46
46
 
47
47
  $ pave db:push
48
48
 
@@ -70,13 +70,13 @@ Pulls the remote `files/*` folder and replaces your local version.
70
70
 
71
71
  *TODO:* Pulls newer remote files and pushes newer local files. Ignores cache and tmp files.
72
72
 
73
- ## Virtual host setup
73
+ ## Virtual Host
74
74
 
75
- $ sudo pave vh:create myhost.site
75
+ $ sudo pave vh:create [myhost.site]
76
76
 
77
- Sets up an Apache virtual host in the current directory on `myhost.site`.
77
+ Sets up an Apache virtual host in the current directory on `myhost.site`. Omitting the hostname argument will create a virtual host with the same name as the current directory (i.e. `myapp.site` if the current directory is `myapp`).
78
78
 
79
- $ sudo pave vh:remove myhost.site
79
+ $ sudo pave vh:remove [myhost.site]
80
80
 
81
81
  Removes myhost.site virtual host.
82
82
 
@@ -92,6 +92,16 @@ Restores your previously backed up virtual host file.
92
92
 
93
93
  Restarts Apache.
94
94
 
95
+ ## Themes
96
+
97
+ $ pave g:theme [mytheme]
98
+
99
+ Generates a theme in with the name `mytheme` in the `theme` directory. Omitting the theme name will create a theme with the same name as the current directory.
100
+
101
+ $ pave watch [browser] [mytheme]
102
+
103
+ Watches for changes in the `mytheme` directory. Compiles SASS and CoffeeScript files when they change and reloads the browser. The default the browser is Chrome but Safari and Firefox are also supported. A theme with the same name as the current directory is assumed unless a theme name is specified.
104
+
95
105
  ## Help
96
106
 
97
107
  $ pave help
data/bin/pave CHANGED
@@ -77,7 +77,8 @@ command :"virtualhost:create" do |c|
77
77
  c.description = "Setup virtual host for Concrete5 project."
78
78
  c.action do |args|
79
79
  host = args.first || "#{File.basename(Dir.pwd)}.site"
80
- Pave::VirtualHost.new(host).create_vhost
80
+ dir = args[1] || Dir.pwd
81
+ Pave::VirtualHost.new(host, dir).create_vhost
81
82
  end
82
83
  end
83
84
  alias_command :"vh:create", :"virtualhost:create"
@@ -87,7 +88,8 @@ command :"virtualhost:remove" do |c|
87
88
  c.description = "Delete virtual host."
88
89
  c.action do |args|
89
90
  host = args.first || "#{File.basename(Dir.pwd)}.site"
90
- Pave::VirtualHost.new(host).remove_vhost
91
+ dir = args[1] || Dir.pwd
92
+ Pave::VirtualHost.new(host, dir).remove_vhost
91
93
  end
92
94
  end
93
95
  alias_command :"vh:remove", :"virtualhost:remove"
@@ -98,7 +100,7 @@ command :"virtualhost:backup" do |c|
98
100
  c.syntax = "pave virtualhost:backup"
99
101
  c.description = "Back up virtual hosts file. Restore with `pave virtualhost:restore`."
100
102
  c.action do
101
- Pave::VirtualHost.new("").backup_vhost
103
+ Pave::VirtualHost.backup_vhost
102
104
  end
103
105
  end
104
106
  alias_command :"vh:backup", :"virtualhost:backup"
@@ -107,7 +109,7 @@ command :"virtualhost:restore" do |c|
107
109
  c.syntax = "pave virtualhost:restore"
108
110
  c.description = "Restore previously backed up virtual hosts file."
109
111
  c.action do
110
- Pave::VirtualHost.new("").restore_vhost
112
+ Pave::VirtualHost.restore_vhost
111
113
  end
112
114
  end
113
115
  alias_command :"vh:restore", :"virtualhost:restore"
@@ -116,7 +118,7 @@ command :"virtualhost:restart" do |c|
116
118
  c.syntax = "pave virtualhost:restart"
117
119
  c.description = "Restarts apache."
118
120
  c.action do
119
- Pave::VirtualHost.new("").restart_apache
121
+ Pave::VirtualHost.restart_apache
120
122
  end
121
123
  end
122
124
  alias_command :"vh:restart", :"virtualhost:restart"
@@ -242,7 +244,7 @@ end
242
244
 
243
245
  command :"generate:theme" do |c|
244
246
  c.syntax = "pave generate:theme THEME_NAME"
245
- c.description = "Set up a blank theme with sass."
247
+ c.description = "Set up a blank theme with Sass and CoffeeScript support."
246
248
  c.action do |args|
247
249
  name = args.first || "#{File.basename(Dir.pwd)}"
248
250
  Pave::Theme.create(name)
@@ -252,7 +254,7 @@ alias_command :"g:theme", :"generate:theme"
252
254
 
253
255
  command :watch do |c|
254
256
  c.syntax = "pave watch BROWSER"
255
- c.description = "Watch for sass changes."
257
+ c.description = "Watch for Sass and CoffeeScript changes."
256
258
  c.action do |args|
257
259
  browser = args.first || "chrome"
258
260
  name = args.last || "#{File.basename(Dir.pwd)}"
data/lib/pave/concrete.rb CHANGED
@@ -86,10 +86,10 @@ HD
86
86
 
87
87
  def create_virtual_host
88
88
  say "* Setting up virtual host..."
89
- if sh("sudo pave vh:create #{name}.site") == 0
89
+ if sh("sudo pave vh:create #{name}.site #{Dir.pwd}/#{name}") == 0
90
90
  say "Successfully setup virtual host #{name}.site."
91
91
  else
92
- say "Virtual host not set up. Run `pave vh:create #{name}.site` to create it."
92
+ say "Virtual host not set up. Run `pave vh:create #{name}.site ./#{name}` to create it."
93
93
  end
94
94
  end
95
95
 
data/lib/pave/theme.rb CHANGED
@@ -36,7 +36,7 @@ module Pave
36
36
  end
37
37
 
38
38
  def install_bitters
39
- say "Installing Bitters"
39
+ say "Installing Bitters..."
40
40
  sh "gem install bitters"
41
41
  sh "cd themes/#{self.name}/css/ && bitters install && cd -"
42
42
  end
@@ -59,8 +59,9 @@ module Pave
59
59
  install_neat
60
60
  install_bitters
61
61
  create_project_css_folders
62
+ say "Docs for Bourbon: http://bourbon.io/docs/"
62
63
  say "Docs for Neat: http://neat.bourbon.io/"
63
- say "Docs for Bitters: https://github.com/thoughtbot/bitters"
64
+ say "Docs for Bitters: http://bitters.bourbon.io/"
64
65
  say ""
65
66
  say "Theme installed. Run `pave watch` to generate css from your sass files."
66
67
  end
data/lib/pave/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pave
2
- VERSION = "0.13.0"
2
+ VERSION = "0.14.0"
3
3
  end
@@ -4,34 +4,40 @@ module Pave
4
4
  class VirtualHost
5
5
  include Pave::Shell
6
6
 
7
- attr_accessor :hostname
7
+ attr_accessor :hostname, :directory
8
8
 
9
- def initialize(host)
9
+ VHOST_CONF_FILE = "/etc/apache2/extra/httpd-vhosts.conf".freeze
10
+ VHOST_CONF_FILE_BACKUP = "#{VHOST_CONF_FILE}.backup".freeze
11
+ HOSTS_FILE = "/etc/hosts".freeze
12
+ HOSTS_FILE_BACKUP = "#{HOSTS_FILE}.backup".freeze
13
+
14
+ def initialize(host, dir)
10
15
  @hostname = host
16
+ @directory = dir
11
17
  end
12
18
 
13
- def restart_apache
19
+ def self.restart_apache
14
20
  `sudo apachectl restart`
15
21
  say "Apache restarted."
16
22
  true
17
23
  end
18
24
 
19
- def backup_vhost
20
- File.delete(vhosts_conf_file_backup) if File.exist?(vhosts_conf_file_backup)
21
- FileUtils.cp vhosts_conf_file, vhosts_conf_file_backup
22
- File.delete(hosts_file_backup) if File.exist?(hosts_file_backup)
23
- FileUtils.cp hosts_file, hosts_file_backup
25
+ def self.backup_vhost
26
+ File.delete(VHOST_CONF_FILE_BACKUP) if File.exist?(VHOST_CONF_FILE_BACKUP)
27
+ FileUtils.cp VHOST_CONF_FILE, VHOST_CONF_FILE_BACKUP
28
+ File.delete(HOSTS_FILE_BACKUP) if File.exist?(HOSTS_FILE_BACKUP)
29
+ FileUtils.cp HOSTS_FILE, HOSTS_FILE_BACKUP
24
30
  say "Backed up vhosts conf and hosts file. Use `pave vh:restore` to restore them."
25
31
  end
26
32
 
27
- def restore_vhost
28
- return say "Couldn't find vhosts backup." unless File.exist?(vhosts_conf_file_backup)
29
- File.delete(vhosts_conf_file)
30
- FileUtils.cp vhosts_conf_file_backup, vhosts_conf_file
33
+ def self.restore_vhost
34
+ return say "Couldn't find vhosts backup." unless File.exist?(VHOST_CONF_FILE_BACKUP)
35
+ File.delete(VHOST_CONF_FILE)
36
+ FileUtils.cp VHOST_CONF_FILE_BACKUP, VHOST_CONF_FILE
31
37
 
32
- return say "Couldn't find host file backup." unless File.exist?(hosts_file_backup)
33
- File.delete(hosts_file)
34
- FileUtils.cp hosts_file_backup, hosts_file
38
+ return say "Couldn't find host file backup." unless File.exist?(HOSTS_FILE_BACKUP)
39
+ File.delete(HOSTS_FILE)
40
+ FileUtils.cp HOSTS_FILE_BACKUP, HOSTS_FILE
35
41
 
36
42
  restart_apache
37
43
 
@@ -42,19 +48,19 @@ module Pave
42
48
  return say "No virtual host backup found. Run `pave vh:backup` before adding a virtual host." unless check_backup
43
49
  return say "No host name provided. Run `pave help` for more details." unless hostname.size > 0
44
50
 
45
- add_vhost_to_conf && add_hosts_entry && restart_apache && say("Created virtual host for #{hostname}.")
51
+ add_vhost_to_conf && add_hosts_entry && self.class.restart_apache && say("Created virtual host for #{hostname}.")
46
52
  end
47
53
 
48
54
  def remove_vhost
49
55
  return say "No virtual host backup found. Run `pave vh:backup` before adding a virtual host." unless check_backup
50
56
 
51
- remove_vhost_from_conf && remove_hosts_entry && restart_apache && say("Removed virtual host for #{hostname}.")
57
+ remove_vhost_from_conf && remove_hosts_entry && self.class.restart_apache && say("Removed virtual host for #{hostname}.")
52
58
  end
53
59
 
54
60
  private
55
61
 
56
62
  def add_hosts_entry
57
- File.open(hosts_file, "a") do |f|
63
+ File.open(HOSTS_FILE, "a") do |f|
58
64
  f.puts "127.0.0.1 #{hostname}"
59
65
  f.puts "fe80::1%lo0 #{hostname}"
60
66
  end
@@ -70,14 +76,14 @@ module Pave
70
76
  end
71
77
  end
72
78
 
73
- File.open(hosts_file, "w") do |f|
79
+ File.open(HOSTS_FILE, "w") do |f|
74
80
  f.puts host_array.compact.join("\n")
75
81
  end
76
82
  true
77
83
  end
78
84
 
79
85
  def add_vhost_to_conf
80
- File.open(vhosts_conf_file, "a") do |f|
86
+ File.open(VHOST_CONF_FILE, "a") do |f|
81
87
  f.puts virtual_host_entry
82
88
  end
83
89
  true
@@ -93,7 +99,7 @@ module Pave
93
99
 
94
100
  # Set all those lines to nil (so we can compact them later)
95
101
  ((vhost_line - 6)..(vhost_line + 3)).each {|i| vhost_array[i] = nil }
96
- File.open(vhosts_conf_file, "w") do |f|
102
+ File.open(VHOST_CONF_FILE, "w") do |f|
97
103
  f.puts vhost_array.compact.join("\n")
98
104
  end
99
105
  true
@@ -104,47 +110,27 @@ module Pave
104
110
  end
105
111
 
106
112
  def check_backup
107
- File.exist?(vhosts_conf_file_backup)
113
+ File.exist?(VHOST_CONF_FILE_BACKUP)
108
114
  end
109
115
 
110
116
  def virtual_host_entry
111
- "\n<Directory \"#{project_folder}\">\n" <<
117
+ "\n<Directory \"#{directory}\">\n" <<
112
118
  " Allow From All\n" <<
113
119
  " AllowOverride All\n" <<
114
120
  " Options +Indexes\n" <<
115
121
  "</Directory>\n" <<
116
122
  "<VirtualHost *:80>\n" <<
117
123
  " ServerName \"#{hostname}\"\n" <<
118
- " DocumentRoot \"#{project_folder}\"\n" <<
124
+ " DocumentRoot \"#{directory}\"\n" <<
119
125
  "</VirtualHost>\n"
120
126
  end
121
127
 
122
- def project_folder
123
- Dir.pwd
124
- end
125
-
126
128
  def vhosts_file_array
127
- File.open(vhosts_conf_file).map {|l| l.rstrip}
129
+ File.open(VHOST_CONF_FILE).map(&:rstrip)
128
130
  end
129
131
 
130
132
  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"
133
+ File.open(HOSTS_FILE).map(&:rstrip)
148
134
  end
149
135
 
150
136
  end
@@ -1,12 +1,12 @@
1
- <?php
1
+ <?
2
2
  defined("C5_EXECUTE") or die("Access Denied.");
3
3
  $this->inc("elements/header.php");
4
4
  ?>
5
5
 
6
6
  <!-- block example -->
7
- <?php
7
+ <?
8
8
  $a = new Area("Main");
9
9
  $a->display($c);
10
10
  ?>
11
11
 
12
- <?php $this->inc("elements/footer.php"); ?>
12
+ <? $this->inc("elements/footer.php"); ?>
@@ -1,12 +1,12 @@
1
- <?php defined("C5_EXECUTE") or die("Access Denied."); ?>
1
+ <? defined("C5_EXECUTE") or die("Access Denied."); ?>
2
2
 
3
3
  <!-- block example -->
4
- <?php
4
+ <?
5
5
  $a = new GlobalArea("Footer - Meta");
6
6
  $a->display($c);
7
7
  ?>
8
8
 
9
- <?php Loader::element("footer_required"); ?>
9
+ <? Loader::element("footer_required"); ?>
10
10
  <script src="<?= $this->getThemePath(); ?>/js/shared.js"></script>
11
11
  <?= page_specific_scripts($c, $this) ?>
12
12
  </body>
@@ -1,9 +1,9 @@
1
- <?php
1
+ <?
2
2
  defined("C5_EXECUTE") or die("Access Denied.");
3
3
  $this->inc("includes/view_helpers.php");
4
4
  ?>
5
5
  <!DOCTYPE html>
6
- <html lang="<?= LANGUAGE?>">
6
+ <html lang="<?= LANGUAGE ?>">
7
7
  <head>
8
8
  <?php Loader::element("header_required"); ?>
9
9
  <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
@@ -22,13 +22,13 @@
22
22
  <?= image_tag($this, "logo.png", ["class" => "main-logo"]); ?>
23
23
 
24
24
  <!-- block example -->
25
- <?php
25
+ <?
26
26
  $a = new Area("Header");
27
27
  $a->display($c);
28
28
  ?>
29
29
 
30
30
  <!-- nav example -->
31
- <?php
31
+ <?
32
32
  $nav = BlockType::getByHandle("autonav");
33
33
  $nav->controller->orderBy = "display_asc";
34
34
  $nav->controller->displayPages = "top";
@@ -36,4 +36,4 @@
36
36
  $nav->controller->displaySubPageLevels = "custom";
37
37
  $nav->controller->displaySubPageLevelsNum = 1;
38
38
  $nav->render("templates/header_menu");
39
- ?>
39
+ ?>
@@ -5,7 +5,7 @@
5
5
  echo "<pre>";
6
6
  if($die) {
7
7
  die();
8
- };
8
+ }
9
9
  }
10
10
 
11
11
  function is_edit_mode() {
@@ -40,6 +40,7 @@
40
40
 
41
41
  function image_tag($t, $img, $html_options = false) {
42
42
  $imgPath = ($t->getThemePath()) . "/images/";
43
+
43
44
  if ($html_options) {
44
45
  $options = " alt='" . explode(".", $img, 2)[0] . "'";
45
46
  foreach ($html_options as $k => $v) {
@@ -47,8 +48,49 @@
47
48
  }
48
49
  } else {
49
50
  $options = " alt='" . explode(".", $img, 2)[0] . "'";
50
- };
51
- echo "<img src='" . $imgPath . $img . "'" . $options . " />";
51
+ }
52
+
53
+ return "<img src='" . $imgPath . $img . "'" . $options . " />";
54
+ }
55
+
56
+ function image_placeholder_tag($width, $height = false, $text = false, $html_options = false) {
57
+ $img = "http://placehold.it/" . $width . ($height ? "x" . $height : "") . ($text ? "&text=" . $text : "");
58
+
59
+ if ($html_options) {
60
+ foreach ($html_options as $k => $v) {
61
+ $options .= " " . $k . "='" . addslashes($v) . "'";
62
+ }
63
+ }
64
+
65
+ return "<img src='" . $img . "'" . $options . " />";
66
+ }
67
+
68
+ function lorem() {
69
+ // Possible arguments:
70
+ //
71
+ // (integer) - The number of paragraphs to generate.
72
+ // short, medium, long, verylong - The average length of a paragraph.
73
+ // decorate - Add bold, italic and marked text.
74
+ // link - Add links.
75
+ // ul - Add unordered lists.
76
+ // ol - Add numbered lists.
77
+ // dl - Add description lists.
78
+ // bq - Add blockquotes.
79
+ // code - Add code samples.
80
+ // headers - Add headers.
81
+ // allcaps - Use ALL CAPS.
82
+ // prude - Prude version.
83
+ // plaintext - Return plain text, no HTML.
84
+ //
85
+ // See http://loripsum.net/ for more details.
86
+
87
+ $url = "http://loripsum.net/api/";
88
+ if (func_num_args()) {
89
+ $url .= implode("/", func_get_args());
90
+ } else {
91
+ $url .= "1";
92
+ }
93
+ return file_get_contents($url);
52
94
  }
53
95
 
54
96
  function page_specific_scripts($page, $t) {
@@ -1,8 +1,8 @@
1
- <?php
2
- defined("C5_EXECUTE") or die("Access Denied.");
3
- $this->inc("elements/header.php");
1
+ <?
2
+ defined("C5_EXECUTE") or die("Access Denied.");
3
+ $this->inc("elements/header.php");
4
4
  ?>
5
5
 
6
- <?php print $innerContent; ?>
6
+ <? print $innerContent; ?>
7
7
 
8
- <?php $this->inc("elements/footer.php"); ?>
8
+ <? $this->inc("elements/footer.php"); ?>
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.13.0
4
+ version: 0.14.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: 2014-05-22 00:00:00.000000000 Z
12
+ date: 2014-05-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler