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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: be027b8c14e9788bac1f212ef1f2b75c275f2334
4
- data.tar.gz: f67f06fb7e0f3c50fe5bd9bcc45c93a9f0ebb396
3
+ metadata.gz: 51f257cb6fe31e9b1a23d17a012ae428530c963f
4
+ data.tar.gz: ce10856aff1c95432672b4947edb8e420ec89730
5
5
  SHA512:
6
- metadata.gz: 64a162f930c8f41dca937990fc11c5d808cc6fdb48b50059218d8bde5503c9d40f0e32b0b06e9d70ace036585789c526f2684b48b177de06bf43252766741b55
7
- data.tar.gz: 1a8f9c0edb89455693a40e3d2f1de5db1c0450f6ce17a9ce5fae9484a2eb294d228042d0783c7ba108ae239fe34e7905610290e3cc8ff62b965e404f9cae8163
6
+ metadata.gz: 9b9105920f6fc3dd35e6db1f1b68c5195ae92ee9dd06004242e73c93187d65531f3800e1142512ae1495d1c629cfff0e3a83e61794543e55a6a6fda64ac015b8
7
+ data.tar.gz: bf5784df0a404c4dcb636894d11684dabab4fb0e8850c7ceefef6bbc7acab2f073c2ebc2b224e56c2e203d3350ad3d7e72f062497580e96700994d64e5e8e9f0
@@ -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
- before_script:
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
@@ -1,3 +1,6 @@
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
1
4
  source 'https://rubygems.org'
2
5
  gemspec
3
6
  gem 'test-unit'
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 -g jade
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 -g pug-cli
34
+ npm install --global pug-cli
32
35
  ```
33
36
 
34
37
  ## Configuring Pug and Jade
data/Rakefile CHANGED
@@ -1,3 +1,6 @@
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
1
4
  require 'rake/testtask'
2
5
  require 'bundler/gem_tasks'
3
6
 
@@ -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.new(stderr) unless exit_status.success?
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
- `jade --version`
51
- unless $?.success?
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
- Shellwords.escape(string)
70
+ string.shellescape
61
71
  end
62
72
  end
63
73
 
@@ -1,4 +1,6 @@
1
+ # encoding: utf-8
1
2
  # frozen_string_literal: true
3
+
2
4
  module Jade
3
5
  class Config
4
6
  # http://web.archive.org/web/20160404025722/http://jade-lang.com/api/
@@ -1,4 +1,6 @@
1
+ # encoding: utf-8
1
2
  # frozen_string_literal: true
3
+
2
4
  require 'jade-ruby/config'
3
5
  require 'jade-ruby/compile'
4
6
  require 'pug-ruby/config'
@@ -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.new(stderr) unless exit_status.success?
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
- `pug --version`
57
- unless $?.success?
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
- Shellwords.escape(string)
78
+ string.shellescape
67
79
  end
68
80
  end
69
81
 
@@ -1,4 +1,6 @@
1
+ # encoding: utf-8
1
2
  # frozen_string_literal: true
3
+
2
4
  module Pug
3
5
  class Config
4
6
  # https://pugjs.org/api/reference.html
@@ -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.1'
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']
@@ -1,4 +1,6 @@
1
+ # encoding: utf-8
1
2
  # frozen_string_literal: true
3
+
2
4
  require 'pug-ruby'
3
5
  require 'test/unit'
4
6
 
@@ -1,4 +1,6 @@
1
+ # encoding: utf-8
1
2
  # frozen_string_literal: true
3
+
2
4
  require 'pug-ruby'
3
5
  require 'test/unit'
4
6
 
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.1
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: 2016-09-18 00:00:00.000000000 Z
11
+ date: 2017-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler