compass 0.11.2 → 0.11.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. data/VERSION.yml +1 -1
  2. data/features/command_line.feature +22 -1
  3. data/features/step_definitions/command_line_steps.rb +21 -1
  4. data/frameworks/blueprint/stylesheets/blueprint/_fancy-type.scss +1 -0
  5. data/frameworks/compass/stylesheets/compass/css3/_box.scss +9 -9
  6. data/frameworks/compass/stylesheets/compass/css3/_font-face.scss +4 -14
  7. data/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.scss +14 -1
  8. data/lib/compass.rbc +87 -11
  9. data/lib/compass/actions.rb +21 -9
  10. data/lib/compass/actions.rbc +453 -210
  11. data/lib/compass/commands.rb +1 -1
  12. data/lib/compass/commands/clean_project.rb +79 -0
  13. data/lib/compass/commands/registry.rb +3 -1
  14. data/lib/compass/commands/sprite.rb +1 -1
  15. data/lib/compass/commands/update_project.rb +5 -6
  16. data/lib/compass/commands/watch_project.rb +1 -1
  17. data/lib/compass/compiler.rb +12 -9
  18. data/lib/compass/compiler.rbc +386 -294
  19. data/lib/compass/configuration/adapters.rb +2 -2
  20. data/lib/compass/configuration/adapters.rbc +4 -4
  21. data/lib/compass/configuration/data.rb +4 -2
  22. data/lib/compass/exec/sub_command_ui.rb +1 -1
  23. data/lib/compass/sass_extensions.rbc +117 -19
  24. data/lib/compass/sass_extensions/functions/gradient_support.rbc +489 -453
  25. data/lib/compass/sass_extensions/functions/sprites.rb +4 -4
  26. data/lib/compass/sass_extensions/functions/sprites.rbc +588 -309
  27. data/lib/compass/sass_extensions/functions/urls.rb +18 -3
  28. data/lib/compass/sass_extensions/sprites.rb +9 -7
  29. data/lib/compass/sass_extensions/sprites.rbc +48 -64
  30. data/lib/compass/sass_extensions/sprites/engines.rb +24 -0
  31. data/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb +13 -7
  32. data/lib/compass/sass_extensions/sprites/image_methods.rb +32 -0
  33. data/lib/compass/sass_extensions/sprites/sprite_map.rb +54 -142
  34. data/lib/compass/sass_extensions/sprites/sprite_map.rbc +3839 -1536
  35. data/lib/compass/sass_extensions/sprites/{base.rb → sprite_methods.rb} +21 -101
  36. data/lib/compass/sprite_importer.rb +202 -0
  37. data/lib/compass/sprite_importer.rbc +3943 -0
  38. data/lib/compass/validator.rb +11 -4
  39. data/lib/compass/version.rbc +67 -109
  40. data/test/fixtures/sprites/public/images/bad_extensions/ten-by-ten.gif +0 -0
  41. data/test/fixtures/sprites/public/images/bad_extensions/twenty-by-twenty.jpg +0 -0
  42. data/test/fixtures/stylesheets/busted_image_urls/config.rb +29 -0
  43. data/test/fixtures/stylesheets/busted_image_urls/css/screen.css +9 -0
  44. data/test/fixtures/stylesheets/busted_image_urls/images/feed.png +0 -0
  45. data/test/fixtures/stylesheets/busted_image_urls/images/flags/dk.png +0 -0
  46. data/test/fixtures/stylesheets/busted_image_urls/images/grid.png +0 -0
  47. data/test/fixtures/stylesheets/busted_image_urls/sass/screen.sass +14 -0
  48. data/test/fixtures/stylesheets/busted_image_urls/tmp/screen.css +9 -0
  49. data/test/fixtures/stylesheets/compass/css/box.css +19 -0
  50. data/test/fixtures/stylesheets/compass/css/legacy_clearfix.css +9 -0
  51. data/test/fixtures/stylesheets/compass/css/sprites.css +1 -1
  52. data/test/fixtures/stylesheets/compass/css/utilities.css +7 -0
  53. data/test/fixtures/stylesheets/compass/images/{flag-03c3b29b35.png → flag-s03c3b29b35.png} +0 -0
  54. data/test/fixtures/stylesheets/compass/sass/legacy_clearfix.scss +3 -0
  55. data/test/fixtures/stylesheets/compass/sass/utilities.scss +4 -1
  56. data/test/fixtures/stylesheets/error/config.rb +10 -0
  57. data/test/fixtures/stylesheets/error/sass/screen.sass +2 -0
  58. data/test/integrations/compass_test.rb +22 -9
  59. data/test/integrations/sprites_test.rb +45 -45
  60. data/test/units/actions_test.rb +24 -0
  61. data/test/units/sprites/engine_test.rb +43 -0
  62. data/test/units/sprites/image_test.rb +2 -2
  63. data/test/units/sprites/importer_test.rb +66 -0
  64. data/test/units/sprites/sprite_command_test.rb +60 -0
  65. data/test/units/sprites/{base_test.rb → sprite_map_test.rb} +5 -5
  66. metadata +43 -34
  67. data/lib/compass/sass_extensions/sprites/sprites.rb +0 -62
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 11
4
- :build: 2
4
+ :patch: 3
5
5
  :name: Antares
