Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Josh Hull
committed
Oct 22, 2010
1 parent
99e42b3
commit 5b93196
Showing
16 changed files
with
95 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,10 @@ | ||
require 'spec/rake/spectask' | ||
require 'spec/rake/spectask_precmd' | ||
|
||
task :default => :'spec:all' | ||
require 'bundler' | ||
Bundler::GemHelper.install_tasks | ||
|
||
namespace(:spec) do | ||
|
||
task :all => [:css, :js] | ||
|
||
Spec::Rake::SpecTask.new(:css) do |t| | ||
t.precmd=%[CLASSPATH=#{(Dir['ext/*.jar'] * ':')}] | ||
t.spec_opts ||= [] | ||
t.spec_opts << "--options" << "spec/css/spec.opts" | ||
t.spec_files = FileList['spec/css/*.rb'] | ||
end | ||
|
||
Spec::Rake::SpecTask.new(:js) do |t| | ||
t.precmd=%[CLASSPATH=#{(Dir['ext/*.jar'] * ':')}] | ||
t.spec_opts ||= [] | ||
t.spec_opts << "--options" << "spec/js/spec.opts" | ||
t.spec_files = FileList['spec/js/*.rb'] | ||
end | ||
Spec::Rake::SpecTask.new do |t| | ||
t.spec_opts ||= [] | ||
t.spec_opts << "--options" << "spec/spec.opts" | ||
t.spec_files = FileList['spec/**/*_spec.rb'] | ||
end | ||
|
||
task :cultivate do | ||
system "touch Manifest.txt; rake check_manifest | grep -v \"(in \" | patch" | ||
system "rake debug_gem | grep -v \"(in \" > `basename \\`pwd\\``.gemspec" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'squeezy' | ||
|
||
Squeezy.run_service |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
require 'jars/yuicompressor-2.3.6.jar' | ||
require 'squeezy/reporter' | ||
require 'squeezy/compressor' | ||
require 'squeezy/service' | ||
require 'squeezy/version' | ||
|
||
class Squeezy | ||
include Java | ||
|
||
def self.run_service | ||
Squeezy::Service.run! | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require 'sinatra' | ||
|
||
class Squeezy | ||
class Service < Sinatra::Base | ||
set :reload, false | ||
set :environment, :production | ||
|
||
squeezy = Squeezy.new | ||
|
||
put('/js') do | ||
squeezy.compress_js(request.env['rack.input'].read) | ||
end | ||
|
||
put('/css') do | ||
squeezy.compress_css(request.env['rack.input'].read) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Squeezy | ||
VERSION = '0.0.1' | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'spec_helper' | ||
|
||
describe "A CSS Compressor" do | ||
before(:each) do | ||
@squeezy = Squeezy.new | ||
`rm -rf /tmp/*.css` | ||
`rm -rf /tmp/*.js` | ||
@source = File.read("spec/fixtures/css-multiline.css") | ||
end | ||
|
||
it "should return less than it started with" do | ||
@source.size.should > @squeezy.compress_css(@source).size | ||
end | ||
it "should have no new lines" do | ||
@squeezy.compress_css(@source).count("\n").should == 0 | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
require 'java' | ||
require 'lib/squeezy/reporter' | ||
require 'lib/squeezy/compressor' | ||
require 'spec_helper' | ||
|
||
describe "A JS Compressor" do | ||
before(:each) do | ||
@squeezy = Squeezy.new | ||
`rm -rf /tmp/*.css` | ||
`rm -rf /tmp/*.js` | ||
end | ||
|
||
it "should return less than it started with" do | ||
js = IO.read("spec/fixtures/js-multiline.js") | ||
js.size.should > compress_js(js).size | ||
js.size.should > @squeezy.compress_js(js).size | ||
end | ||
|
||
it "should have no new lines" do | ||
js = IO.read("spec/fixtures/js-multiline.js") | ||
compress_js(js).count("\n").should == 0 | ||
@squeezy.compress_js(js).count("\n").should == 0 | ||
end | ||
|
||
it "should return the original file when the js is malformed" do | ||
js_malformed = IO.read("spec/fixtures/js-malformed.js") | ||
compress_js(js_malformed).should == js_malformed | ||
@squeezy.compress_js(js_malformed).should == js_malformed | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')) | ||
require 'squeezy' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# -*- encoding: utf-8 -*- | ||
$:.push File.expand_path("../lib", __FILE__) | ||
require "squeezy/version" | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "squeezy" | ||
s.version = Squeezy::VERSION | ||
s.platform = Gem::Platform::RUBY | ||
s.authors = ["Joshua Hull"] | ||
s.email = ["joshbuddy@gmail.com"] | ||
s.homepage = "http://rubygems.org/gems/squeezy" | ||
s.summary = %q{Asset compression service via YUI compressor} | ||
s.description = %q{Asset compression service via YUI compressor} | ||
|
||
s.rubyforge_project = "squeezy" | ||
|
||
s.add_dependency "glassfish" | ||
s.add_dependency "sinatra" | ||
s.add_development_dependency "rspec" | ||
s.add_development_dependency "rake" | ||
s.add_development_dependency "bundler", ">= 1.0.0" | ||
|
||
s.files = `git ls-files`.split("\n") | ||
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | ||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } | ||
s.require_paths = ["lib"] | ||
end |