inky-rb 1.3.6.2 → 1.3.6.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a70d84a75f2e9381d149d54dfb5fe9e965ad0dcb
4
- data.tar.gz: dfb5d7fa5a16a9a332f6f0dcd31652b445a7df69
3
+ metadata.gz: 71ce8013a2662a04d29f602103e3469f8b643438
4
+ data.tar.gz: 72256f8875d40b80943cb5cb77d9eb437e76c649
5
5
  SHA512:
6
- metadata.gz: 53b0a6662556687a5d52d498fe47963cf7e2f53cbdc3d60e54f48a4dfbff95c55eb615401827f21f5cfd37d5f8c8cad3a710d45d218ba05eb012d56394e1d70a
7
- data.tar.gz: c2729bf8cddad5ed77eda40b3fd9d866b6bce67e6ef4480b0b5ddf9955758ebb58a9eb451242e9f87091b67b74ad834f805aa6145e1a3c1e5a7e0d82daf61491
6
+ metadata.gz: 05a783f3a2966497ec8894945c7f389c4a76b9f16d5e70e0b50b9afc3f67877ba1976988911ed8aca605391e64c1f2ed1fb476c671b21257fb733251d07d8c9c
7
+ data.tar.gz: d17d71d531bd72f64d08d72e2ab1f97348ce41f1b240f1182998c6ec58bd5a4a979d0fb4971d70201923775a1bda15d455302cd7ae64002ca8cbd39b31c288d0
data/.travis.yml ADDED
@@ -0,0 +1,16 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.0.0
5
+ - 2.2.5
6
+ gemfile:
7
+ - gemfiles/rails_3.gemfile
8
+ - gemfiles/rails_4.gemfile
9
+ - gemfiles/rails_5.gemfile
10
+ matrix:
11
+ exclude:
12
+ - rvm: 2.0.0
13
+ gemfile: gemfiles/rails_5.gemfile
14
+ before_install:
15
+ - gem install bundler
16
+ - 'npm install -g inky-cli'
data/Gemfile.lock CHANGED
@@ -1,27 +1,47 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- inky-rb (1.3.6.2)
4
+ inky-rb (1.3.6.3)
5
5
  foundation_emails (~> 2)
6
6
  nokogiri
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
+ ast (2.3.0)
11
12
  diff-lcs (1.2.5)
12
13
  foundation_emails (2.2.0.0)
13
14
  mini_portile2 (2.1.0)
14
15
  nokogiri (1.6.8)
15
16
  mini_portile2 (~> 2.1.0)
16
17
  pkg-config (~> 1.1.7)
18
+ parser (2.3.1.4)
19
+ ast (~> 2.2)
17
20
  pkg-config (1.1.7)
21
+ powerpack (0.1.1)
22
+ rainbow (2.1.0)
18
23
  rake (11.2.2)
24
+ rspec (3.5.0)
25
+ rspec-core (~> 3.5.0)
26
+ rspec-expectations (~> 3.5.0)
27
+ rspec-mocks (~> 3.5.0)
19
28
  rspec-core (3.5.0)
20
29
  rspec-support (~> 3.5.0)
21
30
  rspec-expectations (3.5.0)
22
31
  diff-lcs (>= 1.2.0, < 2.0)
23
32
  rspec-support (~> 3.5.0)
33
+ rspec-mocks (3.5.0)
34
+ diff-lcs (>= 1.2.0, < 2.0)
35
+ rspec-support (~> 3.5.0)
24
36
  rspec-support (3.5.0)
37
+ rubocop (0.43.0)
38
+ parser (>= 2.3.1.1, < 3.0)
39
+ powerpack (~> 0.1)
40
+ rainbow (>= 1.99.1, < 3.0)
41
+ ruby-progressbar (~> 1.7)
42
+ unicode-display_width (~> 1.0, >= 1.0.1)
43
+ ruby-progressbar (1.7.5)
44
+ unicode-display_width (1.1.1)
25
45
 
26
46
  PLATFORMS
27
47
  ruby
@@ -30,8 +50,10 @@ DEPENDENCIES
30
50
  bundler (~> 1.6)
31
51
  inky-rb!
32
52
  rake
53
+ rspec
33
54
  rspec-core
34
55
  rspec-expectations
56
+ rubocop
35
57
 
36
58
  BUNDLED WITH
