pug-ruby 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -10
- data/Gemfile +3 -0
- data/README.md +5 -2
- data/Rakefile +3 -0
- data/lib/jade-ruby/compile.rb +14 -4
- data/lib/jade-ruby/config.rb +2 -0
- data/lib/pug-ruby.rb +2 -0
- data/lib/pug-ruby/compile.rb +16 -4
- data/lib/pug-ruby/config.rb +2 -0
- data/pug-ruby.gemspec +3 -2
- data/test/test-jade.rb +2 -0
- data/test/test-pug.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51f257cb6fe31e9b1a23d17a012ae428530c963f
|
4
|
+
data.tar.gz: ce10856aff1c95432672b4947edb8e420ec89730
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b9105920f6fc3dd35e6db1f1b68c5195ae92ee9dd06004242e73c93187d65531f3800e1142512ae1495d1c629cfff0e3a83e61794543e55a6a6fda64ac015b8
|
7
|
+
data.tar.gz: bf5784df0a404c4dcb636894d11684dabab4fb0e8850c7ceefef6bbc7acab2f073c2ebc2b224e56c2e203d3350ad3d7e72f062497580e96700994d64e5e8e9f0
|
data/.travis.yml
CHANGED
@@ -1,20 +1,17 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
3
|
rvm:
|
4
|
+
- 2.0.0
|
5
|
+
- 2.1.10
|
6
|
+
- 2.2.5
|
4
7
|
- 2.3.1
|
8
|
+
- 2.4.0
|
5
9
|
|
6
10
|
cache: bundler
|
7
11
|
|
8
|
-
branches:
|
9
|
-
only:
|
10
|
-
- master
|
11
|
-
|
12
12
|
env:
|
13
13
|
- RAILS_ENV=test RAKE_ENV=test
|
14
14
|
|
15
|
-
|
16
|
-
- npm install jade
|
17
|
-
- npm install pug-cli
|
18
|
-
|
19
|
-
script:
|
20
|
-
- bundle exec rake test
|
15
|
+
before_install:
|
16
|
+
- npm install --global jade
|
17
|
+
- npm install --global pug-cli
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
## Ruby wrapper for the Pug/Jade template engine
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/pug-ruby.svg)](https://badge.fury.io/rb/pug-ruby)
|
4
|
+
[![Build Status](https://travis-ci.org/yivo/pug-ruby.svg?branch=master)](https://travis-ci.org/yivo/pug-ruby)
|
5
|
+
|
3
6
|
## About
|
4
7
|
This gem is wrapper for Pug/Jade command line interface. You can compile both Jade templates ([version 1.x](https://github.com/pugjs/pug/tree/v1.x.x)) and Pug ([version 2.x](https://github.com/pugjs/pug)).
|
5
8
|
<br>
|
@@ -22,13 +25,13 @@ gem 'pug-ruby', '~> 1.0'
|
|
22
25
|
## Installing Jade
|
23
26
|
Install Jade globally via npm:
|
24
27
|
```bash
|
25
|
-
npm install
|
28
|
+
npm install --global jade
|
26
29
|
```
|
27
30
|
|
28
31
|
## Installing Pug
|
29
32
|
Install Pug globally via npm:
|
30
33
|
```bash
|
31
|
-
npm install
|
34
|
+
npm install --global pug-cli
|
32
35
|
```
|
33
36
|
|
34
37
|
## Configuring Pug and Jade
|
data/Rakefile
CHANGED
data/lib/jade-ruby/compile.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require 'open3'
|
3
5
|
require 'json'
|
4
6
|
require 'shellwords'
|
@@ -36,7 +38,7 @@ module Jade
|
|
36
38
|
cmd.push('--doctype', escape(options[:doctype])) if options[:doctype]
|
37
39
|
|
38
40
|
stdout, stderr, exit_status = Open3.capture3(*cmd, stdin_data: source)
|
39
|
-
raise CompileError
|
41
|
+
raise CompileError, stderr unless exit_status.success?
|
40
42
|
|
41
43
|
if options[:client]
|
42
44
|
%{ (function(jade) { #{stdout}; return #{options[:name]}; }).call(this, jade); }
|
@@ -45,10 +47,18 @@ module Jade
|
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
50
|
+
def version
|
51
|
+
@version ||= begin
|
52
|
+
version = `jade --version`
|
53
|
+
version if $?.success?
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
48
57
|
def check_executable!
|
49
58
|
unless @executable_checked
|
50
|
-
|
51
|
-
|
59
|
+
if version
|
60
|
+
puts "jade version: #{version}"
|
61
|
+
else
|
52
62
|
raise ExecutableError, 'No jade executable found in your system. Did you forget to "npm install -g jade"?'
|
53
63
|
end
|
54
64
|
@executable_checked = true
|
@@ -57,7 +67,7 @@ module Jade
|
|
57
67
|
|
58
68
|
protected
|
59
69
|
def escape(string)
|
60
|
-
|
70
|
+
string.shellescape
|
61
71
|
end
|
62
72
|
end
|
63
73
|
|
data/lib/jade-ruby/config.rb
CHANGED
data/lib/pug-ruby.rb
CHANGED
data/lib/pug-ruby/compile.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require 'open3'
|
3
5
|
require 'json'
|
4
6
|
require 'shellwords'
|
@@ -38,7 +40,7 @@ module Pug
|
|
38
40
|
|
39
41
|
stdout, stderr, exit_status = Open3.capture3(*cmd, stdin_data: source)
|
40
42
|
|
41
|
-
raise CompileError
|
43
|
+
raise CompileError, stderr unless exit_status.success?
|
42
44
|
|
43
45
|
if options[:client]
|
44
46
|
if options[:inline_runtime_functions]
|
@@ -51,10 +53,20 @@ module Pug
|
|
51
53
|
end
|
52
54
|
end
|
53
55
|
|
56
|
+
def version
|
57
|
+
@version ||= begin
|
58
|
+
output = `pug --version`
|
59
|
+
if $?.success?
|
60
|
+
output.split(/\n\r?/)[0].to_s['pug version: '.size..-1]
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
54
65
|
def check_executable!
|
55
66
|
unless @executable_checked
|
56
|
-
|
57
|
-
|
67
|
+
if version
|
68
|
+
puts "pug version: #{version}"
|
69
|
+
else
|
58
70
|
raise ExecutableError, 'No pug executable found in your system. Did you forget to "npm install -g pug-cli"?'
|
59
71
|
end
|
60
72
|
@executable_checked = true
|
@@ -63,7 +75,7 @@ module Pug
|
|
63
75
|
|
64
76
|
protected
|
65
77
|
def escape(string)
|
66
|
-
|
78
|
+
string.shellescape
|
67
79
|
end
|
68
80
|
end
|
69
81
|
|
data/lib/pug-ruby/config.rb
CHANGED
data/pug-ruby.gemspec
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
# frozen_string_literal: true
|
3
|
+
|
2
4
|
Gem::Specification.new do |s|
|
3
5
|
s.name = 'pug-ruby'
|
4
|
-
s.version = '1.0.
|
6
|
+
s.version = '1.0.2'
|
5
7
|
s.author = 'Yaroslav Konoplov'
|
6
8
|
s.email = 'eahome00@gmail.com'
|
7
9
|
s.summary = 'Ruby wrapper for the Pug/Jade template engine.'
|
@@ -9,7 +11,6 @@ Gem::Specification.new do |s|
|
|
9
11
|
s.homepage = 'https://github.com/yivo/pug-ruby'
|
10
12
|
s.license = 'MIT'
|
11
13
|
|
12
|
-
s.executables = `git ls-files -z -- bin/*`.split("\x0").map{ |f| File.basename(f) }
|
13
14
|
s.files = `git ls-files -z`.split("\x0")
|
14
15
|
s.test_files = `git ls-files -z -- {test,spec,features}/*`.split("\x0")
|
15
16
|
s.require_paths = ['lib']
|
data/test/test-jade.rb
CHANGED
data/test/test-pug.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pug-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yaroslav Konoplov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|