compass-core-sass37 1.1.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.
Files changed (147) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +22 -0
  3. data/VERSION +1 -0
  4. data/data/caniuse.json +1 -0
  5. data/data/caniuse_extras/css-placeholder.json +171 -0
  6. data/lib/compass/browser_support.rb +64 -0
  7. data/lib/compass/configuration/adapters.rb +109 -0
  8. data/lib/compass/configuration/data.rb +199 -0
  9. data/lib/compass/configuration/defaults.rb +207 -0
  10. data/lib/compass/configuration/inheritance.rb +307 -0
  11. data/lib/compass/configuration/paths.rb +19 -0
  12. data/lib/compass/configuration/watch.rb +38 -0
  13. data/lib/compass/configuration.rb +175 -0
  14. data/lib/compass/core/caniuse.rb +314 -0
  15. data/lib/compass/core/generated_version.rb +6 -0
  16. data/lib/compass/core/sass_extensions/functions/colors.rb +67 -0
  17. data/lib/compass/core/sass_extensions/functions/configuration.rb +173 -0
  18. data/lib/compass/core/sass_extensions/functions/constants.rb +56 -0
  19. data/lib/compass/core/sass_extensions/functions/cross_browser_support.rb +270 -0
  20. data/lib/compass/core/sass_extensions/functions/display.rb +32 -0
  21. data/lib/compass/core/sass_extensions/functions/enumerate.rb +7 -0
  22. data/lib/compass/core/sass_extensions/functions/env.rb +72 -0
  23. data/lib/compass/core/sass_extensions/functions/files.rb +33 -0
  24. data/lib/compass/core/sass_extensions/functions/font_files.rb +65 -0
  25. data/lib/compass/core/sass_extensions/functions/gradient_support.rb +859 -0
  26. data/lib/compass/core/sass_extensions/functions/image_size.rb +117 -0
  27. data/lib/compass/core/sass_extensions/functions/inline_image.rb +63 -0
  28. data/lib/compass/core/sass_extensions/functions/lists.rb +102 -0
  29. data/lib/compass/core/sass_extensions/functions/math.rb +105 -0
  30. data/lib/compass/core/sass_extensions/functions/selectors.rb +79 -0
  31. data/lib/compass/core/sass_extensions/functions/urls.rb +315 -0
  32. data/lib/compass/core/sass_extensions/functions.rb +41 -0
  33. data/lib/compass/core/sass_extensions/monkey_patches/browser_support.rb +119 -0
  34. data/lib/compass/core/sass_extensions/monkey_patches/traversal.rb +23 -0
  35. data/lib/compass/core/sass_extensions/monkey_patches.rb +3 -0
  36. data/lib/compass/core/sass_extensions.rb +10 -0
  37. data/lib/compass/core/version.rb +13 -0
  38. data/lib/compass/core.rb +78 -0
  39. data/lib/compass/error.rb +5 -0
  40. data/lib/compass/frameworks.rb +181 -0
  41. data/lib/compass/util.rb +19 -0
  42. data/lib/compass-core.rb +1 -0
  43. data/stylesheets/_compass.scss +3 -0
  44. data/stylesheets/_lemonade.scss +38 -0
  45. data/stylesheets/compass/_configuration.scss +54 -0
  46. data/stylesheets/compass/_css3.scss +21 -0
  47. data/stylesheets/compass/_layout.scss +3 -0
  48. data/stylesheets/compass/_reset-legacy.scss +3 -0
  49. data/stylesheets/compass/_reset.scss +3 -0
  50. data/stylesheets/compass/_support.scss +447 -0
  51. data/stylesheets/compass/_typography.scss +4 -0
  52. data/stylesheets/compass/_utilities.scss +9 -0
  53. data/stylesheets/compass/css3/_animation.scss +122 -0
  54. data/stylesheets/compass/css3/_appearance.scss +17 -0
  55. data/stylesheets/compass/css3/_background-clip.scss +35 -0
  56. data/stylesheets/compass/css3/_background-origin.scss +37 -0
  57. data/stylesheets/compass/css3/_background-size.scss +19 -0
  58. data/stylesheets/compass/css3/_border-radius.scss +107 -0
  59. data/stylesheets/compass/css3/_box-shadow.scss +88 -0
  60. data/stylesheets/compass/css3/_box-sizing.scss +21 -0
  61. data/stylesheets/compass/css3/_box.scss +85 -0
  62. data/stylesheets/compass/css3/_columns.scss +212 -0
  63. data/stylesheets/compass/css3/_deprecated-support.scss +272 -0
  64. data/stylesheets/compass/css3/_filter.scss +50 -0
  65. data/stylesheets/compass/css3/_flexbox.scss +156 -0
  66. data/stylesheets/compass/css3/_font-face.scss +48 -0
  67. data/stylesheets/compass/css3/_hyphenation.scss +71 -0
  68. data/stylesheets/compass/css3/_images.scss +152 -0
  69. data/stylesheets/compass/css3/_inline-block.scss +31 -0
  70. data/stylesheets/compass/css3/_opacity.scss +27 -0
  71. data/stylesheets/compass/css3/_pie.scss +1 -0
  72. data/stylesheets/compass/css3/_regions.scss +27 -0
  73. data/stylesheets/compass/css3/_selection.scss +59 -0
  74. data/stylesheets/compass/css3/_shared.scss +5 -0
  75. data/stylesheets/compass/css3/_text-shadow.scss +82 -0
  76. data/stylesheets/compass/css3/_transform.scss +590 -0
  77. data/stylesheets/compass/css3/_transition.scss +190 -0
  78. data/stylesheets/compass/css3/_user-interface.scss +71 -0
  79. data/stylesheets/compass/layout/_grid-background.scss +178 -0
  80. data/stylesheets/compass/layout/_sticky-footer.scss +23 -0
  81. data/stylesheets/compass/layout/_stretching.scss +24 -0
  82. data/stylesheets/compass/reset/_utilities-legacy.scss +135 -0
  83. data/stylesheets/compass/reset/_utilities.scss +142 -0
  84. data/stylesheets/compass/typography/_links.scss +3 -0
  85. data/stylesheets/compass/typography/_lists.scss +4 -0
  86. data/stylesheets/compass/typography/_text.scss +4 -0
  87. data/stylesheets/compass/typography/_units.scss +183 -0
  88. data/stylesheets/compass/typography/_vertical_rhythm.scss +300 -0
  89. data/stylesheets/compass/typography/links/_hover-link.scss +5 -0
  90. data/stylesheets/compass/typography/links/_link-colors.scss +28 -0
  91. data/stylesheets/compass/typography/links/_unstyled-link.scss +7 -0
  92. data/stylesheets/compass/typography/lists/_bullets.scss +34 -0
  93. data/stylesheets/compass/typography/lists/_horizontal-list.scss +63 -0
  94. data/stylesheets/compass/typography/lists/_inline-block-list.scss +50 -0
  95. data/stylesheets/compass/typography/lists/_inline-list.scss +47 -0
  96. data/stylesheets/compass/typography/text/_ellipsis.scss +25 -0
  97. data/stylesheets/compass/typography/text/_force-wrap.scss +12 -0
  98. data/stylesheets/compass/typography/text/_nowrap.scss +2 -0
  99. data/stylesheets/compass/typography/text/_replacement.scss +74 -0
  100. data/stylesheets/compass/utilities/_color.scss +1 -0
  101. data/stylesheets/compass/utilities/_general.scss +6 -0
  102. data/stylesheets/compass/utilities/_links.scss +5 -0
  103. data/stylesheets/compass/utilities/_lists.scss +6 -0
  104. data/stylesheets/compass/utilities/_print.scss +17 -0
  105. data/stylesheets/compass/utilities/_sass.scss +2 -0
  106. data/stylesheets/compass/utilities/_sprites.scss +2 -0
  107. data/stylesheets/compass/utilities/_tables.scss +3 -0
  108. data/stylesheets/compass/utilities/_text.scss +5 -0
  109. data/stylesheets/compass/utilities/color/_brightness.scss +20 -0
  110. data/stylesheets/compass/utilities/color/_contrast.scss +52 -0
  111. data/stylesheets/compass/utilities/general/_clearfix.scss +44 -0
  112. data/stylesheets/compass/utilities/general/_float.scss +38 -0
  113. data/stylesheets/compass/utilities/general/_hacks.scss +65 -0
  114. data/stylesheets/compass/utilities/general/_min.scss +16 -0
  115. data/stylesheets/compass/utilities/general/_reset.scss +2 -0
  116. data/stylesheets/compass/utilities/general/_tabs.scss +1 -0
  117. data/stylesheets/compass/utilities/general/_tag-cloud.scss +18 -0
  118. data/stylesheets/compass/utilities/links/_hover-link.scss +3 -0
  119. data/stylesheets/compass/utilities/links/_link-colors.scss +3 -0
  120. data/stylesheets/compass/utilities/links/_unstyled-link.scss +3 -0
  121. data/stylesheets/compass/utilities/lists/_bullets.scss +3 -0
  122. data/stylesheets/compass/utilities/lists/_horizontal-list.scss +3 -0
  123. data/stylesheets/compass/utilities/lists/_inline-block-list.scss +3 -0
  124. data/stylesheets/compass/utilities/lists/_inline-list.scss +3 -0
  125. data/stylesheets/compass/utilities/sass/_lists.scss +16 -0
  126. data/stylesheets/compass/utilities/sass/_maps.scss +19 -0
  127. data/stylesheets/compass/utilities/sprites/_base.scss +92 -0
  128. data/stylesheets/compass/utilities/sprites/_sprite-img.scss +81 -0
  129. data/stylesheets/compass/utilities/tables/_alternating-rows-and-columns.scss +22 -0
  130. data/stylesheets/compass/utilities/tables/_borders.scss +38 -0
  131. data/stylesheets/compass/utilities/tables/_scaffolding.scss +9 -0
  132. data/stylesheets/compass/utilities/text/_ellipsis.scss +3 -0
  133. data/stylesheets/compass/utilities/text/_nowrap.scss +3 -0
  134. data/stylesheets/compass/utilities/text/_replacement.scss +3 -0
  135. data/templates/ellipsis/ellipsis.sass +9 -0
  136. data/templates/ellipsis/manifest.rb +27 -0
  137. data/templates/ellipsis/xml/ellipsis.xml +14 -0
  138. data/templates/extension/manifest.rb +26 -0
  139. data/templates/extension/stylesheets/main.sass +1 -0
  140. data/templates/extension/templates/project/manifest.rb +2 -0
  141. data/templates/extension/templates/project/screen.sass +2 -0
  142. data/templates/project/USAGE.markdown +32 -0
  143. data/templates/project/ie.sass +6 -0
  144. data/templates/project/manifest.rb +4 -0
  145. data/templates/project/print.sass +6 -0
  146. data/templates/project/screen.sass +7 -0
  147. metadata +257 -0
