Skip to content

Decompose sprites #1771

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

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
5d99531
moved valid extensions down to the engine level so engines can be bui…
scottdavis Jun 5, 2013
6923cbe
updated documentation
scottdavis Jun 5, 2013
4ea9751
added sprites folder
scottdavis Dec 15, 2013
c5631f9
updated core git ignore
scottdavis Dec 27, 2013
deaaa14
created sprites gemspec
scottdavis Dec 27, 2013
1682d42
move over sprite tests
scottdavis Dec 31, 2013
c6353cc
WIP refactoring tests to use def test
scottdavis Dec 31, 2013
17dbae7
convert to test unit format
scottdavis Jan 2, 2014
04800e0
WIP tests
scottdavis Jan 7, 2014
616826f
move test helpers
scottdavis Jan 7, 2014
0733974
move test helpers WIP
scottdavis Jan 7, 2014
8caef49
WIP
scottdavis Jan 9, 2014
b0ca99c
moved regression test and speed up call back test by ~4seconds
scottdavis Jan 9, 2014
fed17e4
upgraded mocha
scottdavis Jan 9, 2014
2d99473
finished decomposing test helpers
scottdavis Jan 9, 2014
6d5a1fe
added diff
scottdavis Jan 9, 2014
655671e
finished test helper decompose
scottdavis Jan 9, 2014
fb51b38
update tests to incude the correct modules
scottdavis Jan 9, 2014
2ea82b8
prep for moving over actual sprite code
scottdavis Jan 9, 2014
c29ad77
test pass importer moved over
scottdavis Jan 18, 2014
81e32f9
test pass importer moved over
scottdavis Jan 18, 2014
60638f5
sprite tests are green
scottdavis Feb 23, 2014
86f870e
all tests pass
scottdavis Feb 23, 2014
baa435e
meta info
scottdavis Aug 3, 2014
967c189
fix cruft from rebase
scottdavis Sep 5, 2014
5098558
sprite tests pass
scottdavis Sep 5, 2014
caefe43
sass bump
scottdavis Sep 5, 2014
18fed8c
tests all pass!
scottdavis Sep 5, 2014
8961782
cli tests need sprites gem on ci
scottdavis Sep 5, 2014
ef9e3e5
updated sass
scottdavis Sep 21, 2014
5fedb5b
remove un needed module load
scottdavis Sep 24, 2014
f14211b
remove unneeded comment
scottdavis Sep 24, 2014
6123d4e
remove needed sprite importer object
scottdavis Sep 24, 2014
87880a1
gemspec issue with chucky png
scottdavis Sep 24, 2014
9eff843
remove sprite require from cli gem
scottdavis Oct 2, 2014
081a405
test for sass 3.3 gemfiles should now work on travis i hope!
scottdavis Oct 2, 2014
4ec7095
fix listen 2 tests
scottdavis Oct 2, 2014
faf4893
detect compass sprites
scottdavis Oct 2, 2014
04cf82d
fix sprite importer constant
scottdavis Oct 2, 2014
409a7b0
remove lemonade
scottdavis Oct 9, 2014
eff65e3
Sprite clean up move stuff from core
scottdavis Oct 9, 2014
d293497
add sprites and allow rbx failure
scottdavis Oct 10, 2014
40d3e9a
gemfile cleanup
scottdavis Oct 10, 2014
e9523d0
WIP
scottdavis Oct 11, 2014
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
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,21 @@ sudo: false
env:
- CI_TEST=core
- CI_TEST=cli
- CI_TEST=sprites

gemfile:
- core/Gemfile
- cli/gemfiles/sass_3_3.gemfile
- cli/gemfiles/listen_2.gemfile
- sprites/Gemfile

script: cd $CI_TEST && bundle exec rake

matrix:
allow_failures:
- gemfile: cli/gemfiles/listen_2.gemfile
env: CI_TEST=cli
rvm: rbx
exclude:
- gemfile: cli/gemfiles/sass_3_3.gemfile
env: CI_TEST=core
Expand Down
16 changes: 0 additions & 16 deletions Guardfile

This file was deleted.

14 changes: 13 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

GEMS = ['core', 'cli', 'import-once']
GEMS = ['core', 'cli', 'import-once', 'sprites']


task :default => %w[test]
Expand All @@ -10,7 +10,19 @@ task :test do
Rake::Task["test_cleanup"].invoke if ok
end
end
desc "run cli sass 3.3 tests"
task "sass_3_3_test" do
sh "cd cli && (BUNDLE_GEMFILE=gemfiles/sass_3_3.gemfile bundle install --quiet && bundle exec rake test) && cd .." do |ok, res|
Rake::Task["test_cleanup"].invoke if ok
end
end

desc "run cli listen 2 tests"
task "listen_2_test" do
sh "cd cli && (BUNDLE_GEMFILE=gemfiles/listen_2.gemfile bundle install --quiet && bundle exec rake test) && cd .." do |ok, res|
Rake::Task["test_cleanup"].invoke if ok
end
end