@@ -145,6 +145,7 @@ Feature: Command Line
145
145
  Scenario: Basic help
146
146
  When I run: compass help
147
147
  Then I should see the following "primary" commands:
148
+ | clean |
148
149
  | compile |
149
150
  | create |
150
151
  | init |
@@ -179,6 +180,27 @@ Feature: Command Line
179
180
  And I run: compass compile
180
181
  And a css file tmp/layout.css is reported overwritten
181
182
 
183
+ Scenario: Cleaning a project
184
+ Given I am using the existing project in test/fixtures/stylesheets/compass
185
+ When I run: compass compile
186
+ And I run: compass clean
187
+ Then the following files are reported removed:
188
+ | .sass-cache/ |
189
+ | tmp/border_radius.css |
190
+ | tmp/box.css |
191
+ | tmp/box_shadow.css |
192
+ | tmp/columns.css |
193
+ | tmp/fonts.css |
194
+ | images/flag-s03c3b29b35.png |
195
+ And the following files are removed:
196
+ | .sass-cache/ |
197
+ | tmp/border_radius.css |
198
+ | tmp/box.css |
199
+ | tmp/box_shadow.css |
200
+ | tmp/columns.css |
201
+ | tmp/fonts.css |
202
+ | images/flag-s03c3b29b35.png |
203
+
182
204
  Scenario: Watching a project for changes
183
205
  Given ruby supports fork
184
206
  Given I am using the existing project in test/fixtures/stylesheets/compass
@@ -218,7 +240,6 @@ Feature: Command Line
218
240
  | sass_dir | sass |
219
241
  | css_dir | assets/css |
220
242
 
221
- @now
222
243
  Scenario Outline: Print out a configuration value
223
244
  Given I am using the existing project in test/fixtures/stylesheets/compass
224
245
  When I run: compass config -p <property>
@@ -76,7 +76,7 @@ When /^I run in a separate process: compass ([^\s]+) ?(.+)?$/ do |command, args|
76
76
  file.puts $stdout.string
77
77
  end
78
78
  open('/tmp/last_error.compass_test.txt', 'w') do |file|
79
- file.puts @stderr.string
79
+ file.puts $stderr.string
80
80
  end
81
81
  exit!
82
82
  end
@@ -116,10 +116,30 @@ Then /^a directory ([^ ]+) is (not )?created$/ do |directory, negated|
116
116
  File.directory?(directory).should == !negated
117
117
  end
118
118
 
119
+ Then /an? \w+ file ([^ ]+) is (not )?removed/ do |filename, negated|
120
+ File.exists?(filename).should == !!negated
121
+ end
122
+
119
123
  Then /an? \w+ file ([^ ]+) is (not )?created/ do |filename, negated|
120
124
  File.exists?(filename).should == !negated
121
125
  end
122
126
 
