Skip to content

Commit

Permalink
- Refactoring rakefile
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Feb 18, 2009
1 parent fe5b2fa commit a43e73c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
3 changes: 2 additions & 1 deletion README.txt
Expand Up @@ -16,7 +16,7 @@
=== Installation

Simply download JSpec and include JSpec.css and JSpec.js in your markup.
A div with the id of #JSpec should be present for displaying when using
A div with the id of #jspec should be present for displaying when using
the default formatter.

JSpec scripts should NOT be referenced via the <script> tag, they should be
Expand Down Expand Up @@ -98,6 +98,7 @@
* add more formatters
* nesting
* mocking
* sass / compression option
* textmate bundle

=== Copyright
Expand Down
25 changes: 17 additions & 8 deletions Rakefile
Expand Up @@ -2,12 +2,13 @@
desc 'Package jspec.'
task :package => [:clear] do
begin
sh "mkdir pkg"
sh "tar -czf pkg/jspec.tar.gz lib"
sh 'mkdir pkg'
sh 'cp -fr lib/* pkg'
sh "jsmin < lib/jspec.js > pkg/jspec.min.js"
rescue Exception => e
puts "Failed to package: #{e}."
else
puts "Packaging completed."
puts "Packaging of JSpec-#{version} completed."
end
end

Expand All @@ -18,12 +19,20 @@ end

desc 'Clear packaging.'
task :clear do
if File.directory?('pkg')
sh "rm -fr pkg/*"
sh "rmdir pkg"
if File.directory? 'pkg'
sh 'rm -fr pkg/*'
sh 'rmdir pkg'
end
sh "clear"
end

desc 'Display current version'
task :version do
puts "JSpec-#{version}"
end

task :build => [:package]
task :remove => [:clear]
task :remove => [:clear]

def version
@version ||= $1 if File.read('lib/jspec.js').match /version : '(.*?)'/
end

0 comments on commit a43e73c

Please sign in to comment.