sprites 0.0.1.rc2 → 0.0.1.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. data/.gitignore +3 -0
  2. data/Gemfile +0 -8
  3. data/MIT-LICENSE +20 -0
  4. data/README.md +76 -1
  5. data/Rakefile +4 -39
  6. data/bin/sprites +5 -7
  7. data/features/cli.feature +1 -1
  8. data/features/step_definitions/common_steps.rb +10 -8
  9. data/lib/sprites.rb +123 -13
  10. data/lib/sprites/cli/cli_application.rb +6 -4
  11. data/lib/sprites/cli/command_line_option_parser.rb +16 -16
  12. data/lib/sprites/configuration.rb +26 -7
  13. data/lib/sprites/railtie.rb +56 -0
  14. data/lib/sprites/sprite.rb +80 -46
  15. data/lib/sprites/sprite_generators/chunky_png_generator.rb +14 -8
  16. data/lib/sprites/sprite_piece.rb +20 -9
  17. data/lib/sprites/sprite_pieces.rb +10 -10
  18. data/lib/sprites/test/sprite_generator_tester.rb +23 -12
  19. data/lib/sprites/version.rb +2 -2
  20. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/bas/bar.png +0 -0
  21. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/bas/bas.png +0 -0
  22. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/bas/bkgd_main_copy.png +0 -0
  23. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/bas/foo.png +0 -0
  24. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/bas/fubar.png +0 -0
  25. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-black-default-28.png +0 -0
  26. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-black-default-cap-28.png +0 -0
  27. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-black-default-cap-long.png +0 -0
  28. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-black-default.png +0 -0
  29. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-black-onclick-28.png +0 -0
  30. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-black-onclick-cap-28.png +0 -0
  31. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-black-onclick-cap-long.png +0 -0
  32. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-black-onclick.png +0 -0
  33. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-black-rollover-28.png +0 -0
  34. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-black-rollover-cap-28.png +0 -0
  35. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-black-rollover-cap-long.png +0 -0
  36. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-black-rollover.png +0 -0
  37. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-blackarrow-default.png +0 -0
  38. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-blackarrow-onclick.png +0 -0
  39. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-blackarrow-rollover.png +0 -0
  40. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-blue-default-cap.png +0 -0
  41. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-blue-default-drop.png +0 -0
  42. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-blue-default-edge.png +0 -0
  43. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-blue-default.png +0 -0
  44. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-blue-onclick-cap.png +0 -0
  45. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-blue-onclick-drop.png +0 -0
  46. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-blue-onclick-edge.png +0 -0
  47. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-blue-onclick.png +0 -0
  48. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-blue-rollover-cap.png +0 -0
  49. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-blue-rollover-drop.png +0 -0
  50. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-blue-rollover-edge.png +0 -0
  51. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-blue-rollover.png +0 -0
  52. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-green-default-cap.png +0 -0
  53. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-green-default-drop.png +0 -0
  54. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-green-default-edge.png +0 -0
  55. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-green-default.png +0 -0
  56. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-green-onclick-cap.png +0 -0
  57. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-green-onclick-drop.png +0 -0
  58. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-green-onclick-edge.png +0 -0
  59. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-green-onclick.png +0 -0
  60. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-green-rollover-cap.png +0 -0
  61. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-green-rollover-drop.png +0 -0
  62. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-green-rollover-edge.png +0 -0
  63. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-green-rollover.png +0 -0
  64. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-red-default-cap.png +0 -0
  65. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-red-default-drop.png +0 -0
  66. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-red-default-edge.png +0 -0
  67. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-red-default.png +0 -0
  68. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-red-onclick-cap.png +0 -0
  69. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-red-onclick-drop.png +0 -0
  70. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-red-onclick-edge.png +0 -0
  71. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-red-onclick.png +0 -0
  72. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-red-rollover-cap.png +0 -0
  73. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-red-rollover-drop.png +0 -0
  74. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-red-rollover-edge.png +0 -0
  75. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-red-rollover.png +0 -0
  76. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-trans-default-cap.png +0 -0
  77. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-trans-default-drop.png +0 -0
  78. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-trans-default-edge.png +0 -0
  79. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-trans-default.png +0 -0
  80. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-trans-onclick-cap.png +0 -0
  81. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-trans-onclick-drop.png +0 -0
  82. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-trans-onclick-edge.png +0 -0
  83. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-trans-onclick.png +0 -0
  84. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-trans-rollover-cap.png +0 -0
  85. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-trans-rollover-drop.png +0 -0
  86. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-trans-rollover-edge.png +0 -0
  87. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-trans-rollover.png +0 -0
  88. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-white-default-cap.png +0 -0
  89. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-white-default-drop.png +0 -0
  90. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-white-default-edge.png +0 -0
  91. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-white-default.png +0 -0
  92. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-white-onclick-cap.png +0 -0
  93. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-white-onclick-drop.png +0 -0
  94. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-white-onclick-edge.png +0 -0
  95. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-white-onclick.png +0 -0
  96. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-white-rollover-cap.png +0 -0
  97. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-white-rollover-drop.png +0 -0
  98. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-white-rollover-edge.png +0 -0
  99. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-white-rollover.png +0 -0
  100. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-yellow-default-cap.png +0 -0
  101. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-yellow-default-drop.png +0 -0
  102. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-yellow-default-edge.png +0 -0
  103. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-yellow-default.png +0 -0
  104. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-yellow-onclick-cap.png +0 -0
  105. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-yellow-onclick-drop.png +0 -0
  106. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-yellow-onclick-edge.png +0 -0
  107. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-yellow-onclick.png +0 -0
  108. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-yellow-rollover-cap.png +0 -0
  109. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-yellow-rollover-drop.png +0 -0
  110. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-yellow-rollover-edge.png +0 -0
  111. data/spec/fixtures/{rails_project2 → fake_engine}/app/assets/images/sprite_images/buttons/btn-yellow-rollover.png +0 -0
  112. data/spec/fixtures/fake_engine/config/sprites.rb +91 -0
  113. data/spec/fixtures/fake_engine/lib/fake_engine.rb +5 -0
  114. data/spec/fixtures/project1/config/sprites.rb +143 -145
  115. data/spec/fixtures/rails_project1/config/application.rb +4 -3
  116. data/spec/fixtures/rails_project1/config/sprites.rb +90 -92
  117. data/spec/integration/rails/rails_spec.rb +46 -13
  118. data/spec/lib/sprites/configuration_spec.rb +11 -5
  119. data/spec/lib/sprites/sprite_generators/chunky_png_generator_spec.rb +10 -9
  120. data/spec/lib/sprites/sprite_piece_spec.rb +25 -24
  121. data/spec/lib/sprites/sprite_pieces_spec.rb +5 -2
  122. data/spec/lib/sprites/sprite_spec.rb +30 -33
  123. data/spec/lib/sprites/test/sprite_generator_tester_spec.rb +37 -9
  124. data/spec/lib/sprites_spec.rb +163 -8
  125. data/spec/spec_helper.rb +4 -4
  126. data/spec/support/sprites_helper.rb +1 -1
  127. data/sprites.gemspec +6 -5
  128. metadata +134 -660
  129. data/lib/sprites/application.rb +0 -60
  130. data/lib/sprites/autoload.rb +0 -1
  131. data/lib/sprites/autoloader.rb +0 -16
  132. data/lib/sprites/notifier.rb +0 -4
  133. data/lib/sprites/rails.rb +0 -20
  134. data/lib/sprites/rails/autoload.rb +0 -13
  135. data/lib/sprites/rails/sprites.rake +0 -15
  136. data/lib/sprites/sprites.rb +0 -47
  137. data/lib/sprites/stylesheet.rb +0 -26
  138. data/spec/fixtures/rails_project1/Rakefile +0 -5
  139. data/spec/fixtures/rails_project1/config/boot.rb +0 -6
  140. data/spec/fixtures/rails_project1/config/environment.rb +0 -7
  141. data/spec/fixtures/rails_project2/Rakefile +0 -5
  142. data/spec/fixtures/rails_project2/config/application.rb +0 -61
  143. data/spec/fixtures/rails_project2/config/boot.rb +0 -6
  144. data/spec/fixtures/rails_project2/config/environment.rb +0 -7
  145. data/spec/fixtures/rails_project2/config/sprites.rb +0 -93
  146. data/spec/lib/sprites/application_spec.rb +0 -50
  147. data/spec/lib/sprites/autoloader_spec.rb +0 -21
  148. data/spec/lib/sprites/cli/command_line_option_parser_spec.rb +0 -5
  149. data/spec/lib/sprites/notifier_spec.rb +0 -5
  150. data/spec/lib/sprites/sprites_spec.rb +0 -100
  151. data/spec/lib/sprites/stylesheet_spec.rb +0 -24