127
+ Then "the following files are reported removed:" do |table|
128
+ table.rows.each do |css_file|
129
+ Then %Q{a css file #{css_file.first} is reported removed}
130
+ end
131
+ end
132
+
133
+ Then "the following files are removed:" do |table|
134
+ table.rows.each do |css_file|
135
+ Then %Q{a css file #{css_file.first} is removed}
136
+ end
137
+ end
138
+
139
+ Then /an? \w+ file ([^ ]+) is reported removed/ do |filename|
140
+ @last_result.should =~ /remove.*#{Regexp.escape(filename)}/
141
+ end
142
+
123
143
  Then /an? \w+ file ([^ ]+) is reported created/ do |filename|
124
144
  @last_result.should =~ /create.*#{Regexp.escape(filename)}/
125
145
  end
@@ -1,3 +1,4 @@
1
+ @charset "utf-8";
1
2
  @import "typography";
2
3
 
3
4
  $alternate-text-font : "Warnock Pro", "Goudy Old Style", "Palatino", "Book Antiqua", Georgia, serif !default;
@@ -3,7 +3,7 @@
3
3
  // display:box; must be used for any of the other flexbox mixins to work properly
4
4
  @mixin display-box {
5
5
  @include experimental-value(display, box,
6
- -moz, -webkit, not -o, not -ms, not -khtml, official
6
+ -moz, -webkit, not -o, -ms, not -khtml, official
7
7
  );
8
8
  }
9
9
 
@@ -16,7 +16,7 @@ $default-box-orient: horizontal !default;
16
16
  ) {
17
17
  $orientation : unquote($orientation);
18
18
  @include experimental(box-orient, $orientation,
19
- -moz, -webkit, not -o, not -ms, not -khtml, official
19
+ -moz, -webkit, not -o, -ms, not -khtml, official
20
20
  );
21
21
  }
22
22
 
@@ -29,7 +29,7 @@ $default-box-align: stretch !default;
29
29
  ) {
30
30
  $alignment : unquote($alignment);
31
31
  @include experimental(box-align, $alignment,
32
- -moz, -webkit, not -o, not -ms, not -khtml, official
32
+ -moz, -webkit, not -o, -ms, not -khtml, official
33
33
  );
34
34
  }
35
35
 
@@ -43,7 +43,7 @@ $default-box-flex: 0 !default;
43
43
  $flex: $default-box-flex
44
44
  ) {
45
45
  @include experimental(box-flex, $flex,
46
- -moz, -webkit, not -o, not -ms, not -khtml, official
46
+ -moz, -webkit, not -o, -ms, not -khtml, official
47
47
  );
48
48
  }
49
49
 
@@ -55,7 +55,7 @@ $default-box-flex-group: 1 !default;
55
55
  $group: $default-box-flex-group
56
56
  ) {
57
57
  @include experimental(box-flex-group, $group,
58
- -moz, -webkit, not -o, not -ms, not -khtml, official
58
+ -moz, -webkit, not -o, -ms, not -khtml, official
59
59
  );
60
60
  }
61
61
 
@@ -67,7 +67,7 @@ $default-box-ordinal-group: 1 !default;
67
67
  $group: $default-ordinal-flex-group
68
68
  ) {
69
69
  @include experimental(box-ordinal-group, $group,
70
- -moz, -webkit, not -o, not -ms, not -khtml, official
70
+ -moz, -webkit, not -o, -ms, not -khtml, official
71
71
  );
72
72
  }
73
73
 
@@ -80,7 +80,7 @@ $default-box-direction: normal !default;
80
80
  ) {
81
81
  $direction: unquote($direction);
82
82
  @include experimental(box-direction, $direction,
83
- -moz, -webkit, not -o, not -ms, not -khtml, official
83
+ -moz, -webkit, not -o, -ms, not -khtml, official
84
84
  );
85
85
  }
86
86
 
@@ -93,7 +93,7 @@ $default-box-lines: single !default;
93
93
  ) {
94
94
  $lines: unquote($lines);
95
95
  @include experimental(box-lines, $lines,
96
- -moz, -webkit, not -o, not -ms, not -khtml, official
96
+ -moz, -webkit, not -o, -ms, not -khtml, official
97
97
  );
98
98
  }
99
99
 
@@ -106,6 +106,6 @@ $default-box-pack: start !default;
106
106
  ) {
107
107
  $pack: unquote($pack);
108
108
  @include experimental(box-pack, $pack,
109
- -moz, -webkit, not -o, not -ms, not -khtml, official
109
+ -moz, -webkit, not -o, -ms, not -khtml, official
110
110
  );
111
111
  }
@@ -12,7 +12,10 @@
12
12
  //
13
13
  // If you need to generate other formats check out the Font Squirrel
14
14
  // [font generator](http://www.fontsquirrel.com/fontface/generator)
