Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Prepare jquery.turbolinks for v1.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
kossnocorp committed Apr 5, 2013
1 parent 69d08ec commit c85e3b0
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 7 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
source 'https://rubygems.org'

group :development do
gem 'uglifier'
gem 'guard'
gem 'guard-rake'
gem 'talks', '0.4.0'
Expand Down
29 changes: 28 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,42 @@ namespace :release do
end

namespace :js do

desc 'Build JavaScript from CoffeeScript source code'
task :build do
command = [
'./node_modules/coffee-script/bin/coffee',
'--compile',
'--output ./vendor/assets/javascripts/',
'./src/jquery.turbolinks.coffee'
'./src/*.coffee'
]
system command.join(' ')
end

desc 'Use UglifyJS to compress JavaScript'
task :uglify do
require 'uglifier'
Dir['./vendor/assets/javascripts/*.js']
.select { |f| not f.match(/min\.js$/) }
.each do |file_name|
source = File.read(file_name)
compressed = Uglifier.compile(source, copyright: false)
min_file_name = file_name.gsub(/\.js$/, '.min.js')

File.open(min_file_name, 'w') do |f|
f.write(compressed)
end

uglify_rate = compressed.length.to_f / source.length
gzipped_size = `cat #{min_file_name} | gzip -9f | wc -c`.to_i
gzip_rate = gzipped_size.to_f / source.length

puts "# #{file_name}.js"
puts "Original size: #{source.length}b or #{(source.length.to_f / 1024).round(2)}kb"
puts "Uglified size: #{compressed.length}b (#{(uglify_rate * 100).round}% from original size)"
puts "GZipped size: #{gzipped_size}b or #{(gzipped_size.to_f / 1025).round(2)}kb (#{(gzip_rate * 100).round}% from original size)"
end
end
end

task :test do
Expand Down
2 changes: 1 addition & 1 deletion lib/jquery-turbolinks/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module JqueryTurbolinks
VERSION = '1.0.0.rc2'
VERSION = '1.0.0'
end
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jquery.turbolinks",
"version": "1.0.0-rc2",
"author": "Sasha Koss <[email protected]>",
"version": "1.0.0",
"author": "Sasha Koss <[email protected]>",
"description": "jQuery plugin for drop-in fix binded events problem caused by Turbolinks",

"devDependencies": {
Expand All @@ -10,7 +10,6 @@
"chai": "*",
"sinon": "*",
"sinon-chai": "*",
"uglify-js": "*",
"jquery": "*",
"jsdom": "*"
},
Expand Down
2 changes: 1 addition & 1 deletion src/jquery.turbolinks.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###
jquery.turbolinks.js ~ v1.0.0-rc2 ~ https://github.com/kossnocorp/jquery.turbolinks
jquery.turbolinks.js ~ v1.0.0 ~ https://github.com/kossnocorp/jquery.turbolinks
jQuery plugin for drop-in fix binded events problem caused by Turbolinks
Expand Down
2 changes: 1 addition & 1 deletion vendor/assets/javascripts/jquery.turbolinks.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/assets/javascripts/jquery.turbolinks.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c85e3b0

Please sign in to comment.