staticmatic 0.11.0.alpha.5 → 0.11.0.alpha.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -2,4 +2,4 @@
2
2
  :major: 0
3
3
  :minor: 11
4
4
  :patch: 0
5
- :build: alpha.5
5
+ :build: alpha.6
data/bin/staticmatic CHANGED
@@ -12,22 +12,5 @@ end
12
12
 
13
13
  $:.push File.join(directory, "lib")
14
14
 
15
- configuration = StaticMatic::Configuration.new
16
-
17
- config_file = File.join(directory, "config", "site.rb")
18
-
19
- if !File.exists?(config_file)
20
- config_file = File.join(directory, "src", "configuration.rb")
21
-
22
- if File.exists?(config_file)
23
- puts "DEPRECATION: #{directory}/src/configuration.rb will be moved to #{directory}/config/site.rb in 0.12.0"
24
- end
25
- end
26
-
27
- if File.exists?(config_file)
28
- config = File.read(config_file)
29
- eval(config)
30
- end
31
-
32
- staticmatic = StaticMatic::Base.new(directory, configuration)
15
+ staticmatic = StaticMatic::Base.new(directory)
33
16
  staticmatic.run(command)
@@ -33,10 +33,33 @@ module StaticMatic
33
33
  @scope = Object.new
34
34
  @scope.instance_variable_set("@staticmatic", self)
35
35
 
36
+ load_configuration
36
37
  configure_compass
38
+
37
39
  load_helpers
38
40
  end
39
41
 
42
+ def load_configuration
43
+ configuration = StaticMatic::Configuration.new
44
+ config_file = File.join(@base_dir, "config", "site.rb")
45
+
46
+ if !File.exists?(config_file)
47
+ config_file = File.join(@base_dir, "src", "configuration.rb")
48
+
49
+ if File.exists?(config_file)
50
+ puts "DEPRECATION: #{@base_dir}/src/configuration.rb will be moved to #{@base_dir}/config/site.rb in 0.12.0"
51
+ end
52
+ end
53
+
54
+ if File.exists?(config_file)
55
+ config = File.read(config_file)
56
+ eval(config)
57
+ end
58
+
59
+ # Compass.sass_engine_options.merge!(configuration.sass_options)
60
+ @configuration = configuration
61
+ end
62
+
40
63
  def base_dir
41
64
  @base_dir
42
65
  end
@@ -69,17 +92,16 @@ module StaticMatic
69
92
  end
70
93
 
71
94
  def configure_compass
72
- Compass.configuration do |config|
73
- config.output_style = :expanded
74
- config.project_path = @base_dir
75
- config.sass_dir = File.join(@base_dir, "src", "stylesheets")
76
- config.css_dir = File.join(@base_dir, "site", "stylesheets")
77
- config.images_dir = File.join(@base_dir, "site", "images")
78
- config.http_path = "/"
79
- config.http_images_path = "/images"
80
- end
95
+ Compass.configuration.project_path = @base_dir
96
+ Compass.add_configuration(:staticmatic)
97
+
98
+ compass_config_path = File.join(@base_dir, "config", "compass.rb")
81
99
 
82
- configuration.sass_options.merge!(Compass.sass_engine_options)
100
+ if File.exists?(compass_config_path)
101
+ Compass.add_configuration(compass_config_path)
102
+ end
103
+
104
+ configuration.sass_options.merge!(Compass.configuration.to_sass_engine_options)
83
105
  end
84
106
  end
85
107
  end
@@ -0,0 +1,19 @@
1
+
2
+ module Compass
3
+ module AppIntegration
4
+ module Staticmatic
5
+
6
+ extend self
7
+
8
+ def installer(*args)
9
+ Installer.new(*args)
10
+ end
11
+
12
+ def configuration
13
+ Compass::Configuration::Data.new('staticmatic').
14
+ extend(ConfigurationDefaults)
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,39 @@
1
+ module Compass
2
+ module AppIntegration
3
+ module Staticmatic
4
+ module ConfigurationDefaults
5
+ def project_type_without_default
6
+ :staticmatic
7
+ end
8
+
9
+ def sass_dir_without_default
10
+ "src/stylesheets"
11
+ end
12
+
13
+ def javascripts_dir_without_default
14
+ "site/javascripts"
15
+ end
16
+
17
+ def css_dir_without_default
18
+ "site/stylesheets"
19
+ end
20
+
21
+ def images_dir_without_default
22
+ "site/images"
23
+ end
24
+ def default_http_images_path
25
+ "site/images"
26
+ end
27
+
28
+ def default_http_javascripts_path
29
+ "site/javascripts"
30
+ end
31
+
32
+ def default_cache_dir
33
+ ".sass-cache"
34
+ end
35
+ end
36
+
37
+ end
38
+ end
39
+ end
@@ -16,7 +16,7 @@ module StaticMatic::BuildMixin
16
16
 
17
17
  # Build CSS from the source files
18
18
  def build_css