@@ -0,0 +1,207 @@
1
+ module Compass
2
+ module Configuration
3
+ module Defaults
4
+ def default_project_path
5
+ "."
6
+ end
7
+
8
+ def default_project_type
9
+ :stand_alone
10
+ end
11
+
12
+ def default_http_path
13
+ "/"
14
+ end
15
+
16
+ def default_extensions_dir
17
+ "extensions"
18
+ end
19
+
20
+ def default_css_dir
21
+ "stylesheets"
22
+ end
23
+
24
+ def default_sass_dir
25
+ "sass"
26
+ end
27
+
28
+ def default_fonts_dir
29
+ "fonts"
30
+ end
31
+
32
+ def default_images_dir
33
+ "images"
34
+ end
35
+
36
+ def default_environment
37
+ :development
38
+ end
39
+
40
+ def default_output_style
41
+ if top_level.environment == :development
42
+ :expanded
43
+ else
44
+ :compressed
45
+ end
46
+ end
47
+
48
+ def default_line_comments
49
+ top_level.environment == :development
50
+ end
51
+
52
+ def default_color_output
53
+ true
54
+ end
55
+
56
+ def default_sass_path
57
+ if (pp = top_level.project_path) && (dir = top_level.sass_dir)
58
+ Compass.projectize(dir, pp)
59
+ end
60
+ end
61
+
62
+ def default_css_path
63
+ if (pp = top_level.project_path) && (dir = top_level.css_dir)
64
+ Compass.projectize(dir, pp)
65
+ end
66
+ end
67
+
68
+ def default_images_path
69
+ if (pp = top_level.project_path) && (dir = top_level.images_dir)
70
+ Compass.projectize(dir, pp)
71
+ end
72
+ end
73
+
74
+ def default_generated_images_path
75
+ if (pp = top_level.project_path) && (dir = top_level.generated_images_dir)
76
+ Compass.projectize(dir, pp)
77
+ else
78
+ top_level.images_path
79
+ end
80
+ end
81
+
82
+ def default_javascripts_path
83
+ if (pp = top_level.project_path) && (dir = top_level.javascripts_dir)
84
+ Compass.projectize(dir, pp)
85
+ end
86
+ end
87
+
88
+ def default_extensions_path
89
+ if (pp = top_level.project_path) && (dir = top_level.extensions_dir)
90
+ Compass.projectize(dir, pp)
91
+ end
92
+ end
93
+
94
+ def default_fonts_path
95
+ if (pp = top_level.project_path) && (dir = top_level.fonts_dir)
96
+ Compass.projectize(dir, pp)
97
+ end
98
+ end
99
+
100
+ def default_cache_dir
101
+ ".sass-cache"
102
+ end
103
+
104
+ def default_cache_path
105
+ if (pp = top_level.project_path) && (dir = top_level.cache_dir_without_default)
106
+ Compass.projectize(dir, pp)
107
+ # TODO We should make Sass::Plugin.options a configuration source instead of
108
+ # TODO one-offing it like this.
109
+ elsif defined?(Sass::Plugin) && Sass::Plugin.options[:cache_location]
110
+ File.expand_path(Sass::Plugin.options[:cache_location])
111
+ elsif (pp = top_level.project_path) && (dir = top_level.cache_dir)
112
+ Compass.projectize(dir, pp)
113
+ end
114
+ end
115
+
116
+ def default_generated_images_dir
117
+ top_level.images_dir
118
+ end
119
+
120
+ def default_http_generated_images_dir
121
+ top_level.http_images_dir
122
+ end
123
+
124
+ def default_http_images_dir
125
+ top_level.images_dir
126
+ end
127
+
128
+ def default_sprite_load_path
129
+ [top_level.images_path]
130
+ end
131
+
132
+ def default_http_images_path
133
+ http_root_relative top_level.http_images_dir
134
+ end
135
+
136
+ def default_http_stylesheets_dir
137
+ top_level.css_dir
138
+ end
139
+
140
+ def default_http_stylesheets_path
141
+ http_root_relative top_level.http_stylesheets_dir
142
+ end
143
+
144
+ def default_http_generated_images_path
145
+ http_root_relative top_level.http_generated_images_dir
146
+ end
147
+
148
+ def default_http_fonts_dir
149
+ top_level.fonts_dir
150
+ end
151
+
152
+ def default_http_fonts_path
153
+ http_root_relative top_level.http_fonts_dir
154
+ end
155
+
156
+ def default_http_javascripts_dir
157
+ top_level.javascripts_dir
158
+ end
159
+
160
+ def default_http_javascripts_path
161
+ http_root_relative top_level.http_javascripts_dir
162
+ end
163
+
164
+ def default_cache
165
+ true
166
+ end
167
+
168
+ def default_preferred_syntax
169
+ :scss
170
+ end
171
+
172
+ def default_sprite_engine
173
+ :chunky_png
174
+ end
175
+
176
+ def default_chunky_png_options
177
+ if defined?(::Zlib)
178
+ {:compression => Zlib::BEST_COMPRESSION}
179
+ else
180
+ {}
181
+ end
182
+ end
183
+
184
+ # helper functions
185
+
186
+ def http_join(*segments)
187
+ segments.map do |segment|
188
+ next unless segment
189
+ segment = http_pathify(segment)
190
+ segment[-1..-1] == "/" ? segment[0..-2] : segment
191
+ end.join("/")
192
+ end
193
+
194
+ def http_pathify(path)
195
+ if File::SEPARATOR == "/"
196
+ path
197
+ else
198
+ path.gsub(File::SEPARATOR, "/")
199
+ end
200
+ end
201
+
202
+ def http_root_relative(path)
203
+ http_join top_level.http_path, path
204
+ end
205
+ end
206
+ end
207
+ end
@@ -0,0 +1,307 @@
1
+ module Compass
2
+ module Configuration
3
+ # The inheritance module makes it easy for configuration data to inherit from
4
+ # other instances of configuration data. This makes it easier for external code to layer
5
+ # bits of configuration from various sources.
6
+ module Inheritance
7
+
8
+ def self.included(base)
9
+ # inherited_data stores configuration data that this configuration object will
10
+ # inherit if not provided explicitly.
11
+ base.send :attr_accessor, :inherited_data, :set_attributes, :top_level
12
+
13
+ base.send(:include, InstanceMethods)
14
+ base.extend(ClassMethods)
15
+ end
16
+
17
+ module ClassMethods
18
+ def inherited_writer(*attributes)
19
+ attributes.each do |attribute|
20
+ line = __LINE__ + 1
21
+ class_eval %Q{
22
+ def #{attribute}=(value) # def css_dir=(value)
23
+ @set_attributes ||= {} # @set_attributes ||= {}
24
+ @set_attributes[#{attribute.inspect}] = true # @set_attributes[:css_dir] = true
25
+ @#{attribute} = value # @css_dir = value
26
+ end # end
27
+
28
+ def unset_#{attribute}! # def unset_css_dir!
29
+ unset!(#{attribute.inspect}) # unset!(:css_dir)
30
+ end # end
31
+
32
+ def #{attribute}_set? # def css_dir_set?
33
+ set?(#{attribute.inspect}) # set?(:css_dir)
34
+ end # end
35
+ }, __FILE__, line
36
+ end
37
+ end
38
+
39
+ # Defines the default reader to be an inherited_reader that will look at the inherited_data for its
40
+ # value when not set. The inherited reader calls to a raw reader that acts like a normal attribute
41
+ # reader but prefixes the attribute name with "raw_".
42
+ def inherited_reader(*attributes)
43
+ attributes.each do |attribute|
44
+ line = __LINE__ + 1
45
+ class_eval %Q{
46
+ def raw_#{attribute} # def raw_css_dir
47
+ @#{attribute} # @css_dir
48
+ end # end
49
+ def #{attribute}_without_default # def css_dir_without_default
50
+ read_without_default(#{attribute.inspect}) # read_without_default(:css_dir)
51
+ end # end
52
+ def #{attribute} # def css_dir
53
+ read(#{attribute.inspect}) # read(:css_dir)
54
+ end # end
55
+ }, __FILE__, line
56
+ end
57
+ end
58
+
59
+ def inherited_accessor(*attributes)
60
+ inherited_reader(*attributes)
61
+ inherited_writer(*attributes)
62
+ end
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
+ options = attributes.last.is_a?(Hash) ? attributes.pop : {}
114
+ inherited_reader(*attributes)
115
+ inherited_writer(*attributes)
116
+ attributes.each do |attr|
117
+ line = __LINE__ + 1
118
+ class_eval %Q{
119
+ def #{attr} # def sprite_load_paths
120
+ ArrayProxy.new(self, #{attr.inspect}) # ArrayProxy.new(self, :sprite_load_paths)
121
+ end # end
122
+ def #{attr}=(value) # def sprite_load_paths=(value)
123
+ @set_attributes ||= {} # @set_attributes ||= {}
124
+ @set_attributes[#{attr.inspect}] = true # @set_attributes[:sprite_load_paths] = true
125
+ @#{attr} = Array(value) # @sprite_load_paths = Array(value)
126
+ @added_to_#{attr} = [] # @added_to_sprite_load_paths = []
127
+ @removed_from_#{attr} = [] # @removed_from_sprite_load_paths = []
128
+ end # end
129
+ def read_inherited_#{attr}_array # def read_inherited_sprite_load_paths_array
130
+ value = if inherited_data # value = if inherited_data
131
+ if #{!!options[:clobbers]} && #{attr}_set?
132
+ Array(@#{attr}) # Array(@#{attr})
133
+ else
134
+ Array(@#{attr}) + inherited_data.read_inherited_#{attr}_array # inherited_data.read_inherited_sprite_load_paths_array + Array(@sprite_load_paths)
135
+ end
136
+ elsif #{attr}_set? # elsif sprite_load_paths_set?
137
+ Array(@#{attr}) # Array(@#{attr})
138
+ else # else
139
+ top_level.default_for(#{attr.inspect}) || [] # top_level.default_for(:sprite_load_paths) || []
140
+ end # end
141
+ value -= Array(@removed_from_#{attr}) # value -= Array(@removed_from_sprite_load_paths)
142
+ Array(@added_to_#{attr}) + value # Array(@added_to_sprite_load_paths) + value
143
+ end # end
144
+ def add_to_#{attr}(v) # def add_to_sprite_load_paths(v)
145
+ if #{attr}_set? # if sprite_load_paths_set?
146
+ raw_#{attr} << v # raw_sprite_load_paths << v
147
+ else # else
148
+ (@added_to_#{attr} ||= []) << v # (@added_to_sprite_load_paths ||= []) << v
149
+ end # end
150
+ end # end
151
+ def remove_from_#{attr}(v) # def remove_from_sprite_load_paths(v)
152
+ if #{attr}_set? # if sprite_load_paths_set?
153
+ raw_#{attr}.reject!{|e| e == v} # raw_sprite_load_path.reject!{|e| e == v}s
154
+ else # else
155
+ (@removed_from_#{attr} ||= []) << v # (@removed_from_sprite_load_paths ||= []) << v
156
+ end # end
157
+ end # end
158
+ }, __FILE__, line
159
+ end
160
+ end
161
+
162
+ def chained_method(method)
163
+ line = __LINE__ + 1
164
+ class_eval %Q{
165
+ alias_method :_chained_#{method}, method
166
+ def #{method}(*args, &block)
167
+ _chained_#{method}(*args, &block)
168
+ if inherited_data
169
+ inherited_data.#{method}(*args, &block)
170
+ end
171
+ end
172
+ }, __FILE__, line
173
+ end
174
+
175
+
176
+ end
177
+
178
+ module InstanceMethods
179
+
180
+ def on_top!
181
+ self.set_top_level(self)
182
+ end
183
+
184
+ def set_top_level(new_top)
185
+ self.top_level = new_top
186
+ if self.inherited_data.respond_to?(:set_top_level)
187
+ self.inherited_data.set_top_level(new_top)
188
+ end
189
+ end
190
+
191
+
192
+ def inherit_from!(data)
193
+ if self.inherited_data
194
+ self.inherited_data.inherit_from!(data)
195
+ else
196
+ self.inherited_data = data
197
+ end
198
+ self
199
+ end
200
+
201
+ def reset_inheritance!
202
+ self.inherited_data = nil
203
+ end
204
+
205
+ def with_defaults(data)
206
+ inherit_from!(data)
207
+ yield
208
+ reset_inheritance!
209
+ end
210
+
211
+ def unset!(attribute)
212
+ @set_attributes ||= {}
213
+ send("#{attribute}=", nil)
214
+ @set_attributes.delete(attribute)
215
+ nil
216
+ end
217
+
218
+ def set?(attribute)
219
+ @set_attributes ||= {}
220
+ @set_attributes[attribute]
221
+ end
222
+
223
+ def any_attributes_set?
224
+ @set_attributes && @set_attributes.size > 0
225
+ end
226
+
227
+ def default_for(attribute)
228
+ method = "default_#{attribute}".to_sym
229
+ if respond_to?(method)
230
+ send(method)
231
+ end
232
+ end
233
+
234
+ # Read an explicitly set value that is either inherited or set on this instance
235
+ def read_without_default(attribute)
236
+ if set?(attribute)
237
+ send("raw_#{attribute}")
238
+ elsif inherited_data.nil?
239
+ nil
240
+ elsif inherited_data.respond_to?("#{attribute}_without_default")
241
+ inherited_data.send("#{attribute}_without_default")
242
+ elsif inherited_data.respond_to?(attribute)
243
+ inherited_data.send(attribute)
244
+ end
245
+ end
246
+
247
+ # Reads the raw value that was set on this object.
248
+ # you generally should call raw_<attribute>() instead.
249
+ def raw(attribute)
250
+ instance_variable_get("@#{attribute}")
251
+ end
252
+
253
+ # Read a value that is either inherited or set on this instance, if we get to the bottom-most configuration instance,
254
+ # we ask for the default starting at the top level.
255
+ def read(attribute)
256
+ if !(v = send("#{attribute}_without_default")).nil?
257
+ v
258
+ else
259
+ top_level.default_for(attribute)
260
+ end
261
+ end
262
+
263
+ def method_missing(meth, *args, &block)
264
+ if inherited_data
265
+ inherited_data.send(meth, *args, &block)
266
+ else
267
+ raise NoMethodError, meth.to_s
268
+ end
269
+ end
270
+
271
+ def respond_to?(meth)
272
+ if super
273
+ true
274
+ elsif inherited_data
275
+ inherited_data.respond_to?(meth)
276
+ else
277
+ false
278
+ end
279
+ end
280
+
281
+ def chain
282
+ instances = [self]
283
+ instances << instances.last.inherited_data while instances.last.inherited_data
284
+ instances
285
+ end
286
+
287
+ def debug
288
+ normalized_attrs = {}
289
+ (ATTRIBUTES + ARRAY_ATTRIBUTES).each do |prop|
290
+ values = []
291
+ chain.each do |instance|
292
+ values << {
293
+ :raw => (instance.send("raw_#{prop}") rescue nil),
294
+ :value => (instance.send("#{prop}_without_default") rescue nil),
295
+ :default => (instance.send("default_#{prop}") rescue nil),
296
+ :resolved => instance.send(prop)
297
+ }
298
+ end
299
+ normalized_attrs[prop] = values
300
+ end
301
+ normalized_attrs
302
+ end
303
+
304
+ end
305
+ end
306
+ end
307
+ end
@@ -0,0 +1,19 @@
1
+ module Compass::Configuration::Paths
2
+
3
+ TRAILING_SEPARATOR = %r{.(/|#{Regexp.escape(File::SEPARATOR)})$}
4
+
5
+ def strip_trailing_separator(*attributes)
6
+ attributes.each do |attr|
7
+ alias_method "#{attr}_with_trailing_separator".to_sym, attr
8
+ class_eval %Q{
9
+ def #{attr} # def css_dir
10
+ path = #{attr}_with_trailing_separator # path = css_dir_with_trailing_separator
11
+ if path.to_s =~ TRAILING_SEPARATOR # if path =~ TRAILING_SEPARATOR
12
+ path = path[0..-($1.length+1)] # path = path[0..-($1.length+1)]
13
+ end # end
14
+ path # path
15
+ end # end
16
+ }
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,38 @@
1
+ module Compass
2
+ module Configuration
3
+ class Watch
4
+ attr_reader :callback
5
+ attr_reader :glob
6
+ attr_reader :full_glob
7
+
8
+ def initialize(glob, &block)
9
+ unless block
10
+ raise ArgumentError, "A Block must be supplied in order to be watched"
11
+ end
12
+ @callback = block
13
+ unless glob
14
+ raise ArgumentErrorn, "A glob must be supplied in order to be watched"
15
+ end
16
+ @glob = glob
17
+
18
+ if Pathname.new(glob).absolute?
19
+ @full_glob = glob
20
+ else
21
+ @full_glob = File.join(Compass.configuration.project_path, glob)
22
+ end
23
+ end
24
+
25
+ def run_callback(base, relative, action)
26
+ callback.call(base, relative, action)
27
+ end
28
+
29
+ def run_once_per_changeset?
30
+ false
31
+ end
32
+
33
+ def match?(changed_path)
34
+ File.fnmatch(full_glob, changed_path, File::FNM_PATHNAME)
35
+ end
36
+ end
37
+ end
38
+ end