myth 1.0.2

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.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +22 -0
  3. data/README.md +37 -0
  4. data/lib/myth.rb +51 -0
  5. metadata +103 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8633639708313ac6b41b0fb2842d14e35d192e20
4
+ data.tar.gz: a73f9212e2b0cffef057179f3b72634ee05e7e5b
5
+ SHA512:
6
+ metadata.gz: 714a20fd0e8591c750558f3046d2558592ca42c09a526a75e4b66dd48b075189017e7cbb29084bc32bf81715c2d251af2848af80dca9b5b5f46956581648b909
7
+ data.tar.gz: dd15006478e6674bc48a285d9249245b4dc02e005a14cb0a0f01e757a86c6b0a3234936f51e4138210599bee8aefe29d42d777985dc676dba0fd2833ec8f333e
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Dan Schultzer
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,37 @@
1
+ [![Travis CI](https://api.travis-ci.org/danschultzer/ruby-myth.png)](http://travis-ci.org/danschultzer/ruby-myth)
2
+
3
+ Ruby Myth
4
+ =================
5
+
6
+ Ruby Myth is a bridge to the Myth preprocessor.
7
+
8
+ Myth.preprocess File.read("input.css")
9
+
10
+
11
+ Installation
12
+ ------------
13
+
14
+ gem install myth
15
+
16
+
17
+ Dependencies
18
+ ------------
19
+
20
+ This library depends on the `myth-source` gem.
21
+
22
+ You can use this library with unreleased versions of
23
+ Myth by setting the `MYTH_SOURCE_PATH` environment
24
+ variable:
25
+
26
+ export MYTH_SOURCE_PATH=/path/to/myth.js
27
+
28
+ ### ExecJS
29
+
30
+ The [ExecJS](https://github.com/sstephenson/execjs) library is used to automatically choose the best JavaScript engine for your platform. Check out its [README](https://github.com/sstephenson/execjs/blob/master/README.md) for a complete list of supported engines.
31
+
32
+ ## Running tests
33
+
34
+ $ BUNDLE_GEMFILE=test/gemfiles/0.3.0 bundle install
35
+ $ BUNDLE_GEMFILE=test/gemfiles/0.3.0 rake test
36
+
37
+ If you need to test against local gems, use Bundler's gem :path option in the Gemfile.
@@ -0,0 +1,51 @@
1
+ require 'execjs'
2
+ require 'myth/source'
3
+
4
+ module Myth
5
+ Error = ExecJS::Error
6
+ EngineError = ExecJS::RuntimeError
7
+ PreprocessingError = ExecJS::ProgramError
8
+
9
+ module Source
10
+ def self.path
11
+ @path ||= ENV['MYTH_SOURCE_PATH'] || bundled_path
12
+ end
13
+
14
+ def self.path=(path)
15
+ @contents = @version = @context = nil
16
+ @path = path
17
+ end
18
+
19
+ def self.contents
20
+ @contents ||= File.read(path)
21
+ end
22
+
23
+ def self.version
24
+ @version ||= contents[/Myth Preprocessor v([\d.]+)/, 1]
25
+ end
26
+
27
+ def self.context
28
+ # Window or self has to be added so myth can attach to something
29
+ @context ||= ExecJS.compile("preprocess=function(css,options){try{css=myth(css,options);}catch(e){e.css=css;throw e;}return css;};if(typeof self==\"undefined\")self={};" + contents + "if(self.myth)myth=self.myth;")
30
+ end
31
+ end
32
+
33
+ class << self
34
+ def engine
35
+ end
36
+
37
+ def engine=(engine)
38
+ end
39
+
40
+ def version
41
+ Source.version
42
+ end
43
+
44
+ # Preprocess a stylesheet (String or IO).
45
+ def preprocess(script, options = {})
46
+ script = script.read if script.respond_to?(:read)
47
+
48
+ Source.context.call("preprocess", script, options)
49
+ end
50
+ end
51
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: myth
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Dan Schultzer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: myth-source
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.3.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.3.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: execjs
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: |2
70
+ Ruby Myth is a bridge to the CSS Myth preprocessor.
71
+ email: dan@dreamconception.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - LICENSE
77
+ - README.md
78
+ - lib/myth.rb
79
+ homepage: http://github.com/danschultzer/ruby-myth
80
+ licenses:
81
+ - MIT
82
+ metadata: {}
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project:
99
+ rubygems_version: 2.2.2
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: Ruby Myth Preprocessor
103
+ test_files: []