15
-
15
+ //
16
+ // Example:
17
+ //
18
+ // +font-face("this name", font-files("this.woff", "woff", "this.otf", "opentype"), "this.eot")
16
19
  @mixin font-face(
17
20
  $name,
18
21
  $font-files,
@@ -28,16 +31,3 @@
28
31
  src: $font-files;
29
32
  }
30
33
  }
31
-
32
- // EXAMPLE
33
- // +font-face("this name", font-files("this.woff", "woff", "this.otf", "opentype"), "this.eot")
34
- //
35
- // will generate:
36
- //
37
- // @font-face {
38
- // font-family: 'this name';
39
- // src: url('fonts/this.eot');
40
- // src: local("☺"),
41
- // url('fonts/this.otf') format('woff'),
42
- // url('fonts/this.woff') format('opentype');
43
- // }
@@ -18,7 +18,7 @@
18
18
  // [Easy Clearing](http://www.positioniseverything.net/easyclearing.html)
19
19
  // has the advantage of allowing positioned elements to hang
20
20
  // outside the bounds of the container at the expense of more tricky CSS.
21
- @mixin pie-clearfix {
21
+ @mixin legacy-pie-clearfix {
22
22
  &:after {
23
23
  content : "\0020";
24
24
  display : block;
@@ -29,3 +29,16 @@
29
29
  }
30
30
  @include has-layout;
31
31
  }
32
+
33
+ // This is an updated version of the PIE clearfix method that reduces the amount of CSS output.
34
+ // If you need to support Firefox before 3.5 you need to use `legacy-pie-clearfix` instead.
35
+ //
36
+ // Adapted from: [A new micro clearfix hack](http://nicolasgallagher.com/micro-clearfix-hack/)
37
+ @mixin pie-clearfix {
38
+ &:after {
39
+ content: "";
40
+ display: table;
41
+ clear: both;
42
+ }
43
+ @include has-layout;
44
+ }
@@ -502,21 +502,63 @@ x
502
502
  22
503
503
  shared_extension_paths
504
504
  i
505
- 12
506
- 45
505
+ 54
506
+ 39
507
507
  0
508
+ 13
509
+ 10
510
+ 53
511
+ 15
512
+ 45
508
513
  1
509
- 7
510
514
  2
515
+ 7
516
+ 3
511
517
  64
512
518
  49
519
+ 4
520
+ 1
521
+ 13
522
+ 9
523
+ 34
524
+ 15
525
+ 45
526
+ 5
527
+ 6
528
+ 45
529
+ 1
530
+ 7
531
+ 7
513
532
  3
533
+ 64
534
+ 49
535
+ 4
536
+ 1
537
+ 49
538
+ 8
539
+ 1
540
+ 9
541
+ 49
542
+ 45
543
+ 5
544
+ 9
545
+ 7
546
+ 10
547
+ 64
548
+ 49
549
+ 11
514
550
  1
515
551
  35
516
552
  1
553
+ 8
554
+ 51
555
+ 35
556
+ 0
557
+ 38
558
+ 0
517
559
  11
518
560
  I
519
- 2
561
+ 3
520
562
  I
521
563
  0
522
564
  I
@@ -525,11 +567,29 @@ I
525
567
  0
526
568
  n
527
569
  p
570
+ 12
571
+ x
572
+ 23
573
+ @shared_extension_paths
574
+ x
575
+ 3
576
+ ENV
577
+ n
578
+ s
528
579
  4
580
+ HOME
581
+ x
582
+ 2
583
+ []
529
584
  x
530
585
  4
531
586
  File
532
587
  n
588
+ n
589
+ x
590
+ 10
591
+ directory?
592
+ n
533
593
  s
534
594
  21
535
595
  ~/.compass/extensions
@@ -537,7 +597,7 @@ x
537
597
  11
538
598
  expand_path
539
599
  p
540
- 5
600
+ 13
541
601
  I
542
602
  -1
543
603
  I
@@ -545,9 +605,25 @@ I
545
605
  I
546
606
  0
547
607
  I
608
+ 18
609
+ I
610
+ 6
611
+ I
612
+ 13
613
+ I
614
+ 24
615
+ I
616
+ 14
617
+ I
618
+ 31
619
+ I
620
+ 16
621
+ I
622
+ 33
623
+ I
548
624
  12
549
625
  I
550
- c
626
+ 36
551
627
  x
552
628
  44
553
629
  /Users/chris/Projects/compass/lib/compass.rb
@@ -580,11 +656,11 @@ I
580
656
  I
581
657
  2c
582
658
  I
583
- 14
659
+ 1a
584
660
  I
585
661
  38
586
662
  I
587
- 15
663
+ 1b
588
664
  I
589
665
  41
590
666
  x
@@ -668,11 +744,11 @@ p
668
744
  I
669
745
  0
670
746
  I
671
- 18
747
+ 1e
672
748
  I
673
749
  4
674
750
  I
675
- 19
751
+ 1f
676
752
  I
677
753
  13
678
754
  x
@@ -704,7 +780,7 @@ a
704
780
  I
705
781
  4a
706
782
  I
707
- 18
783
+ 1e
708
784
  I
709
785
  63
710
786
  x
@@ -4,7 +4,7 @@ module Compass
4
4
  attr_writer :logger
5
5
 
6
6
  def logger
7
- @logger ||= Logger.new
7
+ @logger ||= ::Compass::Logger.new
8
8
  end
9
9
 
10
10
  # copy/process a template in the compass template directory to the project directory.
@@ -17,13 +17,14 @@ module Compass
17
17
  # create a directory and all the directories necessary to reach it.
18
18
  def directory(dir, options = nil)
19
19
  options ||= self.options if self.respond_to?(:options)
20
+ options ||= {}
20
21
  if File.exists?(dir) && File.directory?(dir)
21
- # logger.record :exists, basename(dir) unless options[:quiet]
22
+ # do nothing
22
23
  elsif File.exists?(dir)
23
24
  msg = "#{basename(dir)} already exists and is not a directory."
24
25
  raise Compass::FilesystemConflict.new(msg)
25
26
  else
26
- logger.record :directory, separate("#{basename(dir)}/")
27
+ log_action :directory, separate("#{basename(dir)}/"), options
27
28
  FileUtils.mkdir_p(dir) unless options[:dry_run]
28
29
  end
29
30
  end
@@ -33,20 +34,19 @@ module Compass
33
34
  options ||= self.options if self.respond_to?(:options)
34
35
  skip_write = options[:dry_run]
35
36
  contents = process_erb(contents, options[:erb]) if options[:erb]
36
- extra = options[:extra] || ""
37
37
  if File.exists?(file_name)
38
38
  existing_contents = IO.read(file_name)
39
39
  if existing_contents == contents
40
- logger.record :identical, basename(file_name), extra
40
+ log_action :identical, basename(file_name), options
41
41
  skip_write = true
42
42
  elsif options[:force]
43
- logger.record :overwrite, basename(file_name), extra
43
+ log_action :overwrite, basename(file_name), options
44
44
  else
45
45
  msg = "File #{basename(file_name)} already exists. Run with --force to force overwrite."
46
46
  raise Compass::FilesystemConflict.new(msg)
47
47
  end
48
48
  else
49
- logger.record :create, basename(file_name), extra
49
+ log_action :create, basename(file_name), options
50
50
  end
51
51
  if skip_write
52
52
  FileUtils.touch file_name unless options[:dry_run]
@@ -65,9 +65,12 @@ module Compass
65
65
  end
66
66
 
67
67
  def remove(file_name)
68
- if File.exists?(file_name)
68
+ if File.directory?(file_name)
69
+ FileUtils.rm_rf file_name
70
+ log_action :remove, basename(file_name)+"/", options
71
+ elsif File.exists?(file_name)
69
72
  File.unlink file_name
70
- logger.record :remove, basename(file_name)
73
+ log_action :remove, basename(file_name), options
71
74
  end
72
75
  end
73
76
 
@@ -95,5 +98,14 @@ module Compass
95
98
  (path[-1..-1] == File::SEPARATOR) ? path[0..-2] : path
96
99
  end
97
100
 
101
+ def log_action(action, file, options)
102
+ quiet = !!options[:quiet]
103
+ quiet = false if options[:loud] && options[:loud] == true
104
+ quiet = false if options[:loud] && options[:loud].is_a?(Array) && options[:loud].include?(action)
105
+ unless quiet
106
+ logger.record(action, file, options[:extra].to_s)
107
+ end
108
+ end
109
+
98
110
  end
99
111
  end