37
59
  1.12.5
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Inky
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/inky-rb.svg)](https://badge.fury.io/rb/inky-rb)
3
+ [![Gem Version](https://badge.fury.io/rb/inky-rb.svg)](https://badge.fury.io/rb/inky-rb) [![Build Status](https://travis-ci.org/zurb/inky-rb.svg?branch=master)](https://travis-ci.org/zurb/inky-rb)
4
4
 
5
5
  Inky is an HTML-based templating language that converts simple HTML into complex, responsive email-ready HTML. Designed for [Foundation for Emails](http://foundation.zurb.com/emails), a responsive email framework from [ZURB](http://zurb.com).
6
6
 
@@ -101,3 +101,10 @@ Here are the names of the defaults:
101
101
  ## Programmatic Use
102
102
 
103
103
  The Inky parser can be accessed directly for programmatic use.
104
+
105
+ ## Requirements
106
+
107
+ Inky-rb currently requires:
108
+
109
+ * Ruby 2.0+
110
+ * Rails 3, 4 or 5
data/Rakefile CHANGED
@@ -1,7 +1,14 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rubocop/rake_task'
3
+
4
+ RuboCop::RakeTask.new
2
5
 
3
6
  begin
4
7
  require 'rspec/core/rake_task'
5
8
  RSpec::Core::RakeTask.new(:spec)
6
9
  rescue LoadError
7
10
  end
11
+
12
+ task test_all: [:spec, :rubocop]
13
+
14
+ task default: :test_all
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rails", "~>3.0"
4
+
5
+ gemspec :path => "../"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rails", "~>4.0"
4
+
5
+ gemspec :path => "../"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rails", "~>5.0"
4
+
5
+ gemspec :path => "../"
data/inky.gemspec CHANGED
@@ -18,4 +18,6 @@ Gem::Specification.new do |s|
18
18
  s.add_dependency "nokogiri"
19
19
  s.add_development_dependency "bundler", "~> 1.6"
20
20
  s.add_development_dependency "rake"
21
+ s.add_development_dependency "rspec"
22
+ s.add_development_dependency "rubocop"
21
23
  end
@@ -1,5 +1,5 @@
1
1
  module Inky
2
2
  module Rails
3
- VERSION = "1.3.6.2".freeze
3
+ VERSION = "1.3.6.3".freeze
4
4
  end
5
5
  end
data/lib/inky.rb CHANGED
@@ -33,7 +33,9 @@ module Inky
33
33
  raws, str = Inky::Core.extract_raws(xml_string)
34
34
  xml_doc = Nokogiri::XML(str)
35
35
  transform_doc(xml_doc.root) if components_exist?(xml_doc)
36
- Inky::Core.re_inject_raws(xml_doc.to_s, raws)
36
+ string = xml_doc.to_s
37
+ string.sub!(/^<\?xml.*\?>\n/, '')
38
+ Inky::Core.re_inject_raws(string, raws)
37
39
  end
38
40
 
39
41
  def components_exist?(_xml_doc)
@@ -355,8 +355,8 @@ end
355
355
 
356
356
  RSpec.describe "raw" do
357
357
  it 'creates a wrapper that ignores anything inside' do
358
- input = "<body><raw><<LCG Program\TG LCG Coupon Code Default='246996'>></raw></body>"
359
- expected = "<?xml version=\"1.0\"?>\n<body><<LCG ProgramTG LCG Coupon Code Default='246996'>></body>\n"
358
+ input = "<body><raw><<LCG ProgramTG LCG Coupon Code Default='246996'>></raw></body>"
359
+ expected = "<body><<LCG ProgramTG LCG Coupon Code Default='246996'>></body>\n"
360
360
 
361
361
  # Can't do vanilla compare because the second will fail to parse
362
362
  inky = Inky::Core.new
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,14 @@
1
1
  require 'inky'
2
2
 
3
+ def reformat_html(html)
4
+ html
5
+ .gsub(/\s+/, ' ') # Compact all whitespace to a single space
6
+ .gsub(/> *</, ">\n<") # Use returns between tags
7
+ .gsub(%r{<(\w+)([^>]*)>\n</\1>}, '<\1\2/>') # Auto close empty tags, e.g. <hr>\n</hr> => <hr/>
8
+ .gsub(/ "/, '"').gsub(/\=" /, '="') # Remove leading/trailing spaces inside attributes
9
+ .gsub(/ </, '<').gsub(/> /, '>') # Remove leading/trailing spaces inside tags
10
+ end
11
+
3
12
  def compare(input, expected)
4
13
  inky = Inky::Core.new
5
14
  output = inky.release_the_kraken(input)
@@ -7,7 +16,5 @@ def compare(input, expected)
7
16
  # TODO: Figure out a better way to do html compare in ruby..
8
17
  # this is overly dependent on things like class ordering, making it
9
18
  # fragile
10
- output_str = Nokogiri::XML(output).to_s.gsub(/\s/, '')
11
- expected_str = Nokogiri::XML(expected).to_s.gsub(/\s/, '')
12
- expect(output_str).to eql(expected_str)
19
+ expect(reformat_html(output)).to eql(reformat_html(expected))
13
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inky-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.6.2
4
+ version: 1.3.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ZURB
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-06 00:00:00.000000000 Z
11
+ date: 2016-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foundation_emails
@@ -66,6 +66,34 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  description: 'Inky is an HTML-based templating language that converts simple HTML
70
98
  into complex, responsive email-ready HTML. Designed for Foundation for Emails, a
71
99
  responsive email framework from ZURB. '
@@ -77,10 +105,14 @@ extra_rdoc_files: []
77
105
  files:
78
106
  - ".gitignore"
79
107
  - ".rubocop.yml"
108
+ - ".travis.yml"
80
109
  - Gemfile
81
110
  - Gemfile.lock
82
111
  - README.md
83
112
  - Rakefile
113
+ - gemfiles/rails_3.gemfile
114
+ - gemfiles/rails_4.gemfile
115
+ - gemfiles/rails_5.gemfile
84
116
  - inky.gemspec
85
117
  - lib/component_factory.rb
86
118
  - lib/generators/inky/install_generator.rb