Browse code

Removes system specific File IO from Rakefile, rather we make use of FileUtils.

Benjamin R Doerr authored on 23/08/2011 at 02:46:04
Showing 1 changed files
... ...
@@ -124,7 +124,7 @@ end
124 124
 
125 125
 desc "Clean out caches: _code_cache, _gist_cache, .sass-cache"
126 126
 task :clean do
127
-  system "rm -rf _code_cache/** _gist_cache/** .sass-cache/** source/stylesheets/screen.css"
127
+  rm_rf ["_code_cache/**", "_gist_cache/**", ".sass-cache/**", "source/stylesheets/screen.css"]
128 128
 end
129 129
 
130 130
 desc "Move sass to sass.old, install sass theme updates, replace sass/custom with sass.old/custom"
... ...
@@ -132,12 +132,12 @@ task :update_style, :theme do |t, args|
132 132
   theme = args.theme || 'classic'
133 133
   if File.directory?("sass.old")
134 134
     puts "removed existing sass.old directory"
135
-    system "rm -r sass.old"
135
+    rm_r "sass.old", :secure=>true
136 136
   end
137
-  system "mv sass sass.old"
137
+  mv "sass", "sass.old"
138 138
   puts "## Moved styles into sass.old/"
139
-  system "mkdir -p sass"
140
-  system "cp -R #{themes_dir}/"+theme+"/sass/ sass/"
139
+  mkdir_p "sass"
140
+  cp_r "#{themes_dir}/"+theme+"/sass/", "sass"
141 141
   cp_r "sass.old/custom/.", "sass/custom"
142 142
   puts "## Updated Sass ##"
143 143
 end
... ...
@@ -147,16 +147,16 @@ task :update_source, :theme do |t, args|
147 147
   theme = args.theme || 'classic'
148 148
   if File.directory?("#{source_dir}.old")
149 149
     puts "removed existing #{source_dir}.old directory"
150
-    system "rm -r #{source_dir}.old"
150
+    rm_r "#{source_dir}.old", :secure=>true
151 151
   end
152
-  system "mv #{source_dir} #{source_dir}.old"
152
+  mv source_dir, "#{source_dir}.old"
153 153
   puts "moved #{source_dir} into #{source_dir}.old/"
154
-  system "mkdir -p #{source_dir}" 
155
-  system "cp -R #{themes_dir}/"+theme+"/source/. #{source_dir}"
156
-  system "cp -Rn #{source_dir}.old/. #{source_dir}"
157
-  system "cp -Rf #{source_dir}.old/_includes/custom/. #{source_dir}/_includes/custom/"
158
-  system "mv -f #{source_dir}/index.html #{blog_index_dir}" if blog_index_dir != source_dir
159
-  system "cp -f #{source_dir}.old/index.html #{source_dir}" if blog_index_dir != source_dir
154
+  mkdir_p source_dir
155
+  cp_r "#{themes_dir}/"+theme+"/source/.", source_dir
156
+  cp_r "#{source_dir}.old/.", source_dir, :preserve=>true
157
+  cp_r "#{source_dir}.old/_includes/custom/.", "#{source_dir}/_includes/custom/"
158
+  mv "#{source_dir}/index.html", "#{blog_index_dir}", :force=>true if blog_index_dir != source_dir
159
+  cp "#{source_dir}.old/index.html", source_dir if blog_index_dir != source_dir
160 160
   puts "## Updated #{source_dir} ##"
161 161
 end
162 162