summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorJade Dominguez <plusjade@gmail.com>2012-02-01 17:26:01 -0800
committerJade Dominguez <plusjade@gmail.com>2012-02-01 17:26:01 -0800
commitfdfb9c4c6fda97f213320005abff731f79ef822b (patch)
treec8c19bd4b5c54261953e3aca16b33cd5de813f5b /Rakefile
parent533d840a7556217ebc8250e157de843b9a9f5f04 (diff)
Fix prompt complaining that directories already exist
When installing from a theme package we create an array of all files to be mirrored. We need to omit directories from this array since directories are recursively created for a given file. This needlessly raised 'directory already exist' errors which was annoying. - Also make error output friendlier
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile23
1 files changed, 18 insertions, 5 deletions
diff --git a/Rakefile b/Rakefile
index fe7a9d1..de6e2a9 100644
--- a/Rakefile
+++ b/Rakefile
@@ -134,6 +134,9 @@ namespace :theme do
page.puts "{% include themes/#{theme_name}/#{File.basename(filename)} %}"
end
end
+
+ puts "=> Theme successfully switched!"
+ puts "=> Reload your web-page to check it out =)"
end # task :switch
# Public: Install a theme using the theme packager.
@@ -160,16 +163,26 @@ namespace :theme do
packaged_theme_path = JB::Path.build(:theme_packages, :node => name)
- abort("rake aborted: name cannot be blank") if name.empty?
- abort("rake aborted: '#{packaged_theme_path}' directory not found.") unless FileTest.directory?(packaged_theme_path)
+ abort("rake aborted!
+ => ERROR: 'name' cannot be blank") if name.empty?
+ abort("rake aborted!
+ => ERROR: '#{packaged_theme_path}' directory not found.
+ => Installable themes can be added via git. You can find some here: http://github.com/jekyllbootstrap
+ => To download+install run: `rake theme:install git='[PUBLIC-CLONE-URL]'`
+ => example : rake theme:install git='git@github.com:jekyllbootstrap/theme-the-program.git'
+ ") unless FileTest.directory?(packaged_theme_path)
manifest = verify_manifest(packaged_theme_path)
# Get relative paths to packaged theme files
+ # Exclude directories as they'll be recursively created. Exclude meta-data files.
packaged_theme_files = []
- FileUtils.cd(packaged_theme_path) { packaged_theme_files += Dir["**/*.*"] }
- # Don't install metadata files.
- packaged_theme_files.delete_if { |f| f =~ /^(manifest|readme|packager)/i }
+ FileUtils.cd(packaged_theme_path) {
+ Dir.glob("**/*.*") { |f|
+ next if ( FileTest.directory?(f) || f =~ /^(manifest|readme|packager)/i )
+ packaged_theme_files << f
+ }
+ }
# Mirror each file into the framework making sure to prompt if already exists.
packaged_theme_files.each do |filename|