From dc8f9ba92454f659cfa7c9772e735074083ae215 Mon Sep 17 00:00:00 2001 From: kdelchev Date: Wed, 29 Jul 2015 23:07:49 +0300 Subject: [PATCH 1/3] Create task to update js files automatically --- Rakefile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Rakefile b/Rakefile index 14cfe0b..29530fc 100644 --- a/Rakefile +++ b/Rakefile @@ -1,2 +1,13 @@ require 'bundler' Bundler::GemHelper.install_tasks + +namespace :d3 do + desc 'Update d3 version' + task :update_version do + `curl -o app/assets/javascripts/d3.js https://raw.githubusercontent.com/mbostock/d3/master/d3.js` + `curl -o app/assets/javascripts/d3.min.js https://raw.githubusercontent.com/mbostock/d3/master/d3.min.js` + `cp app/assets/javascripts/d3.js app/assets/javascripts/d3.v3.js` + `cp app/assets/javascripts/d3.min.js app/assets/javascripts/d3.v3.min.js` + puts "Update manually version to #{`grep 'version: ".*"' app/assets/javascripts/d3.js | cut -d '"' -f 2`}CHANGELOG.md\nREADME.md\nlib/d3/rails/version.rb\n" + end +end From 24fa3afaca6742850b00bff0cb8775f1d9235473 Mon Sep 17 00:00:00 2001 From: kdelchev Date: Wed, 29 Jul 2015 23:09:49 +0300 Subject: [PATCH 2/3] Update README file --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 7848dd7..b7581b3 100644 --- a/README.md +++ b/README.md @@ -21,3 +21,10 @@ Please note that D3 is provided via the asset pipeline and you do *not* need to Then add it to your manifest file, most probably at `app/assets/javascripts/application.js`: //= require d3 + +## Development + +To update D3 version in gem run rake task: +```bash +bundle exec rake d3:update_version +``` From 4b9eedc730103f7d03ac3ca244fa93d1b8300217 Mon Sep 17 00:00:00 2001 From: kdelchev Date: Thu, 30 Jul 2015 14:33:28 +0300 Subject: [PATCH 3/3] Update message in task and README.md --- README.md | 2 +- Rakefile | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b7581b3..3ba5384 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Then add it to your manifest file, most probably at `app/assets/javascripts/appl ## Development -To update D3 version in gem run rake task: +To update the D3 version contained in the gem, you can run the following rake task ```bash bundle exec rake d3:update_version ``` diff --git a/Rakefile b/Rakefile index 29530fc..545ee86 100644 --- a/Rakefile +++ b/Rakefile @@ -8,6 +8,13 @@ namespace :d3 do `curl -o app/assets/javascripts/d3.min.js https://raw.githubusercontent.com/mbostock/d3/master/d3.min.js` `cp app/assets/javascripts/d3.js app/assets/javascripts/d3.v3.js` `cp app/assets/javascripts/d3.min.js app/assets/javascripts/d3.v3.min.js` - puts "Update manually version to #{`grep 'version: ".*"' app/assets/javascripts/d3.js | cut -d '"' -f 2`}CHANGELOG.md\nREADME.md\nlib/d3/rails/version.rb\n" + version = `grep 'version: ".*"' app/assets/javascripts/d3.js | cut -d '"' -f 2`.strip + message = <<-MSG + Please update the version to #{version} manually in the following files: + * CHANGELOG.md + * README.md + * lib/d3/rails/version.rb + MSG + puts message.strip.squeeze ' ' end end