Browse files

remove jeweler and make hassle compatible with sass 3.1 alpha

  • Loading branch information...
1 parent 4e42104 commit 0090dc860b995566ef3bc4f7ee256df735fde8ff @danielvlopes committed Feb 8, 2011
Showing with 162 additions and 101 deletions.
  1. +2 −0 Gemfile
  2. +105 −0 Gemfile.lock
  3. +4 −22 Rakefile
  4. +0 −1 TODO
  5. +0 −1 VERSION
  6. +23 −54 hassle.gemspec
  7. +1 −1 lib/hassle/hassle.rb
  8. +4 −0 lib/hassle/version.rb
  9. +20 −16 spec/base.rb
  10. +3 −6 spec/hassle_compiler_spec.rb
View
2 Gemfile
@@ -0,0 +1,2 @@
+source "http://rubygems.org"
+gemspec
View
105 Gemfile.lock
@@ -0,0 +1,105 @@
+PATH
+ remote: .
+ specs:
+ daniel-hassle (0.0.1)
+ rack
+ sass
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ abstract (1.0.0)
+ actionmailer (3.0.3)
+ actionpack (= 3.0.3)
+ mail (~> 2.2.9)
+ actionpack (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.4)
+ rack (~> 1.2.1)
+ rack-mount (~> 0.6.13)
+ rack-test (~> 0.5.6)
+ tzinfo (~> 0.3.23)
+ activemodel (3.0.3)
+ activesupport (= 3.0.3)
+ builder (~> 2.1.2)
+ i18n (~> 0.4)
+ activerecord (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ arel (~> 2.0.2)
+ tzinfo (~> 0.3.23)
+ activeresource (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ activesupport (3.0.3)
+ arel (2.0.6)
+ builder (2.1.2)
+ cucumber (0.9.4)
+ builder (~> 2.1.2)
+ diff-lcs (~> 1.1.2)
+ gherkin (~> 2.2.9)
+ json (~> 1.4.6)
+ term-ansicolor (~> 1.0.5)
+ diff-lcs (1.1.2)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ gherkin (2.2.9)
+ json (~> 1.4.6)
+ term-ansicolor (~> 1.0.5)
+ i18n (0.5.0)
+ json (1.4.6)
+ mail (2.2.14)
+ activesupport (>= 2.3.6)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.16)
+ polyglot (0.3.1)
+ rack (1.2.1)
+ rack-mount (0.6.13)
+ rack (>= 1.0.0)
+ rack-test (0.5.7)
+ rack (>= 1.0)
+ rails (3.0.3)
+ actionmailer (= 3.0.3)
+ actionpack (= 3.0.3)
+ activerecord (= 3.0.3)
+ activeresource (= 3.0.3)
+ activesupport (= 3.0.3)
+ bundler (~> 1.0)
+ railties (= 3.0.3)
+ railties (3.0.3)
+ actionpack (= 3.0.3)
+ activesupport (= 3.0.3)
+ rake (>= 0.8.7)
+ thor (~> 0.14.4)
+ rake (0.8.7)
+ rspec (2.1.0)
+ rspec-core (~> 2.1.0)
+ rspec-expectations (~> 2.1.0)
+ rspec-mocks (~> 2.1.0)
+ rspec-core (2.1.0)
+ rspec-expectations (2.1.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.1.0)
+ sass (3.1.0.alpha.221)
+ term-ansicolor (1.0.5)
+ thor (0.14.6)
+ treetop (1.4.9)
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.23)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ cucumber
+ daniel-hassle!
+ rack
+ rack-test
+ rails
+ rspec
+ sass
View
26 Rakefile
@@ -1,3 +1,6 @@
+require 'bundler'
+Bundler::GemHelper.install_tasks
+
require 'rake'
require 'spec/rake/spectask'
@@ -20,25 +23,4 @@ rescue LoadError
end
end
-task :default => [:spec, :cucumber]
-
-begin
- require 'jeweler'
- Jeweler::Tasks.new do |gem|
- gem.name = "hassle"
- gem.summary = "Make SASS less of a hassle."
- gem.description = "Makes SASS less of a hassle on read-only filesystems by compiling and serving it up for you."
- gem.homepage = "http://github.com/pedro/hassle"
- gem.authors = ["Pedro Belo", "Nick Quaranto"]
- gem.files = FileList["LICENSE", "README.textile", "lib/hassle.rb", "init.rb"]
- gem.add_dependency('rack')
- gem.add_dependency('haml')
- gem.add_development_dependency('rspec')
- gem.add_development_dependency('cucumber')
- gem.add_development_dependency('rack-test')
- gem.required_rubygems_version = Gem::Requirement.new(">= 1.3.5") if gem.respond_to? :required_rubygems_version=
- end
- Jeweler::RubyforgeTasks.new
-rescue LoadError
- puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
-end
+task :default => [:spec, :cucumber]
View
1 TODO
@@ -1 +0,0 @@
-Make features pass
View
1 VERSION
@@ -1 +0,0 @@
-0.0.1
View
77 hassle.gemspec
@@ -1,59 +1,28 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE
-# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "hassle/version"
Gem::Specification.new do |s|
- s.name = %q{hassle}
- s.version = "0.0.1"
+ s.name = "daniel-hassle"
+ s.version = Hassle::VERSION
+ s.platform = Gem::Platform::RUBY
+ s.authors = ["Pedro Belo", "Nick Quaranto"]
+ s.email = ["TODO: Write your email address"]
+ s.homepage = "https://github.com/danielvlopes/hassle"
+ s.summary = %q{HTTP Caching SASS for Heroku apps}
+ s.description = %q{Simple Rack middleware to compile your sass files to tmp folder when your is running on Heroku}
- s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5") if s.respond_to? :required_rubygems_version=
- s.authors = ["Pedro Belo", "Nick Quaranto"]
- s.date = %q{2009-10-16}
- s.description = %q{Makes SASS less of a hassle on read-only filesystems by compiling and serving it up for you}
- s.extra_rdoc_files = [
- "LICENSE",
- "README.textile"
- ]
- s.files = [
- "LICENSE",
- "README.textile",
- "init.rb",
- "lib/hassle.rb"
- ]
- s.homepage = %q{http://github.com/pedro/hassle}
- s.rdoc_options = ["--charset=UTF-8"]
- s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.5}
- s.summary = %q{Make SASS less of a hassle}
- s.test_files = [
- "spec/base.rb",
- "spec/hassle_compiler_spec.rb",
- "spec/hassle_spec.rb"
- ]
-
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 3
+ s.rubyforge_project = "daniel-hassle"
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<rack>, [">= 0"])
- s.add_runtime_dependency(%q<haml>, [">= 0"])
- s.add_development_dependency(%q<rspec>, [">= 0"])
- s.add_development_dependency(%q<cucumber>, [">= 0"])
- s.add_development_dependency(%q<rack-test>, [">= 0"])
- else
- s.add_dependency(%q<rack>, [">= 0"])
- s.add_dependency(%q<haml>, [">= 0"])
- s.add_dependency(%q<rspec>, [">= 0"])
- s.add_dependency(%q<cucumber>, [">= 0"])
- s.add_dependency(%q<rack-test>, [">= 0"])
- end
- else
- s.add_dependency(%q<rack>, [">= 0"])
- s.add_dependency(%q<haml>, [">= 0"])
- s.add_dependency(%q<rspec>, [">= 0"])
- s.add_dependency(%q<cucumber>, [">= 0"])
- s.add_dependency(%q<rack-test>, [">= 0"])
- end
-end
+ 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"]
+
+ s.add_runtime_dependency(%q<rack>, [">= 0"])
+ s.add_runtime_dependency(%q<sass>, [">= 0"])
+ s.add_development_dependency(%q<rails>, [">= 0"])
+ s.add_development_dependency(%q<rspec>, [">= 0"])
+ s.add_development_dependency(%q<cucumber>, [">= 0"])
+ s.add_development_dependency(%q<rack-test>, [">= 0"])
+end
View
2 lib/hassle/hassle.rb
@@ -45,7 +45,7 @@ def css_location(path)
end
def compile_location(*subdirs)
- File.join(Dir.pwd, "tmp", "hassle", subdirs)
+ File.join(Dir.pwd, "tmp", subdirs)
end
def normalize
View
4 lib/hassle/version.rb
@@ -0,0 +1,4 @@
+module Hassle
+ VERSION = "0.0.1"
+end
+
View
36 spec/base.rb
@@ -6,42 +6,46 @@
require 'sass'
require 'sass/plugin'
require File.dirname(__FILE__) + '/../lib/hassle'
-puts 1.hour
+
SASS_OPTIONS = Sass::Plugin.options.dup
def write_sass(location, css_file = "screen")
FileUtils.mkdir_p(location)
- sass_path = File.join(location, "#{css_file}.sass")
+ sass_path = File.join(location, "#{css_file}.scss")
File.open(sass_path, "w") do |f|
f.write <<EOF
-%h1 {
- font-size: 42em
+.h1 {
+ font-size: 42em;
}
EOF
end
File.join(@hassle.css_location(location), "#{css_file}.css") if @hassle
end
-def be_compiled
- simple_matcher("exist") { |given| File.exists?(given) }
- simple_matcher("contain compiled sass") { |given| File.read(given) =~ /h1 \{/ }
+Spec::Matchers.define :be_compiled do
+ match do |file|
+ File.exists?(file) &&
+ File.read(file) =~ /h1 \{/
+ end
end
-def have_tmp_dir_removed(*stylesheets)
- simple_matcher("remove tmp dir") do |given|
- given == stylesheets.map { |css| css.gsub(File.join(Dir.pwd, "tmp", "hassle"), "") }
+Spec::Matchers.define :have_tmp_dir_removed do |stylesheets|
+ match do |file|
+ file == stylesheets.map { |css| css.gsub(File.join(Dir.pwd, "tmp"), "") }
end
end
-def have_served_sass
- simple_matcher("return success") { |given| given.status == 200 }
- simple_matcher("compiled sass") { |given| given.body.should =~ /h1 \{/ }
+Spec::Matchers.define :have_served_sass do
+ match do |file|
+ file.status == 200 &&
+ file.body.should =~ /h1 \{/
+ end
end
def reset
- Sass::Plugin.options.clear
- Sass::Plugin.options = SASS_OPTIONS
+ Sass::Plugin.reset!
+ Sass::Plugin.options.merge!(SASS_OPTIONS)
FileUtils.rm_rf([File.join(Dir.pwd, "public"), File.join(Dir.pwd, "tmp")])
-end
+end
View
9 spec/hassle_compiler_spec.rb
@@ -8,13 +8,13 @@
it "dumps css into separate folders" do
@hassle.css_location("./public/stylesheets/sass").should ==
- File.join(Dir.pwd, "tmp", "hassle", "stylesheets")
+ File.join(Dir.pwd, "tmp", "stylesheets")
@hassle.css_location("./public/css/compiled").should ==
- File.join(Dir.pwd, "tmp", "hassle", "css", "compiled")
+ File.join(Dir.pwd, "tmp", "css", "compiled")
@hassle.css_location("./public/styles/posts/sass").should ==
- File.join(Dir.pwd, "tmp", "hassle", "styles", "posts")
+ File.join(Dir.pwd, "tmp", "styles", "posts")
end
describe "compiling sass" do
@@ -24,7 +24,6 @@
it "moves css into tmp directory with default settings" do
sass = write_sass(File.join(@default_location, "sass"))
-
@hassle.compile
sass.should be_compiled
@@ -34,7 +33,6 @@
it "should not create sass cache" do
write_sass(File.join(@default_location, "sass"))
Sass::Plugin.options[:cache] = true
-
@hassle.compile
File.exists?(".sass-cache").should be_false
@@ -43,7 +41,6 @@
it "should compile sass even if disabled with never_update" do
sass = write_sass(File.join(@default_location, "sass"))
Sass::Plugin.options[:never_update] = true
-
@hassle.compile
sass.should be_compiled

0 comments on commit 0090dc8

Please sign in to comment.