Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed git dep

  • Loading branch information...
commit 066d2b1c38f1c44ab28c239239a5b5198b088672 1 parent fe43f0e
@bcardarella bcardarella authored
Showing with 25 additions and 10 deletions.
  1. +25 −10 Rakefile
View
35 Rakefile
@@ -1,5 +1,4 @@
require 'bundler'
-require 'git'
require File.join(File.expand_path('..', __FILE__), 'coffeescript/processor')
Bundler::GemHelper.install_tasks
@@ -44,23 +43,39 @@ end
Rake::Task[:build].instance_eval { @actions.clear }
task :build do
- begin
- regenerate_javascript
- git = Git.open(File.expand_path('..', __FILE__))
- git.add('vendor')
- git.commit('Regenerated JavaScript')
- puts 'Committed changes'
- rescue
- puts 'No changes, no commit'
- end
+ regenerate_javascript
+ perform_git_commit
Bundler::GemHelper.new(Dir.pwd).build_gem
end
+def perform_git_commit
+ sh_with_code('git add vendor')
+ out, code = sh_with_code('git commit -m "Regenerated JavaScript"')
+ if code == 0
+ puts "Committed changes"
+ else
+ puts "Nothing to commit"
+ end
+end
+
def regenerate_javascript
ClientSideValidations::Processor.run
puts 'Regenerated JavaScript'
end
+def sh_with_code(cmd, &block)
+ cmd << " 2>&1"
+ outbuf = ''
+ Bundler.ui.debug(cmd)
+ Dir.chdir(Dir.pwd) {
+ outbuf = `#{cmd}`
+ if $? == 0
+ block.call(outbuf) if block
+ end
+ }
+ [outbuf, $?]
+end
+
PORT = 4567
# Returns an array e.g.: ['open', 'http://example.com']
Please sign in to comment.
Something went wrong with that request. Please try again.