rack-takana 0.8.0 → 0.9.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.
@@ -16,6 +16,7 @@ module Takana
16
16
  @host = "localhost"
17
17
 
18
18
  if Takana.db
19
+
19
20
  if defined?(Rails)
20
21
  Rails.logger.debug "[Takana] #{@name} at #{@path} #{@kind} #{@paths}"
21
22
  end
@@ -24,14 +25,26 @@ module Takana
24
25
 
25
26
  @paths.each { |p| @project.add_load_path(path: p, source: 'takana-rack') }
26
27
 
27
- if defined?(Compass) && defined?(Rails)
28
+ if defined?(Compass) && defined?(Rails) && Rails.application.config.compass.present?
29
+
28
30
  begin
29
- compass_config = Rails.application.config.compass.serialize
30
- if compass_config.present? && @project.compass_config.nil?
31
- @project.add_compass_config(config: compass_config)
31
+ config = Rails.application.config.compass.serialize
32
+
33
+ if config.present?
34
+ attributes = {}
35
+
36
+ Compass::Configuration::ATTRIBUTES.each do |k|
37
+ attributes[k] = Rails.application.config.compass.send(k)
38
+ end
39
+
40
+ @project.compass_configs.delete
41
+ @project.add_compass_config(
42
+ config: compass_config,
43
+ attributes: attributes
44
+ )
32
45
  end
33
46
  rescue => e
34
- Rails.logger.debug "[Takana] failed to detect / save compass config #{e}"
47
+
35
48
  end
36
49
  end
37
50
  end
@@ -75,7 +88,7 @@ module Takana
75
88
 
76
89
  def update_content_length!
77
90
  new_size = 0
78
- @response.each{|part| new_size += part.bytesize}
91
+ @response.each { |part| new_size += part.bytesize }
79
92
  @headers.merge!("Content-Length" => new_size.to_s)
80
93
  end
81
94
 
@@ -1,7 +1,7 @@
1
1
  module Takana
2
2
  class Project < Sequel::Model
3
3
  one_to_many :load_paths
4
- one_to_one :compass_config
4
+ one_to_many :compass_configs
5
5
 
6
6
  end
7
7
  end
data/lib/rack-takana.rb CHANGED
@@ -21,13 +21,13 @@ end
21
21
  Takana.initialize_db
22
22
 
23
23
  if Takana.db
24
- require 'takana-rack/models/project'
25
- require 'takana-rack/models/load_path'
26
- require 'takana-rack/models/compass_config'
24
+ require 'rack-takana/models/project'
25
+ require 'rack-takana/models/load_path'
26
+ require 'rack-takana/models/compass_config'
27
27
  end
28
28
 
29
- require 'takana-rack/middleware'
29
+ require 'rack-takana/middleware'
30
30
 
31
31
  if defined?(Rails)
32
- require 'takana-rack/railtie'
32
+ require 'rack-takana/railtie'
33
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-takana
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-16 00:00:00.000000000 Z
12
+ date: 2013-01-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -107,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  segments:
109
109
  - 0
110
- hash: -306390926943832107
110
+ hash: 2009484903996514444
111
111
  required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  none: false
113
113
  requirements: