cuba-sass 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b080e133bdfa0804cd86163e69bd25b4a9cf7b62
4
+ data.tar.gz: 2d2507d516cefb45da7864962efb39a15f3d6e82
5
+ SHA512:
6
+ metadata.gz: 8b4e33a4f77b173b0ec714089cea487eab04396a8d0c6a35489eeee279862e055e05671156f2679abbace66c788515935707e7e35e8da02da0e51ad8defa3a57
7
+ data.tar.gz: 32c384a3adf116001638a48562245cb0b1fe7974d2d09d8f5b3a3840d623c8348896367a39f9d496c5afe4a1998c39124fbd82807daf69e6420c20445acea484
data/README.md ADDED
@@ -0,0 +1,20 @@
1
+ cuba-sass
2
+ =========
3
+
4
+ A Cuba plugin to use Sass
5
+
6
+ Configure
7
+ ---------
8
+
9
+ ```
10
+ require "cuba/sass"
11
+
12
+ Cuba.plugin Cuba::Sass
13
+
14
+ Cuba.settings[:sass] = {
15
+ style: :compact,
16
+ template_location: "assets/stylesheets"
17
+ }
18
+ ```
19
+
20
+ > Note that in order to use this plugin you need to have [Sass](https"//github.com/sass/sass) installed.
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ task :test do
2
+ require "cutest"
3
+
4
+ Cutest.run(Dir["test/*.rb"])
5
+ end
6
+
7
+ task default: :test
data/cuba-sass.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "cuba-sass"
3
+ s.version = "1.0.0"
4
+ s.summary = "A Cuba plugin to use Sass."
5
+ s.description = "Cuba is a microframework for web applications."
6
+ s.authors = ["Cecille Manalang"]
7
+ s.email = ["cecille@onegoodcode.com"]
8
+ s.homepage = "http://github.com/cecillem/cuba-sass"
9
+ s.license = "UNLICENSE"
10
+
11
+ s.files = Dir[
12
+ "README.md",
13
+ "Rakefile",
14
+ "lib/**/*.rb",
15
+ "*.gemspec",
16
+ "test/*.*"
17
+ ]
18
+
19
+ s.add_dependency "cuba", "~> 3.3"
20
+ s.add_dependency "sass", "~> 3.4"
21
+ s.add_development_dependency "cutest", "~> 1.2"
22
+ s.add_development_dependency "rack-test", "~> 1.6"
23
+ end
data/lib/cuba/sass.rb ADDED
@@ -0,0 +1,24 @@
1
+ require "sass"
2
+ require "sass/plugin/rack"
3
+
4
+ class Cuba
5
+ module Sass
6
+ def self.setup(app)
7
+ sass_options = ::Sass::Plugin.options
8
+
9
+ options = {
10
+ style: :compressed,
11
+ syntax: :sass,
12
+ template_location: "assets/stylesheets",
13
+ css_location: "public/stylesheets"
14
+ }
15
+
16
+ app.settings[:sass] ||= {}
17
+ app.settings[:sass] = options.merge(app.settings[:sass])
18
+
19
+ sass_options.merge!(app.settings[:sass])
20
+
21
+ Cuba.use ::Sass::Plugin::Rack
22
+ end
23
+ end
24
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,16 @@
1
+ $:.unshift(File.expand_path("../lib", File.dirname(__FILE__)))
2
+
3
+ require "cuba"
4
+ require "cuba/render"
5
+ require "erb"
6
+ require "cuba/test"
7
+
8
+ prepare { Cuba.reset! }
9
+
10
+ def assert_response(body, expected)
11
+ arr = []
12
+ body.each { |line| arr << line }
13
+
14
+ flunk "#{arr.inspect} != #{expected.inspect}" unless arr == expected
15
+ print "."
16
+ end
data/test/sass.rb ADDED
@@ -0,0 +1,46 @@
1
+ require_relative "helper"
2
+
3
+ require "cuba/sass"
4
+
5
+ test "doesn't override the settings if they alreay exist" do
6
+ Cuba.settings[:sass] = {
7
+ style: :compact,
8
+ template_location: "assets/stylesheets"
9
+ }
10
+
11
+ Cuba.plugin Cuba::Sass
12
+
13
+ assert_equal :compact, Cuba.settings[:sass][:style]
14
+ assert_equal "assets/stylesheets", Cuba.settings[:sass][:template_location]
15
+ end
16
+
17
+ scope do
18
+ setup do
19
+ Cuba.plugin Cuba::Render
20
+
21
+ Cuba.settings[:render][:views] = "./test/views"
22
+ Cuba.settings[:render][:template_engine] = "erb"
23
+
24
+ Cuba.settings[:sass] = {
25
+ style: :compact,
26
+ template_location: "./test/assets/stylesheets",
27
+ css_location: "./test/public/stylesheets"
28
+ }
29
+
30
+ Cuba.plugin Cuba::Sass
31
+
32
+ Cuba.define do
33
+ on root do
34
+ res.write view("home", title: "Sass", name: "World")
35
+ end
36
+ end
37
+ end
38
+
39
+ test "" do
40
+ env = { "SCRIPT_NAME" => "/", "PATH_INFO" => "/stylesheets/application.css", "rack.session" => {} }
41
+
42
+ code, headers, resp = Cuba.call(env)
43
+
44
+ assert_response body, "html { overflow-y: scroll; }"
45
+ end
46
+ end
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cuba-sass
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Cecille Manalang
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: cuba
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sass
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.4'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: cutest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rack-test
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.6'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.6'
69
+ description: Cuba is a microframework for web applications.
70
+ email:
71
+ - cecille@onegoodcode.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - README.md
77
+ - Rakefile
78
+ - cuba-sass.gemspec
79
+ - lib/cuba/sass.rb
80
+ - test/helper.rb
81
+ - test/sass.rb
82
+ homepage: http://github.com/cecillem/cuba-sass
83
+ licenses:
84
+ - UNLICENSE
85
+ metadata: {}
86
+ post_install_message:
87
+ rdoc_options: []
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ requirements: []
101
+ rubyforge_project:
102
+ rubygems_version: 2.2.2
103
+ signing_key:
104
+ specification_version: 4
105
+ summary: A Cuba plugin to use Sass.
106
+ test_files: []