compass 0.12.alpha.4 → 0.12.rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.yml +2 -2
- data/bin/compass +4 -0
- data/features/command_line.feature +0 -10
- data/features/extensions.feature +0 -10
- data/features/step_definitions/command_line_steps.rb +0 -12
- data/frameworks/compass/stylesheets/compass/css3/_background-clip.scss +2 -2
- data/frameworks/compass/stylesheets/compass/css3/_font-face.scss +1 -1
- data/lib/compass/app_integration.rb +26 -11
- data/lib/compass/commands/project_structure.rb +93 -0
- data/lib/compass/commands/update_project.rb +0 -1
- data/lib/compass/commands/watch_project.rb +6 -1
- data/lib/compass/compiler.rb +2 -1
- data/lib/compass/configuration.rb +6 -1
- data/lib/compass/configuration/data.rb +9 -3
- data/lib/compass/configuration/helpers.rb +7 -21
- data/lib/compass/configuration/inheritance.rb +101 -0
- data/lib/compass/configuration/serialization.rb +17 -7
- data/lib/compass/errors.rb +1 -0
- data/lib/compass/installers/manifest.rb +10 -5
- data/lib/compass/sass_extensions/functions/display.rb +1 -0
- data/lib/compass/sass_extensions/functions/trig.rb +1 -1
- data/lib/compass/sass_extensions/sprites.rb +0 -1
- data/lib/compass/sass_extensions/sprites/image.rb +1 -1
- data/lib/compass/sprite_importer.rb +4 -1
- data/test/fixtures/stylesheets/compass/css/background-clip.css +10 -0
- data/test/fixtures/stylesheets/compass/css/fonts.css +1 -1
- data/test/fixtures/stylesheets/compass/sass/background-clip.scss +8 -0
- data/test/test_helper.rb +2 -2
- data/test/units/compiler_test.rb +11 -0
- data/test/units/configuration_test.rb +144 -0
- data/test/units/sprites/sprite_command_test.rb +4 -3
- metadata +12 -30
- data/examples/compass/compass_app_log.txt +0 -6
- data/features/rails_integration.feature +0 -32
- data/lib/compass/app_integration/merb.rb +0 -1
- data/lib/compass/app_integration/merb/runtime.rb +0 -63
- data/lib/compass/app_integration/rails.rb +0 -83
- data/lib/compass/app_integration/rails/actionpack2x.rb +0 -10
- data/lib/compass/app_integration/rails/actionpack2x/action_controller.rb +0 -15
- data/lib/compass/app_integration/rails/actionpack2x/sass_plugin.rb +0 -5
- data/lib/compass/app_integration/rails/actionpack2x/urls.rb +0 -18
- data/lib/compass/app_integration/rails/actionpack30.rb +0 -11
- data/lib/compass/app_integration/rails/actionpack30/railtie.rb +0 -46
- data/lib/compass/app_integration/rails/actionpack31.rb +0 -5
- data/lib/compass/app_integration/rails/actionpack31/helpers.rb +0 -28
- data/lib/compass/app_integration/rails/actionpack31/railtie.rb +0 -87
- data/lib/compass/app_integration/rails/configuration_defaults.rb +0 -123
- data/lib/compass/app_integration/rails/installer.rb +0 -182
- data/lib/compass/app_integration/rails/runtime.rb +0 -17
- data/lib/compass/app_integration/rails/templates/compass-install-rails.rb +0 -78
- data/test/integrations/rails_integration_test.rb +0 -51
- data/test/integrations/test_rails_helper.rb +0 -20
- data/test/units/rails_configuration_test.rb +0 -50
data/VERSION.yml
CHANGED
data/bin/compass
CHANGED
@@ -77,16 +77,6 @@ Feature: Command Line
|
|
77
77
|
Then an error message is printed out: A bare project cannot be created when a framework is specified.
|
78
78
|
And the command exits with a non-zero error code
|
79
79
|
|
80
|
-
Scenario: Initializing a rails project
|
81
|
-
Given ruby supports fork
|
82
|
-
Given I'm in a newly created rails project: my_rails_project
|
83
|
-
When I initialize a project using: compass init rails --sass-dir app/stylesheets --css-dir public/stylesheets/compiled
|
84
|
-
Then a config file config/compass.rb is reported created
|
85
|
-
Then a config file config/compass.rb is created
|
86
|
-
And a sass file app/stylesheets/screen.scss is created
|
87
|
-
And a sass file app/stylesheets/print.scss is created
|
88
|
-
And a sass file app/stylesheets/ie.scss is created
|
89
|
-
|
90
80
|
Scenario: Compiling an existing project.
|
91
81
|
Given I am using the existing project in test/fixtures/stylesheets/compass
|
92
82
|
When I run: compass compile
|
data/features/extensions.feature
CHANGED
@@ -12,16 +12,6 @@ Feature: Extensions
|
|
12
12
|
When I run: compass frameworks
|
13
13
|
Then the list of frameworks includes "testing"
|
14
14
|
|
15
|
-
@listframeworks
|
16
|
-
Scenario: Extensions directory for rails projects
|
17
|
-
Given ruby supports fork
|
18
|
-
And I'm in a newly created rails project: extension_test_rails_project
|
19
|
-
And I run: compass init rails
|
20
|
-
And the "vendor/plugins/compass_extensions" directory exists
|
21
|
-
And and I have a fake extension at vendor/plugins/compass_extensions/testing
|
22
|
-
When I run: compass frameworks
|
23
|
-
Then the list of frameworks includes "testing"
|
24
|
-
|
25
15
|
@listframeworks
|
26
16
|
Scenario: Shared extensions directory
|
27
17
|
Given the "~/.compass/extensions" directory exists
|
@@ -6,7 +6,6 @@ require 'compass/exec'
|
|
6
6
|
include Compass::TestCaseHelper
|
7
7
|
include Compass::CommandLineHelper
|
8
8
|
include Compass::IoHelper
|
9
|
-
include Compass::RailsHelper
|
10
9
|
|
11
10
|
Before do
|
12
11
|
Compass.reset_configuration!
|
@@ -41,17 +40,6 @@ Given %r{^I am in the parent directory$} do
|
|
41
40
|
Dir.chdir ".."
|
42
41
|
end
|
43
42
|
|
44
|
-
Given %r{^I'm in a newly created rails project: (.+)$} do |project_name|
|
45
|
-
dir = File.join(Dir.pwd, project_name)
|
46
|
-
@cleanup_directories << dir
|
47
|
-
begin
|
48
|
-
generate_rails_app project_name, Dir.pwd
|
49
|
-
Dir.chdir dir
|
50
|
-
rescue LoadError
|
51
|
-
pending "Missing Ruby-on-rails gems: sudo gem install rails"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
43
|
Given /^I should clean up the directory: (\w+)$/ do |directory|
|
56
44
|
@cleanup_directories << directory
|
57
45
|
end
|
@@ -1,24 +1,39 @@
|
|
1
|
-
|
2
|
-
require "compass/app_integration/#{lib}"
|
3
|
-
end
|
1
|
+
require "compass/app_integration/stand_alone"
|
4
2
|
|
5
3
|
module Compass
|
6
4
|
module AppIntegration
|
7
5
|
module Helpers
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
#attr_accessor :project_types
|
7
|
+
DEAFULT_PROJECT_TYPES = {
|
8
|
+
:stand_alone => "Compass::AppIntegration::StandAlone"
|
9
|
+
}
|
10
|
+
|
11
|
+
def init
|
12
|
+
@project_types ||= DEAFULT_PROJECT_TYPES.dup
|
13
|
+
end
|
14
|
+
|
15
|
+
def project_types
|
16
|
+
@project_types
|
12
17
|
end
|
13
18
|
|
14
|
-
|
19
|
+
def default?
|
20
|
+
@project_types.keys === DEAFULT_PROJECT_TYPES.keys
|
21
|
+
end
|
22
|
+
|
23
|
+
def lookup(type)
|
24
|
+
unless @project_types[type].nil?
|
25
|
+
eval @project_types[type]
|
26
|
+
else
|
27
|
+
raise Compass::Error, "No application integration exists for #{type}"
|
28
|
+
end
|
29
|
+
end
|
15
30
|
|
16
|
-
|
17
|
-
|
18
|
-
s.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
|
31
|
+
def register(type, klass)
|
32
|
+
@project_types[type] = klass
|
19
33
|
end
|
20
34
|
|
21
35
|
end
|
22
36
|
extend Helpers
|
37
|
+
init
|
23
38
|
end
|
24
39
|
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'compass/commands/project_base'
|
2
|
+
require 'compass/commands/update_project'
|
3
|
+
|
4
|
+
module Compass
|
5
|
+
module Commands
|
6
|
+
module StructureOptionsParser
|
7
|
+
def set_options(opts)
|
8
|
+
opts.banner = %Q{
|
9
|
+
Usage: compass structure [path/to/project] [options]
|
10
|
+
|
11
|
+
Description:
|
12
|
+
Display the import structure of your stylesheets.
|
13
|
+
|
14
|
+
Options:
|
15
|
+
}.strip.split("\n").map{|l| l.gsub(/^ {0,10}/,'')}.join("\n")
|
16
|
+
|
17
|
+
super
|
18
|
+
end
|
19
|
+
end
|
20
|
+
class ProjectStats < UpdateProject
|
21
|
+
|
22
|
+
register :structure
|
23
|
+
|
24
|
+
def initialize(working_path, options)
|
25
|
+
super
|
26
|
+
assert_project_directory_exists!
|
27
|
+
end
|
28
|
+
|
29
|
+
def perform
|
30
|
+
@compiler = new_compiler_instance
|
31
|
+
(options[:sass_files] || sorted_sass_files).each do |sass_file|
|
32
|
+
print_tree(Compass.projectize(sass_file))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def print_tree(file, depth = 0, importer = @compiler.importer)
|
37
|
+
puts ((depth > 0 ? "| " : " ") * depth) + "+- " + Compass.deprojectize(file)
|
38
|
+
@compiler.staleness_checker.send(:compute_dependencies, file, importer).each do |(dep, dep_importer)|
|
39
|
+
print_tree(dep, depth + 1, dep_importer)# unless Compass.deprojectize(dep)[0...1] == "/"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def sorted_sass_files
|
44
|
+
sass_files = @compiler.sass_files
|
45
|
+
sass_files.map! do |s|
|
46
|
+
filename = Compass.deprojectize(s, File.join(Compass.configuration.project_path, Compass.configuration.sass_dir))
|
47
|
+
[s, File.dirname(filename), File.basename(filename)]
|
48
|
+
end
|
49
|
+
sass_files = sass_files.sort_by do |s,d,f|
|
50
|
+
File.join(d, f[0] == ?_ ? f[1..-1] : f)
|
51
|
+
end
|
52
|
+
sass_files.map!{|s,d,f| s}
|
53
|
+
end
|
54
|
+
|
55
|
+
class << self
|
56
|
+
|
57
|
+
def option_parser(arguments)
|
58
|
+
parser = Compass::Exec::CommandOptionParser.new(arguments)
|
59
|
+
parser.extend(Compass::Exec::GlobalOptionsParser)
|
60
|
+
parser.extend(Compass::Exec::ProjectOptionsParser)
|
61
|
+
parser.extend(StructureOptionsParser)
|
62
|
+
end
|
63
|
+
|
64
|
+
def usage
|
65
|
+
option_parser([]).to_s
|
66
|
+
end
|
67
|
+
|
68
|
+
def description(command)
|
69
|
+
"Report statistics about your stylesheets"
|
70
|
+
end
|
71
|
+
|
72
|
+
def primary; false; end
|
73
|
+
|
74
|
+
def parse!(arguments)
|
75
|
+
parser = option_parser(arguments)
|
76
|
+
parser.parse!
|
77
|
+
parse_arguments!(parser, arguments)
|
78
|
+
parser.options
|
79
|
+
end
|
80
|
+
|
81
|
+
def parse_arguments!(parser, arguments)
|
82
|
+
if arguments.size > 0
|
83
|
+
parser.options[:project_name] = arguments.shift if File.directory?(arguments.first)
|
84
|
+
parser.options[:sass_files] = arguments
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
@@ -81,6 +81,7 @@ module Compass
|
|
81
81
|
action = FSSM::Backends::Default.to_s == "FSSM::Backends::Polling" ? "polling" : "watching"
|
82
82
|
|
83
83
|
puts ">>> Compass is #{action} for changes. Press Ctrl-C to Stop."
|
84
|
+
$stdout.flush
|
84
85
|
|
85
86
|
begin
|
86
87
|
FSSM.monitor do |monitor|
|
@@ -100,14 +101,17 @@ module Compass
|
|
100
101
|
path.glob glob
|
101
102
|
path.update do |base, relative|
|
102
103
|
puts ">>> Change detected to: #{relative}"
|
104
|
+
$stdout.flush
|
103
105
|
callback.call(base, relative)
|
104
106
|
end
|
105
107
|
path.create do |base, relative|
|
106
108
|
puts ">>> New file detected: #{relative}"
|
109
|
+
$stdout.flush
|
107
110
|
callback.call(base, relative)
|
108
111
|
end
|
109
112
|
path.delete do |base, relative|
|
110
113
|
puts ">>> File Removed: #{relative}"
|
114
|
+
$stdout.flush
|
111
115
|
callback.call(base, relative)
|
112
116
|
end
|
113
117
|
end
|
@@ -138,7 +142,8 @@ module Compass
|
|
138
142
|
compiler = new_compiler_instance(:quiet => true, :loud => [:identical, :overwrite, :create])
|
139
143
|
if file = compiler.out_of_date?
|
140
144
|
begin
|
141
|
-
puts ">>> Change detected to: #{relative || compiler.relative_stylesheet_name(file)}"
|
145
|
+
puts ">>> Change detected at "+Time.now.strftime("%T")+" to: #{relative || compiler.relative_stylesheet_name(file)}"
|
146
|
+
$stdout.flush
|
142
147
|
compiler.run
|
143
148
|
GC.start
|
144
149
|
rescue StandardError => e
|
data/lib/compass/compiler.rb
CHANGED
@@ -12,6 +12,7 @@ module Compass
|
|
12
12
|
sass_opts = options.delete(:sass) || {}
|
13
13
|
self.options = options
|
14
14
|
self.sass_options = options.dup
|
15
|
+
self.sass_options.delete(:quiet)
|
15
16
|
self.sass_options.update(sass_opts)
|
16
17
|
self.sass_options[:cache_location] ||= determine_cache_location
|
17
18
|
self.sass_options[:importer] = self.importer = Sass::Importers::Filesystem.new(from)
|
@@ -36,7 +37,7 @@ module Compass
|
|
36
37
|
|
37
38
|
def stylesheet_name(sass_file)
|
38
39
|
if sass_file.index(from) == 0
|
39
|
-
sass_file[(from.length + 1)..-6]
|
40
|
+
sass_file[(from.length + 1)..-6].sub(/\.css$/,'')
|
40
41
|
else
|
41
42
|
raise Compass::Error, "You must compile individual stylesheets from the project directory."
|
42
43
|
end
|
@@ -25,7 +25,6 @@ module Compass
|
|
25
25
|
attributes_for_directory(:fonts),
|
26
26
|
attributes_for_directory(:extensions, nil),
|
27
27
|
# Compilation options
|
28
|
-
:sprite_load_path,
|
29
28
|
:output_style,
|
30
29
|
:environment,
|
31
30
|
:relative_assets,
|
@@ -44,6 +43,12 @@ module Compass
|
|
44
43
|
:chunky_png_options
|
45
44
|
].flatten
|
46
45
|
|
46
|
+
ARRAY_ATTRIBUTES = [
|
47
|
+
:sprite_load_path,
|
48
|
+
:required_libraries,
|
49
|
+
:loaded_frameworks,
|
50
|
+
:framework_path
|
51
|
+
]
|
47
52
|
# Registers a new configuration property.
|
48
53
|
# Extensions can use this to add new configuration options to compass.
|
49
54
|
#
|
@@ -57,10 +57,11 @@ module Compass
|
|
57
57
|
chained_method :run_stylesheet_error
|
58
58
|
|
59
59
|
inherited_accessor *ATTRIBUTES
|
60
|
-
inherited_accessor :required_libraries, :loaded_frameworks, :framework_path #XXX we should make these arrays add up cumulatively.
|
61
60
|
|
62
61
|
strip_trailing_separator *ATTRIBUTES.select{|a| a.to_s =~ /dir|path/}
|
63
62
|
|
63
|
+
inherited_array *ARRAY_ATTRIBUTES
|
64
|
+
|
64
65
|
def initialize(name, attr_hash = nil)
|
65
66
|
raise "I need a name!" unless name
|
66
67
|
@name = name
|
@@ -91,7 +92,9 @@ module Compass
|
|
91
92
|
# The block will be passed the root-relative url of the asset.
|
92
93
|
# When called without a block, returns the block that was previously set.
|
93
94
|
def asset_host(&block)
|
95
|
+
@set_attributes ||= {}
|
94
96
|
if block_given?
|
97
|
+
@set_attributes[:asset_host] = true
|
95
98
|
@asset_host = block
|
96
99
|
else
|
97
100
|
if @asset_host
|
@@ -116,16 +119,19 @@ module Compass
|
|
116
119
|
#
|
117
120
|
# asset_cache_buster :none
|
118
121
|
def asset_cache_buster(simple = nil, &block)
|
122
|
+
@set_attributes ||= {}
|
119
123
|
if block_given?
|
124
|
+
@set_attributes[:asset_cache_buster] = true
|
120
125
|
@asset_cache_buster = block
|
121
126
|
elsif !simple.nil?
|
122
127
|
if simple == :none
|
128
|
+
@set_attributes[:asset_cache_buster] = true
|
123
129
|
@asset_cache_buster = Proc.new {|_,_| nil}
|
124
130
|
else
|
125
131
|
raise ArgumentError, "Unexpected argument: #{simple.inspect}"
|
126
132
|
end
|
127
133
|
else
|
128
|
-
if
|
134
|
+
if set?(:asset_cache_buster)
|
129
135
|
@asset_cache_buster
|
130
136
|
elsif inherited_data.respond_to?(:asset_cache_buster)
|
131
137
|
inherited_data.asset_cache_buster
|
@@ -173,7 +179,7 @@ module Compass
|
|
173
179
|
private
|
174
180
|
|
175
181
|
def assert_valid_keys!(attr_hash)
|
176
|
-
illegal_attrs = attr_hash.keys - ATTRIBUTES
|
182
|
+
illegal_attrs = attr_hash.keys - ATTRIBUTES - ARRAY_ATTRIBUTES
|
177
183
|
if illegal_attrs.size == 1
|
178
184
|
raise Error, "#{illegal_attrs.first.inspect} is not a valid configuration attribute."
|
179
185
|
elsif illegal_attrs.size > 0
|
@@ -84,13 +84,6 @@ module Compass
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
def configure_rails!(app)
|
88
|
-
return unless app.config.respond_to?(:sass)
|
89
|
-
app.config.compass.to_sass_engine_options.each do |key, value|
|
90
|
-
app.config.sass.send(:"#{key}=", value)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
87
|
def sass_engine_options
|
95
88
|
configuration.to_sass_engine_options
|
96
89
|
end
|
@@ -99,18 +92,9 @@ module Compass
|
|
99
92
|
def add_project_configuration(*args)
|
100
93
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
101
94
|
configuration_file_path = args.shift || detect_configuration_file
|
102
|
-
|
103
|
-
# TODO make this better i don't think it belongs here but it gets the job done
|
104
|
-
# This will allow compass to boot rails and load the config if its configured in the application.rb file via railtie
|
105
|
-
# if File.exists?(projectize('config/boot.rb')) && configuration_file_path.nil?
|
106
|
-
# require 'rails'
|
107
|
-
# require projectize('config/application.rb')
|
108
|
-
# options[:project_type] = :rails
|
109
|
-
# end
|
110
|
-
|
111
|
-
|
95
|
+
|
112
96
|
raise ArgumentError, "Too many arguments" if args.any?
|
113
|
-
if data = configuration_for(configuration_file_path, nil, configuration_for(options[:defaults]))
|
97
|
+
if AppIntegration.default? && data = configuration_for(configuration_file_path, nil, configuration_for(options[:defaults]))
|
114
98
|
if data.raw_project_type
|
115
99
|
add_configuration(data.raw_project_type.to_sym)
|
116
100
|
elsif options[:project_type]
|
@@ -118,10 +102,12 @@ module Compass
|
|
118
102
|
else
|
119
103
|
add_configuration(:stand_alone)
|
120
104
|
end
|
121
|
-
|
122
|
-
|
105
|
+
|
106
|
+
|
107
|
+
add_configuration(data)
|
108
|
+
|
123
109
|
else
|
124
|
-
add_configuration(options[:project_type] || configuration.project_type_without_default || (yield if block_given?) || :stand_alone)
|
110
|
+
add_configuration(options[:project_type] || configuration.project_type_without_default || (yield if block_given?) || :stand_alone)
|
125
111
|
end
|
126
112
|
end
|
127
113
|
|
@@ -61,6 +61,101 @@ module Compass
|
|
61
61
|
inherited_writer(*attributes)
|
62
62
|
end
|
63
63
|
|
64
|
+
class ArrayProxy
|
65
|
+
def initialize(data, attr)
|
66
|
+
@data, @attr = data, attr
|
67
|
+
end
|
68
|
+
def to_ary
|
69
|
+
@data.send(:"read_inherited_#{@attr}_array")
|
70
|
+
end
|
71
|
+
def to_a
|
72
|
+
to_ary
|
73
|
+
end
|
74
|
+
def <<(v)
|
75
|
+
@data.send(:"add_to_#{@attr}", v)
|
76
|
+
end
|
77
|
+
def >>(v)
|
78
|
+
@data.send(:"remove_from_#{@attr}", v)
|
79
|
+
end
|
80
|
+
def serialize_to_config(prop)
|
81
|
+
if v = @data.raw(prop)
|
82
|
+
"#{prop} = #{v.inspect}"
|
83
|
+
else
|
84
|
+
s = ""
|
85
|
+
if added = @data.instance_variable_get("@added_to_#{@attr}")
|
86
|
+
added.each do |a|
|
87
|
+
s << "#{prop} << #{a.inspect}\n"
|
88
|
+
end
|
89
|
+
end
|
90
|
+
if removed = @data.instance_variable_get("@removed_from_#{@attr}")
|
91
|
+
removed.each do |r|
|
92
|
+
s << "#{prop} >> #{r.inspect}\n"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
if s[-1..-1] == "\n"
|
96
|
+
s[0..-2]
|
97
|
+
else
|
98
|
+
s
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
def method_missing(m, *args, &block)
|
103
|
+
a = to_ary
|
104
|
+
if a.respond_to?(m)
|
105
|
+
a.send(m,*args, &block)
|
106
|
+
else
|
107
|
+
super
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def inherited_array(*attributes)
|
113
|
+
inherited_reader(*attributes)
|
114
|
+
inherited_writer(*attributes)
|
115
|
+
attributes.each do |attr|
|
116
|
+
line = __LINE__ + 1
|
117
|
+
class_eval %Q{
|
118
|
+
def #{attr} # def sprite_load_paths
|
119
|
+
ArrayProxy.new(self, #{attr.inspect}) # ArrayProxy.new(self, :sprite_load_paths)
|
120
|
+
end # end
|
121
|
+
def #{attr}=(value) # def sprite_load_paths=(value)
|
122
|
+
@set_attributes ||= {} # @set_attributes ||= {}
|
123
|
+
@set_attributes[#{attr.inspect}] = true # @set_attributes[:sprite_load_paths] = true
|
124
|
+
@#{attr} = Array(value) # @sprite_load_paths = Array(value)
|
125
|
+
@added_to_#{attr} = [] # @added_to_sprite_load_paths = []
|
126
|
+
@removed_from_#{attr} = [] # @removed_from_sprite_load_paths = []
|
127
|
+
end # end
|
128
|
+
def read_inherited_#{attr}_array # def read_inherited_sprite_load_paths_array
|
129
|
+
if #{attr}_set? # if sprite_load_paths_set?
|
130
|
+
@#{attr} # Array(@#{attr})
|
131
|
+
else # else
|
132
|
+
value = if inherited_data # value = Array(read(:sprite_load_paths))
|
133
|
+
Array(inherited_data.#{attr})
|
134
|
+
else
|
135
|
+
Array(read(#{attr.inspect}))
|
136
|
+
end
|
137
|
+
value -= Array(@removed_from_#{attr}) # value -= Array(@removed_from_sprite_load_paths)
|
138
|
+
Array(@added_to_#{attr}) + value # Array(@added_to_sprite_load_paths) + value
|
139
|
+
end # end
|
140
|
+
end # end
|
141
|
+
def add_to_#{attr}(v) # def add_to_sprite_load_paths(v)
|
142
|
+
if #{attr}_set? # if sprite_load_paths_set?
|
143
|
+
raw_#{attr} << v # raw_sprite_load_paths << v
|
144
|
+
else # else
|
145
|
+
(@added_to_#{attr} ||= []) << v # (@added_to_sprite_load_paths ||= []) << v
|
146
|
+
end # end
|
147
|
+
end # end
|
148
|
+
def remove_from_#{attr}(v) # def remove_from_sprite_load_paths(v)
|
149
|
+
if #{attr}_set? # if sprite_load_paths_set?
|
150
|
+
raw_#{attr}.reject!{|e| e == v} # raw_sprite_load_path.reject!{|e| e == v}s
|
151
|
+
else # else
|
152
|
+
(@removed_from_#{attr} ||= []) << v # (@removed_from_sprite_load_paths ||= []) << v
|
153
|
+
end # end
|
154
|
+
end # end
|
155
|
+
}, __FILE__, line
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
64
159
|
def chained_method(method)
|
65
160
|
line = __LINE__ + 1
|
66
161
|
class_eval %Q{
|
@@ -146,6 +241,12 @@ module Compass
|
|
146
241
|
end
|
147
242
|
end
|
148
243
|
|
244
|
+
# Reads the raw value that was set on this object.
|
245
|
+
# you generally should call raw_<attribute>() instead.
|
246
|
+
def raw(attribute)
|
247
|
+
instance_variable_get("@#{attribute}")
|
248
|
+
end
|
249
|
+
|
149
250
|
# Read a value that is either inherited or set on this instance, if we get to the bottom-most configuration instance,
|
150
251
|
# we ask for the default starting at the top level.
|
151
252
|
def read(attribute)
|