Permalink
Browse files

using the js_rake_tasks gem now

  • Loading branch information...
1 parent 554b813 commit bc352490c9d7c9ccceaa388ab0391ae02e277b0a @searls committed Jan 15, 2012
Showing with 9 additions and 74 deletions.
  1. +1 −3 Gemfile
  2. +6 −4 Gemfile.lock
  3. +2 −67 Rakefile
View
@@ -1,7 +1,5 @@
source :rubygems
gem 'jasmine-headless-webkit'
+gem 'js_rake_tasks'
gem 'rake'
-gem 'json_pure'
-gem 'semver'
-gem 'git'
View
@@ -14,7 +14,11 @@ GEM
jasmine-core (~> 1.1.beta)
multi_json
rainbow
- json_pure (1.6.1)
+ js_rake_tasks (0.0.1)
+ git (~> 1.2.5)
+ json_pure (~> 1.6.1)
+ semver (~> 1.0.1)
+ json_pure (1.6.5)
multi_json (1.0.3)
rainbow (1.1.1)
rake (0.8.7)
@@ -24,8 +28,6 @@ PLATFORMS
ruby
DEPENDENCIES
- git
jasmine-headless-webkit
- json_pure
+ js_rake_tasks
rake
- semver
View
@@ -1,78 +1,13 @@
require 'rake/clean'
require 'jasmine-headless-webkit'
require 'jasmine/headless/task'
+require 'js_rake_tasks'
include Rake::DSL if defined?(Rake::DSL)
CLEAN << "dist"
Jasmine::Headless::Task.new
-task "compile" do
- `coffee --compile --output dist/ src/`
-end
-
-namespace "bump" do
- task "major", :compile do
- update_version { |v| v.major += 1 }
- end
-
- task "minor", :compile do
- update_version { |v| v.minor += 1 }
- end
-
- task "patch", :compile do
- update_version { |v| v.patch += 1 }
- end
-
- def update_version &blk
- git = VersionsGit.new
- fail("Oops! Can't bump a version with a dirty repo!") unless git.clean?
- version = update_package_json(&blk)
- tag_project(git,version)
- end
-
- def tag_project(git, version)
- git.tag(version)
- git.push
- end
-
- def update_package_json
- require 'json'
- require 'semver'
-
- package = JSON.parse(File.read("package.json"))
- version = SemVer.new(*package["version"].split(".").map(&:to_i))
- yield(version)
- package["version"] = version.format('%M.%m.%p%s')
- File.open('package.json', 'w') do |f|
- f.puts JSON.pretty_generate(package)
- end
- package["version"]
- end
-
- class VersionsGit
- def initialize
- require 'git'
- @g = Git.open(Dir.pwd)
- end
-
- def tag(version)
- @g.add('package.json')
- @g.commit("Bumping version to #{version}")
- @g.add_tag(version)
- end
-
- def push
- @g.push("origin",@g.current_branch,true)
- end
-
- def clean?
- [@g.status.deleted,@g.status.added,@g.status.changed].all? { |o| o.size == 0 }
- end
- end
-end
-
-
-task :default => ['jasmine:headless', 'compile']
+task :default => ['jasmine:headless', 'coffee:compile']

0 comments on commit bc35249

Please sign in to comment.