serialy-sassy 0.0.1

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3d5088f483c6c40961220fa1b82514f45f7a6919
4
+ data.tar.gz: fb331f1a9bad259ee412a241fc321aa8b20b3536
5
+ SHA512:
6
+ metadata.gz: d2b5de0099371aae48da36739751dd388ce721e61f82722fecb28e97291dfc80688902f48bfdb3be816b73b8a97e4a0f49e54325c28205159952445dbccc0e74
7
+ data.tar.gz: 982861a8adb79b14b3df7f762a87a638ed0e507d573fd63ebd0be08766ee3e8e165d5d9cbe7ad1b6a441231dd6c70b7e674e08e7127d3b16bb7cd63e42f4a144
data/.gitignore ADDED
@@ -0,0 +1,34 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /lib/bundler/man/
26
+
27
+ # for a library or gem, you might want to ignore these files since the code is
28
+ # intended to run in multiple environments; otherwise, check them in:
29
+ # Gemfile.lock
30
+ # .ruby-version
31
+ # .ruby-gemset
32
+
33
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in serialy-sassy.gemspec
4
+ gemspec
5
+
6
+ group :test do
7
+ gem 'rspec', '3.0.0'
8
+ end
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Scott Davis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Scott Davis
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # Serialy::Sassy
2
+
3
+ Usage:
4
+
5
+ ```scss
6
+ $json : json('foo.json');
7
+ $yaml : yaml('foo.yml');
8
+ ```
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ ```ruby
15
+ gem 'serialy-sassy'
16
+ ```
17
+
18
+ And then execute:
19
+
20
+ $ bundle
21
+
22
+ Or install it yourself as:
23
+
24
+ $ gem install serialy-sassy
25
+
26
+ ## Usage
27
+
28
+ TODO: Write usage instructions here
29
+
30
+ ## Contributing
31
+
32
+ 1. Fork it ( https://github.com/[my-github-username]/serialy-sassy/fork )
33
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
34
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
35
+ 4. Push to the branch (`git push origin my-new-feature`)
36
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,5 @@
1
+ module Serialy
2
+ module Sassy
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,39 @@
1
+ require "serialy/sassy/version"
2
+ require 'yaml'
3
+ require 'json'
4
+ require 'sassy_hash'
5
+
6
+ module Serialy
7
+ module Sassy
8
+
9
+ def self.declare(*args)
10
+ Sass::Script::Functions.declare(*args).inspect
11
+ end
12
+
13
+ def self.map(hash)
14
+ Sass::Script::Value::Map.new(hash)
15
+ end
16
+
17
+
18
+ def json(filename)
19
+ filename = filename.value
20
+ json_data = JSON.parse(File.read(filename))
21
+ self.map(SassyHash[json_data])
22
+ end
23
+
24
+ declare(:json, [:filename])
25
+
26
+ def yaml(filename)
27
+ filename = filename.value
28
+ yaml_data = YAML.load(File.read(filename))
29
+
30
+ self.map(SassyHash[yaml_data])
31
+ end
32
+
33
+ declare(:yaml, [:filename])
34
+ end
35
+ #include Sassy
36
+ Sass::Script::Functions.send(:include, Serialy::Sassy)
37
+ end
38
+
39
+
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'serialy/sassy/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "serialy-sassy"
8
+ spec.version = Serialy::Sassy::VERSION
9
+ spec.authors = ["Scott Davis"]
10
+ spec.email = ["me@sdavis.info"]
11
+ spec.summary = %q{Deserialize json or yaml file into a sass map}
12
+ spec.description = %q{Deserializ a json or yaml file into a sass map}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_dependency 'sassy_hash', '~> 0.0.6'
24
+ spec.add_dependency 'multi_json', '~> 1.10.1'
25
+ end
@@ -0,0 +1,7 @@
1
+ $json : json('spec/fixtures/test.json');
2
+ $colors : map-get($json, 'colors');
3
+ @each $color in $colors {
4
+ .#{$color} {
5
+ color: $color;
6
+ }
7
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "colors" : ["green", "red", "orange"],
3
+ "number" : 100
4
+ }
@@ -0,0 +1,5 @@
1
+ colors:
2
+ - "green"
3
+ - "red"
4
+ - "orange"
5
+ number: 100
@@ -0,0 +1,7 @@
1
+ $data : yaml('spec/fixtures/test.yml');
2
+ $colors : map-get($data, 'colors');
3
+ @each $color in $colors {
4
+ .#{$color} {
5
+ color: $color;
6
+ }
7
+ }
@@ -0,0 +1,32 @@
1
+ require File.expand_path('../../lib/serialy/sassy', __FILE__)
2
+ $fixture_path = File.expand_path('../fixtures', __FILE__)
3
+ describe 'Serily Sassy' do
4
+ describe :json do
5
+ let(:json_sass) do
6
+ File.read(File.join($fixture_path, 'json_test.scss'))
7
+ end
8
+
9
+ def compile(sass)
10
+ Sass::Engine.new(sass, {:syntax => :scss, :output_style => :compressed}).render
11
+ end
12
+
13
+ it "should load json data into a sass map" do
14
+ css = compile(json_sass)
15
+ expect(".green {\n color: green; }\n\n.red {\n color: red; }\n\n.orange {\n color: orange; }\n").to eq(css)
16
+ end
17
+ end
18
+ describe :yaml do
19
+ let(:yaml_sass) do
20
+ File.read(File.join($fixture_path, 'yaml_test.scss'))
21
+ end
22
+
23
+ def compile(sass)
24
+ Sass::Engine.new(sass, {:syntax => :scss, :output_style => :compressed}).render
25
+ end
26
+
27
+ it "should load json data into a sass map" do
28
+ css = compile(yaml_sass)
29
+ expect(".green {\n color: green; }\n\n.red {\n color: red; }\n\n.orange {\n color: orange; }\n").to eq(css)
30
+ end
31
+ end
32
+ end
File without changes
metadata ADDED
@@ -0,0 +1,121 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: serialy-sassy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Scott Davis
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sassy_hash
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.0.6
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.0.6
55
+ - !ruby/object:Gem::Dependency
56
+ name: multi_json
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.10.1
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.10.1
69
+ description: Deserializ a json or yaml file into a sass map
70
+ email:
71
+ - me@sdavis.info
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - LICENSE
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - lib/serialy/sassy.rb
83
+ - lib/serialy/sassy/version.rb
84
+ - serialy-sassy.gemspec
85
+ - spec/fixtures/json_test.scss
86
+ - spec/fixtures/test.json
87
+ - spec/fixtures/test.yml
88
+ - spec/fixtures/yaml_test.scss
89
+ - spec/serily_sassy_spec.rb
90
+ - spec/spec_helper.rb
91
+ homepage: ''
92
+ licenses:
93
+ - MIT
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.2.2
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: Deserialize json or yaml file into a sass map
115
+ test_files:
116
+ - spec/fixtures/json_test.scss
117
+ - spec/fixtures/test.json
118
+ - spec/fixtures/test.yml
119
+ - spec/fixtures/yaml_test.scss
120
+ - spec/serily_sassy_spec.rb
121
+ - spec/spec_helper.rb