@@ -1,60 +0,0 @@
1
- require 'sprites/sprites'
2
-
3
- module Sprites
4
-
5
- # This class provides top level access to the Sprites application.
6
- # So far, three methods are available:
7
- # 1. define (_define_)
8
- # 2. sprite (_sprite_)
9
- #
10
- # Author:: Sam Woodard
11
- #
12
- # :title:Application
13
-
14
- class Application
15
- attr_reader :sprites
16
-
17
- # The +new+ class method initializes the class.
18
- # === Example
19
- # sprites = Sprites.new
20
- def initialize(configuration = ::Sprites.configuration)
21
- @sprites = Sprites.new(configuration)
22
- end
23
-
24
- # The +define+ method provides access to the dsl
25
- # === Example
26
- # Sprites.application.define do
27
- # ...
28
- # end
29
- def define(&blk)
30
- instance_eval(&blk)
31
- end
32
-
33
-
34
- # The +sprite+ method adds sprites to the application
35
- #
36
- # === Example
37
- # Sprites.application.define do
38
- # sprite :foo
39
- # end
40
- #
41
- # options:
42
- # => :orientation - sprite orientation
43
- # default: :vertical
44
- # => :path - path to sprite relative to config.sprites_path
45
- # default: public/images/sprites/{name}.png
46
- # => :stylesheet_path - path to stylesheet
47
- # default: public/stylesheets/sprites/{name}.css
48
- # => :url - path to use in background attribute in stylesheet
49
- # default: /images/sprites/{name}.png
50
- # => :auto_define - whether or not to auto-define the sprite based on directory contents
51
- # default: true
52
- # => :class_prefix - a css string to prepend to all css classes define or autogenerated
53
- # examples: '.icon', '.contacts '
54
- # default: ''
55
- #
56
- def sprite(name, options = {}, &blk)
57
- sprites.add(name, options, &blk)
58
- end
59
- end
60
- end
@@ -1 +0,0 @@
1
- ::Sprites::Autoloader.new.autoload
@@ -1,16 +0,0 @@
1
- require 'sprites/sprite'
2
-
3
- module Sprites
4
- class Autoloader
5
- def initialize(configuration = ::Sprites.configuration)
6
- @configuration = configuration
7
- end
8
-
9
- def autoload
10
- Dir[File.join(@configuration.sprite_pieces_path, '*')].each do |sprite_path|
11
- sprite = Sprite.new(File.basename(sprite_path).intern).configure
12
- ::Sprites.application.sprites.add(sprite) if File.directory?(sprite_path)
13
- end
14
- end
15
- end
16
- end
@@ -1,4 +0,0 @@
1
- module Sprites
2
- class Notifier
3
- end
4
- end
data/lib/sprites/rails.rb DELETED
@@ -1,20 +0,0 @@
1
- require 'sprites'
2
- require 'rails/railtie'
3
-
4
- module Sprites
5
- class Railtie < ::Rails::Railtie
6
- rake_tasks do
7
- load File.expand_path('../rails/sprites.rake', __FILE__)
8
- end
9
-
10
- initializer 'sprites._rails-configuration' do
11
- assets_root = Rails.application.config.assets[:enabled] ? 'app/assets' : 'public'
12
-
13
- ::Sprites.configure do
14
- config.sprites_path = Rails.root.join(assets_root, 'images/sprites')
15
- config.sprite_stylesheets_path = Rails.root.join(assets_root, 'stylesheets/sprites')
16
- config.sprite_pieces_path = Rails.root.join(assets_root, 'images/sprite_images')
17
- end unless ::Sprites.configuration.configured?
18
- end
19
- end
20
- end
@@ -1,13 +0,0 @@
1
- require 'sprites/autoloader'
2
-
3
- module Sprites
4
- unless defined?(Sprites::Railtie)
5
- raise 'Require "sprites/rails" before requiring "sprites/rails/autoload"'
6
- end
7
-
8
- class Railtie
9
- initializer 'sprites.autoload' do
10
- Sprites::Autoloader.new.autoload
11
- end
12
- end
13
- end
@@ -1,15 +0,0 @@
1
- require 'sprites'
2
-
3
- include Rake::DSL if defined?(Rake::DSL)
4
- include Sprites
5
-
6
- desc "Generate sprites and stylesheets"
7
- task :sprites => :environment do
8
- unless (def_file_path = Rails.root.join('config/sprites.rb')).exist?
9
- raise CliApplication::DefinitionFileNotFound
10
- end
11
-
12
- load def_file_path
13
- sprite_generator = ChunkyPngGenerator.new(::Sprites.configuration)
14
- sprite_generator.generate(::Sprites.application.sprites)
15
- end
@@ -1,47 +0,0 @@
1
- require 'sprites/sprite'
2
-
3
- module Sprites
4
- class Sprites
5
- def initialize(configuration)
6
- @configuration = configuration
7
- @sprites = Hash.new do |sprites, name|
8
- sprites[name] = Sprite.new(name, configuration)
9
- end
10
- end
11
-
12
- def [](sprite_identifier)
13
- @sprites.has_key?(sprite_identifier) == false ?
14
- nil :
15
- @sprites[sprite_identifier]
16
- end
17
-
18
- def clear
19
- @sprites.clear
20
- end
21
-
22
- def each(&blk)
23
- @sprites.values.each(&blk)
24
- end
25
-
26
- def empty?
27
- @sprites.empty?
28
- end
29
-
30
- def count
31
- @sprites.count
32
- end
33
-
34
- def add(name_or_sprite, options = {}, &blk)
35
- sprite = case name_or_sprite
36
- when Sprite
37
- @sprites[name_or_sprite.name] = name_or_sprite
38
- when Symbol, String
39
- @sprites[name_or_sprite.to_sym]
40
- else
41
- raise ArgumentError
42
- end
43
-
44
- sprite.configure(options, &blk)
45
- end
46
- end
47
- end
@@ -1,26 +0,0 @@
1
- require 'active_support/core_ext/object/blank'
2
-
3
- module Sprites
4
- class Stylesheet
5
- attr_reader :path
6
- attr_accessor :sprite_pieces
7
-
8
- def initialize(sprite)
9
- @sprite = sprite
10
- end
11
-
12
- def path
13
- @sprite.stylesheet_path
14
- end
15
-
16
- def self.stylesheet_full_path(configuration, stylesheet)
17
- File.join(configuration.sprite_stylesheets_path, stylesheet.path)
18
- end
19
-
20
- def css(configuration = Sprites.configuration, sprite = @sprite, sprite_pieces = @sprite_pieces)
21
- return unless sprite_pieces.present?
22
-
23
- sprite_pieces.css(configuration, sprite)
24
- end
25
- end
26
- end
@@ -1,5 +0,0 @@
1
- require File.expand_path('../config/application', __FILE__)
2
-
3
- require 'rake'
4
- include Rake::DSL
5
- SpritesRailsTestApp::Application.load_tasks
@@ -1,6 +0,0 @@
1
- require 'rubygems'
2
-
3
- # Set up gems listed in the Gemfile.
4
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
-
6
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -1,7 +0,0 @@
1
- # Load the rails application
2
- require File.expand_path('../application', __FILE__)
3
-
4
- require 'rake'
5
- include Rake::DSL
6
-
7
- SpritesRailsTestApp::Application.initialize!
@@ -1,5 +0,0 @@
1
- require File.expand_path('../config/application', __FILE__)
2
-
3
- require 'rake'
4
- include Rake::DSL
5
- SpritesRailsTestApp::Application.load_tasks
@@ -1,61 +0,0 @@
1
- require File.expand_path('../boot', __FILE__)
2
-
3
- # Pick the frameworks you want:
4
- require "active_record/railtie"
5
- require "action_controller/railtie"
6
- # require "action_mailer/railtie"
7
- # require "active_resource/railtie"
8
- require "sprockets/railtie"
9
- require 'sprites/rails'
10
- require 'sprites/rails/autoload'
11
-
12
- if defined?(Bundler)
13
- # If you precompile assets before deploying to production, use this line
14
- Bundler.require(*Rails.groups(:assets => %w(development test)))
15
- # If you want your assets lazily compiled in production, use this line
16
- # Bundler.require(:default, :assets, Rails.env)
17
- end
18
-
19
- module SpritesRailsTestApp
20
- class Application < Rails::Application
21
- config.root = File.expand_path('../..', __FILE__)
22
- config.cache_classes = false
23
-
24
- # Settings in config/environments/* take precedence over those specified here.
25
- # Application configuration should go into files in config/initializers
26
- # -- all .rb files in that directory are automatically loaded.
27
-
28
- # Custom directories with classes and modules you want to be autoloadable.
29
- # config.autoload_paths += %W(#{config.root}/lib)
30
-
31
- # Only load the plugins named here, in the order given (default is alphabetical).
32
- # :all can be used as a placeholder for all plugins not explicitly named.
33
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
34
-
35
- # Activate observers that should always be running.
36
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
37
-
38
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
39
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
40
- # config.time_zone = 'Central Time (US & Canada)'
41
-
42
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
43
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
44
- # config.i18n.default_locale = :de
45
-
46
- # Configure the default encoding used in templates for Ruby 1.9.
47
- config.encoding = "utf-8"
48
-
49
- # Configure sensitive parameters which will be filtered from the log file.
50
- config.filter_parameters += [:password, :password_confirmation]
51
-
52
- # Enable the asset pipeline
53
- config.assets.enabled = true
54
-
55
- # Version of your assets, change this if you want to expire all your assets
56
- config.assets.version = '1.0'
57
- config.active_support.deprecation = :log
58
- end
59
- end
60
-
61
- SpritesRailsTestApp::Application.load_tasks
@@ -1,6 +0,0 @@
1
- require 'rubygems'
2
-
3
- # Set up gems listed in the Gemfile.
4
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
-
6
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -1,7 +0,0 @@
1
- # Load the rails application
2
- require File.expand_path('../application', __FILE__)
3
-
4
- require 'rake'
5
- include Rake::DSL
6
-
7
- SpritesRailsTestApp::Application.initialize!
@@ -1,93 +0,0 @@
1
- Sprites.application.define do
2
- sprite :bas
3
-
4
- sprite :buttons, :path => "buttons.png", :stylesheet_path => "buttons.css", :auto_define => false do
5
- sprite_piece 'buttons/btn-black-default-28.png', 'a.black.wf_button > span, button.black.wf_submit span'
6
- sprite_piece 'buttons/btn-black-default-cap-28.png', 'a.black.wf_button, button.black.wf_submit', :x => 'right'
7
- sprite_piece 'buttons/btn-black-rollover-28.png', 'a.black.wf_button:hover > span, button.black.wf_submit:hover span'
8
- sprite_piece 'buttons/btn-black-rollover-cap-28.png', 'a.black.wf_button:hover, button.black.wf_submit:hover', :x => 'right'
9
- sprite_piece 'buttons/btn-black-onclick-28.png', 'a.black.wf_button:active > span, button.black.wf_submit:active span, a.black.wf_button.active span'
10
- sprite_piece 'buttons/btn-black-onclick-cap-28.png', 'a.black.wf_button:active, button.black.wf_submit:active, a.black.wf_button.active', :x => 'right'
11
- sprite_piece 'buttons/btn-green-default.png', 'a.green.wf_button > span, button.green.wf_submit span'
12
- sprite_piece 'buttons/btn-green-default-cap.png', 'a.green.wf_button, button.green.wf_submit', :x => 'right'
13
- sprite_piece 'buttons/btn-green-rollover.png', 'a.green.wf_button:hover > span, button.green.wf_submit:hover span'
14
- sprite_piece 'buttons/btn-green-rollover-cap.png', 'a.green.wf_button:hover, button.green.wf_submit:hover', :x => 'right'
15
- sprite_piece 'buttons/btn-green-onclick.png', 'a.green.wf_button:active > span, button.green.wf_submit:active span'
16
- sprite_piece 'buttons/btn-green-onclick-cap.png', 'a.green.wf_button:active, button.green.wf_submit:active', :x => 'right'
17
- sprite_piece 'buttons/btn-green-default-edge.png', 'a.right_edge.green.wf_button, button.right_edge.green.wf_submit', :x => 'right'
18
- sprite_piece 'buttons/btn-green-rollover-edge.png', 'a.right_edge.green.wf_button:hover button.right_edge.green.wf_submit:hover', :x => 'right'
19
- sprite_piece 'buttons/btn-green-onclick-edge.png', 'a.right_edge.green.wf_button:active, button.right_edge.green.wf_submit:active', :x => 'right'
20
- sprite_piece 'buttons/btn-green-default-drop.png', 'a.green.wf_menu_button'
21
- sprite_piece 'buttons/btn-green-rollover-drop.png', 'a.green.wf_menu_button:hover'
22
- sprite_piece 'buttons/btn-green-onclick-drop.png', 'a.green.wf_menu_button:active'
23
- sprite_piece 'buttons/btn-black-default.png', 'a.tall.black.wf_button > span, button.tall.black.wf_submit span'
24
- sprite_piece 'buttons/btn-black-default-cap-long.png', 'a.tall.black.wf_button, button.tall.black.wf_submit, a.black.back_arrow.wf_button', :x => 'right'
25
- sprite_piece 'buttons/btn-black-rollover.png', 'a.tall.black.wf_button:hover > span, button.tall.black.wf_submit:hover span'
26
- sprite_piece 'buttons/btn-black-rollover-cap-long.png', 'a.tall.black.wf_button:hover, button.tall.black.wf_submit:hover, a.black.back_arrow.wf_button:hover', :x => 'right'
27
- sprite_piece 'buttons/btn-black-onclick.png', 'a.tall.black.wf_button:active > span, button.tall.black.wf_submit:active span, a.black.tall.wf_button.active span'
28
- sprite_piece 'buttons/btn-black-onclick-cap-long.png', 'a.tall.black.wf_button:active, button.tall.black.wf_submit:active, a.black.back_arrow.wf_button:active, a.black.tall.wf_button.active', :x => 'right'
29
- sprite_piece 'buttons/btn-red-default.png', 'a.red.wf_button > span, button.red.wf_submit span'
30
- sprite_piece 'buttons/btn-red-default-cap.png', 'a.red.wf_button, button.red.wf_submit', :x => 'right'
31
- sprite_piece 'buttons/btn-red-rollover.png', 'a.red.wf_button:hover > span, button.red.wf_submit:hover span'
32
- sprite_piece 'buttons/btn-red-rollover-cap.png', 'a.red.wf_button:hover, button.red.wf_submit:hover', :x => 'right'
33
- sprite_piece 'buttons/btn-red-onclick.png', 'a.red.wf_button:active > span, button.red.wf_submit:active span'
34
- sprite_piece 'buttons/btn-red-onclick-cap.png', 'a.red.wf_button:active, button.red.wf_submit:active', :x => 'right'
35
- sprite_piece 'buttons/btn-yellow-default.png', 'a.yellow.wf_button > span, button.yellow.wf_submit span'
36
- sprite_piece 'buttons/btn-yellow-default-cap.png', 'a.yellow.wf_button, button.yellow.wf_submit', :x => 'right'
37
- sprite_piece 'buttons/btn-yellow-rollover.png', 'a.yellow.wf_button:hover > span, button.yellow.wf_submit:hover span'
38
- sprite_piece 'buttons/btn-yellow-rollover-cap.png', 'a.yellow.wf_button:hover, button.yellow.wf_submit:hover', :x => 'right'
39
- sprite_piece 'buttons/btn-yellow-onclick.png', 'a.yellow.wf_button:active > span, button.yellow.wf_submit:active span'
40
- sprite_piece 'buttons/btn-yellow-onclick-cap.png', 'a.yellow.wf_button:active, button.yellow.wf_submit:active', :x => 'right'
41
- sprite_piece 'buttons/btn-white-default.png', 'a.white.wf_button > span, button.white.wf_submit span'
42
- sprite_piece 'buttons/btn-white-default-cap.png', 'a.white.wf_button, button.white.wf_submit', :x => 'right'
43
- sprite_piece 'buttons/btn-white-rollover.png', 'a.white.wf_button:hover > span, button.white.wf_submit:hover span'
44
- sprite_piece 'buttons/btn-white-rollover-cap.png', 'a.white.wf_button:hover, button.white.wf_submit:hover', :x => 'right'
45
- sprite_piece 'buttons/btn-white-onclick.png', 'a.white.wf_button:active > span, button.white.wf_submit:active span'
46
- sprite_piece 'buttons/btn-white-onclick-cap.png', 'a.white.wf_button:active, button.white.wf_submit:active', :x => 'right'
47
- sprite_piece 'buttons/btn-trans-default.png', 'a.trans.wf_button > span, button.trans.wf_submit span'
48
- sprite_piece 'buttons/btn-trans-default-cap.png', 'a.trans.wf_button, button.trans.wf_submit', :x => 'right'
49
- sprite_piece 'buttons/btn-trans-rollover.png', 'a.trans.wf_button:hover > span, button.trans.wf_submit:hover span'
50
- sprite_piece 'buttons/btn-trans-rollover-cap.png', 'a.trans.wf_button:hover, button.trans.wf_submit:hover', :x => 'right'
51
- sprite_piece 'buttons/btn-trans-onclick.png', 'a.trans.wf_button:active > span, button.trans.wf_submit:active span'
52
- sprite_piece 'buttons/btn-trans-onclick-cap.png', 'a.trans.wf_button:active, button.trans.wf_submit:active', :x => 'right'
53
- sprite_piece 'buttons/btn-blue-default.png', 'a.blue.wf_button > span, button.blue.wf_submit span'
54
- sprite_piece 'buttons/btn-blue-default-cap.png', 'a.blue.wf_button, button.blue.wf_submit', :x => 'right'
55
- sprite_piece 'buttons/btn-blue-rollover.png', 'a.blue.wf_button:hover > span, button.blue.wf_submit:hover span'
56
- sprite_piece 'buttons/btn-blue-rollover-cap.png', 'a.blue.wf_button:hover, button.blue.wf_submit:hover', :x => 'right'
57
- sprite_piece 'buttons/btn-blue-onclick.png', 'a.blue.wf_button:active > span, button.blue.wf_submit:active span'
58
- sprite_piece 'buttons/btn-blue-onclick-cap.png', 'a.blue.wf_button:active, button.blue.wf_submit:active', :x => 'right'
59
- sprite_piece 'buttons/btn-red-default-edge.png', 'a.right_edge.red.wf_button, button.right_edge.red.wf_submit', :x => 'right'
60
- sprite_piece 'buttons/btn-red-rollover-edge.png', 'a.right_edge.red.wf_button:hover, button.right_edge.red.wf_submit:hover', :x => 'right'
61
- sprite_piece 'buttons/btn-red-onclick-edge.png', 'a.right_edge.red.wf_button:active, button.right_edge.red.wf_submit:active', :x => 'right'
62
- sprite_piece 'buttons/btn-red-default-drop.png', 'a.red.wf_menu_button'
63
- sprite_piece 'buttons/btn-red-rollover-drop.png', 'a.red.wf_menu_button:hover'
64
- sprite_piece 'buttons/btn-red-onclick-drop.png', 'a.red.wf_menu_button:active'
65
- sprite_piece 'buttons/btn-yellow-default-edge.png', 'a.right_edge.yellow.wf_button, button.right_edge.yellow.wf_submit', :x => 'right'
66
- sprite_piece 'buttons/btn-yellow-rollover-edge.png', 'a.right_edge.yellow.wf_button:hover, button.right_edge.yellow.wf_submit:hover', :x => 'right'
67
- sprite_piece 'buttons/btn-yellow-onclick-edge.png', 'a.right_edge.yellow.wf_button:active, button.right_edge.yellow.wf_submit:active', :x => 'right'
68
- sprite_piece 'buttons/btn-yellow-default-drop.png', 'a.yellow.wf_menu_button'
69
- sprite_piece 'buttons/btn-yellow-rollover-drop.png', 'a.yellow.wf_menu_button:hover'
70
- sprite_piece 'buttons/btn-yellow-onclick-drop.png', 'a.yellow.wf_menu_button:active'
71
- sprite_piece 'buttons/btn-blue-default-edge.png', 'a.right_edge.blue.wf_button, button.right_edge.blue.wf_submit', :x => 'right'
72
- sprite_piece 'buttons/btn-blue-rollover-edge.png', 'a.right_edge.blue.wf_button:hover, button.right_edge.blue.wf_submit:hover', :x => 'right'
73
- sprite_piece 'buttons/btn-blue-onclick-edge.png', 'a.right_edge.blue.wf_button:active, button.right_edge.blue.wf_submit:active', :x => 'right'
74
- sprite_piece 'buttons/btn-blue-default-drop.png', 'a.blue.wf_menu_button'
75
- sprite_piece 'buttons/btn-blue-rollover-drop.png', 'a.blue.wf_menu_button:hover'
76
- sprite_piece 'buttons/btn-blue-onclick-drop.png', 'a.blue.wf_menu_button:active'
77
- sprite_piece 'buttons/btn-white-default-edge.png', 'a.right_edge.white.wf_button, button.right_edge.white.wf_submit', :x => 'right'
78
- sprite_piece 'buttons/btn-white-rollover-edge.png', 'a.right_edge.white.wf_button:hover, button.right_edge.white.wf_submit:hover', :x => 'right'
79
- sprite_piece 'buttons/btn-white-onclick-edge.png', 'a.right_edge.white.wf_button:active, button.right_edge.white.wf_submit:active', :x => 'right'
80
- sprite_piece 'buttons/btn-white-default-drop.png', 'a.white.wf_menu_button'
81
- sprite_piece 'buttons/btn-white-rollover-drop.png', 'a.white.wf_menu_button:hover'
82
- sprite_piece 'buttons/btn-white-onclick-drop.png', 'a.white.wf_menu_button:active'
83
- sprite_piece 'buttons/btn-trans-default-edge.png', 'a.right_edge.trans.wf_button, button.right_edge.trans.wf_submit', :x => 'right'
84
- sprite_piece 'buttons/btn-trans-rollover-edge.png', 'a.right_edge.trans.wf_button:hover, button.right_edge.trans.wf_submit:hover', :x => 'right'
85
- sprite_piece 'buttons/btn-trans-onclick-edge.png', 'a.right_edge.trans.wf_button:active, button.right_edge.trans.wf_submit:active', :x => 'right'
86
- sprite_piece 'buttons/btn-trans-default-drop.png', 'a.trans.wf_menu_button'
87
- sprite_piece 'buttons/btn-trans-rollover-drop.png', 'a.trans.wf_menu_button:hover'
88
- sprite_piece 'buttons/btn-trans-onclick-drop.png', 'a.trans.wf_menu_button:active'
89
- sprite_piece 'buttons/btn-blackarrow-default.png', 'a.black.back_arrow.wf_button > span'
90
- sprite_piece 'buttons/btn-blackarrow-rollover.png', 'a.black.back_arrow.wf_button:hover > span'
91
- sprite_piece 'buttons/btn-blackarrow-onclick.png', 'a.black.back_arrow.wf_button:active > span'
92
- end
93
- end
@@ -1,50 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Application do
4
- before do
5
- @app = Application.new
6
- end
7
-
8
- context "#define" do
9
- it 'should respond to define' do
10
- @app.should respond_to(:define)
11
- end
12
-
13
- it 'should allow access to the api when defining a sprite with a symbol' do
14
- @app.sprite(:foo)
15
-
16
- @app.sprites[:foo].should be_a(Sprite)
17
- @app.sprites[:foo].name.should be(:foo)
18
- @app.sprites[:foo].path.to_s.should == "foo.png"
19
- @app.sprites[:foo].stylesheet_path.should == "foo.css"
20
- end
21
-
22
- it 'should allow access to the api when defining a sprite with a hash' do
23
- @app.sprite(:foo, :path => 'sprites/foo.png', :stylesheet_path => 'sprites/foo.css')
24
- @app.sprites[:foo].should be_a(Sprite)
25
- @app.sprites[:foo].name.should be(:foo)
26
- @app.sprites[:foo].path.to_s.should == "sprites/foo.png"
27
- @app.sprites[:foo].stylesheet_path.should == "sprites/foo.css"
28
- end
29
-
30
- end
31
-
32
- context "#sprite" do
33
- it 'should respond_to sprite' do
34
- @app.should respond_to(:sprite)
35
- end
36
-
37
- it 'should add a sprite' do
38
- @app.sprite(:foo) {}
39
- @app.sprites.should_not be_empty
40
- @app.sprites.count.should be(1)
41
- @app.sprites[:foo].should be_a(Sprite)
42
- end
43
- end
44
-
45
- context 'initialize' do
46
- it 'should create the sprites adt' do
47
- @app.sprites.should_not be_nil
48
- end
49
- end
50
- end