Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to 1.1.15 and closure-compiler-2020-06-28 #54

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Tests
on:
push:
branches:
- master
- "*-stable"
- "*/ci-check"
pull_request:

jobs:
tests:
name: Tests
strategy:
fail-fast: false
matrix:
ruby: [2.6, 2.7, 3.0]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Run tests
run: bundle exec rake
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.yardoc
*.gem
.DS_Store
Gemfile.lock
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

gemspec

gem 'rake'
gem 'minitest'
10 changes: 5 additions & 5 deletions README.textile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
h1. The Closure Compiler (as a Ruby Gem)
h1. The Closure Compiler (as a Ruby Gem). Updated.

The *closure-compiler* gem is a svelte wrapper around the "Google Closure Compiler":https://developers.google.com/closure/compiler/ for JavaScript compression.
The *closure-compiler-updated* gem is a Ruby wrapper around the "Google Closure Compiler":https://developers.google.com/closure/compiler/ for JavaScript compression.

Latest Version: *"1.1.14":https://rubygems.org/gems/closure-compiler*
Latest Version: *"1.1.19":https://rubygems.org/gems/closure-compiler-updated*

The Closure Compiler's *2018-05-06* JAR-file is included with the gem.
The Closure Compiler's *v20211107* JAR-file is included with the gem.

h2. Installation

<pre>
sudo gem install closure-compiler
sudo gem install closure-compiler-updated
</pre>

h2. Usage
Expand Down
15 changes: 1 addition & 14 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,6 @@ Rake::TestTask.new do |t|
t.verbose = true
end

namespace :gem do

desc 'Build and install the closure-compiler gem'
task :install do
sh "gem build closure-compiler.gemspec"
sh "gem install #{Dir['*.gem'].join(' ')} --local --no-ri --no-rdoc"
end

desc 'Uninstall the closure-compiler gem'
task :uninstall do
sh "gem uninstall -x closure-compiler"
end

end
require 'bundler/gem_tasks'

task :default => :test
15 changes: 7 additions & 8 deletions closure-compiler.gemspec → closure-compiler-updated.gemspec
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
require File.join(File.dirname(__FILE__), 'lib', 'closure-compiler')
require_relative 'lib/closure-compiler'

Gem::Specification.new do |s|
s.name = 'closure-compiler'
s.name = 'closure-compiler-updated'
s.version = Closure::VERSION
s.date = '2018-05-31'
s.date = '2021-12-01'
s.license = 'Apache-2.0'

s.homepage = "http://github.com/documentcloud/closure-compiler/"
s.summary = "Ruby Wrapper for the Google Closure Compiler"
s.homepage = "http://github.com/hmdne/closure-compiler-updated/"
s.summary = "Ruby Wrapper for the Google Closure Compiler. Updated."
s.description = <<-EOS
A Ruby Wrapper for the Google Closure Compiler.
A Ruby Wrapper for the Google Closure Compiler. Updated.
EOS

s.rubyforge_project = "closure-compiler"
s.authors = ['Jeremy Ashkenas', 'Jordan Brough']
s.authors = ['Jeremy Ashkenas', 'Jordan Brough', 'hmdne']
s.email = '[email protected]'

s.require_paths = ['lib']
Expand Down
Binary file removed lib/closure-compiler-20180506.jar
Binary file not shown.
1 change: 1 addition & 0 deletions lib/closure-compiler-updated.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require 'closure-compiler'
Binary file added lib/closure-compiler-v20211201.jar
Binary file not shown.
6 changes: 3 additions & 3 deletions lib/closure-compiler.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module Closure

VERSION = "1.1.14"
VERSION = "1.1.20"

COMPILER_VERSION = "20180506"
COMPILER_VERSION = "v20211201"

JAVA_COMMAND = 'java'

Expand All @@ -12,4 +12,4 @@ module Closure

end

require 'closure/compiler'
require_relative 'closure/compiler'
3 changes: 2 additions & 1 deletion lib/closure/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class Compiler

DEFAULT_OPTIONS = {
:warning_level => 'QUIET',
:language_in => 'ECMASCRIPT5'
:language_in => 'ECMASCRIPT5',
:language_out => 'ECMASCRIPT5'
}

# When you create a Compiler, pass in the flags and options.
Expand Down
454 changes: 227 additions & 227 deletions test/fixtures/file1-file2-compiled.js

Large diffs are not rendered by default.

228 changes: 114 additions & 114 deletions test/fixtures/precompressed-compiled.js

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions test/unit/closure_compiler_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ class ClosureCompilerTest < Minitest::Test
EOS

COMPILED_ADVANCED = <<-EOS.strip
window.a=function(b){return console.log("hello "+b)};window.a.b=function(b){return b*b};window.a("world");
window.g=function(){console.log(\"hello world\")};window.g.h=function(a){return a*a};window.g();
EOS

def test_whitespace_compression
js = Compiler.new(:compilation_level => "WHITESPACE_ONLY").compile(ORIGINAL).strip
assert_equal js, COMPILED_WHITESPACE
assert_equal COMPILED_WHITESPACE, js
end

def test_simple_compression
js = Compiler.new.compile(ORIGINAL).strip
assert_equal js, COMPILED_SIMPLE
assert_equal COMPILED_SIMPLE, js
end

def test_advanced_compression
js = Compiler.new(:compilation_level => "ADVANCED_OPTIMIZATIONS").compile(ORIGINAL).strip
assert_equal js, COMPILED_ADVANCED
assert_equal COMPILED_ADVANCED, js
end

def test_block_syntax
Expand All @@ -42,7 +42,7 @@ def test_block_syntax
result << buffer
end
end
assert_equal result.strip, COMPILED_ADVANCED
assert_equal COMPILED_ADVANCED, result.strip
end

def test_jar_and_java_specifiation
Expand All @@ -52,7 +52,7 @@ def test_jar_and_java_specifiation
end
if java
compiler = Compiler.new(:java => java.strip, :jar_file => jar)
assert_equal compiler.compress(ORIGINAL).strip, COMPILED_SIMPLE
assert_equal COMPILED_SIMPLE, compiler.compress(ORIGINAL).strip
else
puts "could not `which/where java` skipping test"
end
Expand Down Expand Up @@ -94,6 +94,6 @@ def test_compiling_array_of_file_paths
files = ['test/fixtures/file1.js', 'test/fixtures/file2.js']
result = Closure::Compiler.new().compile_files(files)

assert_equal result, File.read('test/fixtures/file1-file2-compiled.js')
assert_equal File.read('test/fixtures/file1-file2-compiled.js'), result
end
end