19
- Dir["#{@src_dir}/stylesheets/**/*.sass"].each do |path|
19
+ Dir["#{@src_dir}/stylesheets/**/*.{sass,scss}"].each do |path|
20
20
  file_dir, template = source_template_from_path(path.sub(/^#{@src_dir}\/stylesheets/, ''))
21
21
 
22
22
  if !template.match(/(^|\/)\_/)
data/lib/staticmatic.rb CHANGED
@@ -1,11 +1,12 @@
1
1
  require 'rubygems'
2
+ require 'compass'
2
3
  require 'haml'
3
4
  require 'sass'
4
5
  require 'sass/plugin'
5
6
  require 'rack'
6
7
  require 'rack/handler/mongrel'
7
8
  require 'fileutils'
8
- require 'compass'
9
+
9
10
 
10
11
  module StaticMatic
11
12
  VERSION = "0.11.0"
@@ -15,7 +16,7 @@ end
15
16
  require File.join(File.dirname(__FILE__), "staticmatic", "mixins", mixin)
16
17
  end
17
18
 
18
- ["base", "configuration", "error", "server", "helpers", "template_error"].each do |lib|
19
+ ["base", "configuration", "error", "server", "helpers", "template_error", "compass/app_integration", "compass/configuration_defaults"].each do |lib|
19
20
  require File.join(File.dirname(__FILE__), "staticmatic", lib)
20
21
  end
21
22
 
@@ -1,16 +1,27 @@
1
1
  require File.dirname(__FILE__) + "/spec_helper"
2
2
 
3
3
  describe "Compass integration" do
4
- before do
5
- setup_staticmatic
4
+ context "with the default staticmatic configuraiton" do
5
+ before do
6
+ setup_staticmatic
7
+ end
8
+
9
+ it "should configure compass" do
10
+ Compass.configuration.project_path.should == TEST_SITE_PATH
11
+ Compass.configuration.sass_dir.should == File.join("src", "stylesheets")
12
+ Compass.configuration.css_dir.should == File.join("site", "stylesheets")
13
+ Compass.configuration.images_dir.should == File.join("site", "images")
14
+ Compass.configuration.http_images_path.should == "site/images"
15
+ end
6
16
  end
7
17
 
8
- it "should configure compass" do
9
- Compass.configuration.project_path.should == TEST_SITE_PATH
10
- Compass.configuration.sass_dir.should == File.join(TEST_SITE_PATH, "src", "stylesheets")
11
- Compass.configuration.css_dir.should == File.join(TEST_SITE_PATH, "site", "stylesheets")
12
- Compass.configuration.images_dir.should == File.join(TEST_SITE_PATH, "site", "images")
13
- Compass.configuration.http_path.should == "/"
14
- Compass.configuration.http_images_path.should == "/images"
18
+ context "with a custom configuration" do
19
+ before do
20
+ setup_staticmatic
21
+ end
22
+
23
+ it "should allow site config to override defaults" do
24
+ Compass.configuration.http_path.should == "http://a.test.host"
25
+ end
15
26
  end
16
27
  end
@@ -0,0 +1 @@
1
+ http_path = "http://a.test.host"
@@ -1,2 +1,5 @@
1
+ @import blueprint
2
+
3
+ +blueprint
1
4
  body
2
5
  :font-family = "Verdana, Helvetica, sans-serif"
metadata CHANGED
@@ -7,8 +7,8 @@ version: !ruby/object:Gem::Version
7
7
  - 11
8
8
  - 0
9
9
  - alpha
10
- - 5
11
- version: 0.11.0.alpha.5
10
+ - 6
11
+ version: 0.11.0.alpha.6
12
12
  platform: ruby
13
13
  authors:
14
14
  - Stephen Bartholomew
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-05-24 00:00:00 +01:00
19
+ date: 2010-05-30 00:00:00 +01:00
20
20
  default_executable: staticmatic
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -89,6 +89,8 @@ files:
89
89
  - bin/staticmatic
90
90
  - lib/staticmatic.rb
91
91
  - lib/staticmatic/base.rb
92
+ - lib/staticmatic/compass/app_integration.rb
93
+ - lib/staticmatic/compass/configuration_defaults.rb
92
94
  - lib/staticmatic/configuration.rb
93
95
  - lib/staticmatic/error.rb
94
96
  - lib/staticmatic/helpers.rb
@@ -111,10 +113,10 @@ files:
111
113
  - spec/helpers_spec.rb
112
114
  - spec/render_spec.rb
113
115
  - spec/rescue_spec.rb
116
+ - spec/sandbox/test_site/config/compass.rb
114
117
  - spec/sandbox/test_site/config/site.rb
115
118
  - spec/sandbox/test_site/site/index
116
119
  - spec/sandbox/test_site/site/layout_test
117
- - spec/sandbox/test_site/site/stylesheets/application.css
118
120
  - spec/sandbox/test_site/site/sub_folder/another_sub_folder/index.html
119
121
  - spec/sandbox/test_site/site/sub_folder/another_sub_folder/index.html.html
120
122
  - spec/sandbox/test_site/site/sub_folder/index.html
@@ -185,6 +187,7 @@ test_files:
185
187
  - spec/helpers_spec.rb
186
188
  - spec/render_spec.rb
187
189
  - spec/rescue_spec.rb
190
+ - spec/sandbox/test_site/config/compass.rb
188
191
  - spec/sandbox/test_site/config/site.rb
189
192
  - spec/sandbox/test_site/src/helpers/application_helper.rb
190
193
  - spec/sandbox/tmp/config/compass.rb
@@ -1,2 +0,0 @@
1
- body {
2
- font-family: Verdana, Helvetica, sans-serif; }