Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 71 lines (58 sloc) 2.088 kB
39d9241 @ericam Setup rake and travis
authored
1 require 'rubygems/package_task'
2
3 task :default => :test
4
5 spec = eval(File.read("susy.gemspec"), binding, "susy.gemspec")
6
7 def spec.bump!
8 segments = version.to_s.split(".")
9 segments[-1] = segments.last.succ
10 self.version = Gem::Version.new(segments.join("."))
11 end
12
13 # Set SAME_VERSION when moving to a new major version and you want to specify the new version
14 # explicitly instead of bumping the current version.
d482105 @ericam Simplify support and output
authored
15 # E.g. rake build SAME_VERSION=True
39d9241 @ericam Setup rake and travis
authored
16 spec.bump! unless ENV["SAME_VERSION"]
17
18 desc "Run tests and build susy-#{spec.version}.gem"
19 task :build => [:test, :gem]
20
21 desc "Make make the prebuilt gem susy-#{spec.version}.gem public."
22 task :publish => [:record_version, :push_gem, :tag]
23
24 desc "Build & Publish version #{spec.version}"
25 task :release => [:build, :publish]
26
27 Gem::PackageTask.new(spec) do |pkg|
28 pkg.need_zip = true
29 pkg.need_tar = true
30 end
31
32 desc "run the tests"
33 task :test do
f8c9b4a @ericam Fix rake test command
authored
34 sh "bundle install --quiet && bower install && cd test && bundle exec sass scss/test.scss css/test.css 2> error.output > /dev/null --force && cd - > /dev/null", :verbose => false
39d9241 @ericam Setup rake and travis
authored
35 open("test/error.output") do |f|
f6c4a8c @ericam Update test-reporting regex
authored
36 if f.read =~ /(.*):\d+.* (\d+) Passed.* (\d+) Failed/
39d9241 @ericam Setup rake and travis
authored
37 unless $3 == "0"
38 puts File.read("test/css/test.css")
39 fail "#{$3} Tests Failed"
40 else
41 puts "#{$2} Tests Passed"
42 end
43 else
44 raise "unexpected output"
45 end
46 end
47 sh "rm test/error.output", :verbose => false
48 end
49
50 desc "Record the new version in version control for posterity"
51 task :record_version do
52 unless ENV["SAME_VERSION"]
53 open(FileList["VERSION"].first, "w") do |f|
54 f.write(spec.version.to_s)
55 end
6f203de @ericam remove .lock file
authored
56 sh "git add VERSION bower.json"
f36fa8a @ericam Rake release commits all changes
authored
57 sh %Q{git commit -am "Bump version to #{spec.version}."}
39d9241 @ericam Setup rake and travis
authored
58 end
59 end
60
61 desc "Tag the repo as #{spec.version} and push the code and tag."
62 task :tag do
63 sh "git tag -a -m 'Version #{spec.version}' #{spec.version}"
64 sh "git push --tags origin #{`git rev-parse --abbrev-ref HEAD`}"
65 end
66
67 desc "Push susy-#{spec.version}.gem to the rubygems server"
68 task :push_gem do
69 sh "gem push pkg/susy-#{spec.version}.gem"
70 end
Something went wrong with that request. Please try again.