desc "Clean up all test files"
task :test_cleanup do
Expand Down
3 changes: 2 additions & 1 deletion cli/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ unless ENV['PKG']
gem "compass-core", :path => "../core" unless defined?(CI)
gem "compass-import-once", :path => "../import-once" unless defined?(CI)
gem 'sass-globbing', "~> 1.1.1"
gem "compass-sprites", :path => "../sprites" unless defined?(CI)
gem "cucumber", "~> 1.2.1"
gem "rspec", "~> 2.0.0"
gem "compass-validator", "3.0.1"
gem "css_parser", "~> 1.0.1"
gem "rubyzip", "0.9.9"
gem 'mocha', '0.11.4'
gem 'minitest', '2.12.1'
gem "mocha", "~> 0.14.0", :require => false
gem 'diff-lcs', '~> 1.1.2'
gem 'rake'
gem 'json', '~> 1.7.7', :platforms => :ruby_18
Expand Down
1 change: 0 additions & 1 deletion cli/compass.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Gem::Specification.new do |gemspec|
gemspec.add_dependency 'sass', '>= 3.3.13', '< 3.5'
gemspec.add_dependency 'compass-core', "~> #{File.read(File.join(File.dirname(__FILE__),"..","core","VERSION")).strip}"
gemspec.add_dependency 'compass-import-once', "~> #{File.read(File.join(File.dirname(__FILE__),"..","import-once","VERSION")).strip}"
gemspec.add_dependency 'chunky_png', '~> 1.2'
gemspec.add_dependency 'rb-fsevent', '>= 0.9.3'
gemspec.add_dependency 'rb-inotify', '>= 0.9'

Expand Down
6 changes: 3 additions & 3 deletions cli/features/step_definitions/command_line_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
require 'test_helper'

require 'compass/exec'
include Compass::TestCaseHelper
include Compass::CommandLineHelper
include Compass::IoHelper
include Compass::Test::TestCaseHelper
include Compass::Test::CommandLineHelper
include Compass::Test::IoHelper

Before do
Compass.reset_configuration!
Expand Down
1 change: 1 addition & 0 deletions cli/gemfiles/listen_2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ gem 'sass', '~> 3.3.12'
gem 'compass', :path => "../"
gem 'compass-core', :path => "../../core"
gem 'compass-import-once', :path => "../../import-once"
gem 'compass-sprites', :path=> '../../sprites'
gem 'listen', '~> 2.7.1'

gemspec :path=>"../"
1 change: 1 addition & 0 deletions cli/gemfiles/sass_3_3.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ gem 'sass', "~> 3.3.12"
gem 'compass', :path => "../"
gem 'compass-core', :path => "../../core"
gem 'compass-import-once', :path => "../../import-once"
gem "compass-sprites", :path => "../../sprites"

gemspec :path=>"../"
1 change: 0 additions & 1 deletion cli/lib/compass.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def lib_directory
app_integration
compiler
sass_compiler
sprite_importer
).each do |lib|
require "compass/#{lib}"
end
18 changes: 17 additions & 1 deletion cli/lib/compass/commands/base.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
module Compass
module Commands
class Base

@callbacks = {}

def self.register(command_name)
Compass::Commands[command_name] = self
end

def self.register_callback(event, &block)
@callbacks[event] ||= []
@callbacks[event] << block
end

def self.run_callback(event)
if @callbacks.has_key?(event)
@callbacks[event].each do |callback|
callback.call(self)
end
end
end

include Actions

attr_accessor :working_path, :options
Expand All @@ -13,7 +29,7 @@ def initialize(working_path, options)
self.working_path = working_path.to_s
self.options = options
end

def execute
perform
end
Expand Down
8 changes: 6 additions & 2 deletions cli/lib/compass/commands/clean_project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ def initialize(working_path, options)
def perform
compiler = new_compiler_instance
compiler.clean!
Compass::SpriteImporter.find_all_sprite_map_files(Compass.configuration.generated_images_path).each do |sprite|
remove sprite
# if compass sprites is loaded clean those
# todo: the cli interface should emmit some kinda events so addons can attach there cleanup
if defined?(Compass::Sprites::Importer)
Compass::Sprites::Importer.find_all_sprite_map_files(Compass.configuration.generated_images_path).each do |sprite|
remove sprite
end
end
end

Expand Down
5 changes: 2 additions & 3 deletions cli/lib/compass/commands/sprite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ def initialize(working_path, options)

def perform
relative_uri = options[:uri].gsub(/^#{Compass.configuration.images_dir}\//, '')
name = Compass::SpriteImporter.sprite_name(relative_uri)
sprites = Compass::SpriteImporter.new
name = Compass::Sprites::Importer.sprite_name(relative_uri)
options[:output_file] ||= File.join(Compass.configuration.sass_path, "sprites", "_#{name}.#{Compass.configuration.preferred_syntax}")
options[:skip_overrides] ||= false
contents = Compass::SpriteImporter.content_for_images(relative_uri, name, options[:skip_overrides])
contents = Compass::Sprites::Importer.content_for_images(relative_uri, name, options[:skip_overrides])
if options[:output_file][-4..-1] != "scss"
contents = Sass::Engine.new(contents, Compass.sass_engine_options.merge(:syntax => :scss)).to_tree.to_sass
end
Expand Down
4 changes: 0 additions & 4 deletions cli/lib/compass/sass_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,4 @@
raise LoadError, "It looks like you've got an incompatible version of Sass. This often happens when you have an old haml gem installed. Please upgrade Haml to v3.1 or above."
end

module Compass::SassExtensions
end

require 'compass/sass_extensions/functions'
require 'compass/sass_extensions/sprites'
8 changes: 0 additions & 8 deletions cli/lib/compass/sass_extensions/functions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,3 @@ def declare(*args)
end
end
end

%w(sprites).each do |func|
require "compass/sass_extensions/functions/#{func}"
end

module Sass::Script::Functions
include Compass::SassExtensions::Functions::Sprites
end
21 changes: 0 additions & 21 deletions cli/lib/compass/sass_extensions/sprites.rb

This file was deleted.

119 changes: 0 additions & 119 deletions cli/lib/compass/sprite_importer.rb

This file was deleted.

1 change: 1 addition & 0 deletions cli/test/fixtures/stylesheets/compass/config.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Require any additional compass plugins here.
require 'true'
require 'compass/import-once/activate'
require 'compass/sprites'
project_type = :stand_alone
css_dir = "tmp"
sass_dir = "sass"
Expand Down
Loading