efail 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 +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +60 -0
- data/Rakefile +1 -0
- data/bin/efail +42 -0
- data/efail.gemspec +26 -0
- data/lib/efail/renderer.rb +23 -0
- data/lib/efail/version.rb +3 -0
- data/lib/efail.rb +2 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4c99a3c7a26b42bca8c4011dd1611c3975547413
|
4
|
+
data.tar.gz: 5562edf8e68fe39f70020423ccf495856f18fca1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f640599b5c9aeb75c63daa44e2679d5bcf2c16005d90a41486b48a86aa19069bb94fec90b3aba3964d93bfbc8278598a68a2ba64b34bc2c177b0c0567f4a4114
|
7
|
+
data.tar.gz: 7c8d57a67c9fc452afc67324bc98de100d17cc449a09a8c07e59227863113f25fd3423fa076ac710e1e7cabae91ab7254ddeafa1db233410d1b24bebcd3df4bf
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Peter Mellett
|
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,60 @@
|
|
1
|
+
# Efail
|
2
|
+
|
3
|
+
(Naming things is hard)
|
4
|
+
|
5
|
+
A simple wrapper for the roadie v3.0.x gem.
|
6
|
+
|
7
|
+
Needed to do some one-off or static HTML email files and don't have the patience to inline your styles? Try this.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
$ gem install efail
|
12
|
+
|
13
|
+
or
|
14
|
+
|
15
|
+
gem 'efail'
|
16
|
+
|
17
|
+
in your Gemfile.
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
`efail [options] source destination`
|
22
|
+
|
23
|
+
Parse source with the v3 roadie gem and write to destination.
|
24
|
+
|
25
|
+
### Options
|
26
|
+
|
27
|
+
-f --force overwrite the destination file if it exists
|
28
|
+
-u --url the url to use for rewriting relative image paths to absolute urls
|
29
|
+
source the source file to parse with roadie
|
30
|
+
destination the file to output the result to.
|
31
|
+
|
32
|
+
## Contributing
|
33
|
+
|
34
|
+
1. Fork it ( http://github.com/<my-github-username>/efail/fork )
|
35
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
36
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
37
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
38
|
+
5. Create new Pull Request
|
39
|
+
|
40
|
+
## License
|
41
|
+
|
42
|
+
Copyright (c) 2013 Peter Mellett
|
43
|
+
|
44
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
45
|
+
of this software and associated documentation files (the "Software"), to deal
|
46
|
+
in the Software without restriction, including without limitation the rights
|
47
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
48
|
+
copies of the Software, and to permit persons to whom the Software is
|
49
|
+
furnished to do so, subject to the following conditions:
|
50
|
+
|
51
|
+
The above copyright notice and this permission notice shall be included in all
|
52
|
+
copies or substantial portions of the Software.
|
53
|
+
|
54
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
55
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
56
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
57
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
58
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
59
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
60
|
+
SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/efail
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'efail'
|
4
|
+
require 'optparse'
|
5
|
+
require 'uri'
|
6
|
+
|
7
|
+
options = {
|
8
|
+
url: nil,
|
9
|
+
force_overwrite: false
|
10
|
+
}
|
11
|
+
|
12
|
+
banner = "Usage: #{File.basename(__FILE__)} [options] source outfile"
|
13
|
+
OptionParser.new do |opts|
|
14
|
+
opts.banner = banner
|
15
|
+
|
16
|
+
opts.on("-f", "--force") do |f|
|
17
|
+
options[:force_overwrite] = f
|
18
|
+
end
|
19
|
+
opts.on("-u", "--url URL", "Asset base url for expanding relative links") do |url|
|
20
|
+
options[:url] = URI(url)
|
21
|
+
end
|
22
|
+
end.parse!
|
23
|
+
|
24
|
+
if ARGV.length < 2
|
25
|
+
puts banner
|
26
|
+
exit
|
27
|
+
else
|
28
|
+
options[:src] = ARGV.shift
|
29
|
+
unless (File.exists? (File.expand_path options[:src]))
|
30
|
+
puts "No such source file #{options[:src]}"
|
31
|
+
exit
|
32
|
+
end
|
33
|
+
|
34
|
+
options[:dest] = ARGV.shift
|
35
|
+
if !options[:force_overwrite] && (File.exists? (File.expand_path options[:dest]))
|
36
|
+
puts "Destination file already exists, use the -f flag to overwrite."
|
37
|
+
exit
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
efail = Efail::Renderer.new options
|
42
|
+
efail.render
|
data/efail.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'efail/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "efail"
|
8
|
+
spec.version = Efail::VERSION
|
9
|
+
spec.authors = ["Peter Mellett"]
|
10
|
+
spec.email = ["pjm@petermellett.co.uk"]
|
11
|
+
spec.summary = %q{A simple wrapper for Roadie v3+ gem to render html email with external stylesheet dependencies from the command line.}
|
12
|
+
spec.description = spec.summary + ' Because inlining styles is so 1996'
|
13
|
+
spec.homepage = "http://github.com/wadtech/efail"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.files = %w(LICENSE.txt README.md Rakefile efail.gemspec)
|
16
|
+
spec.files += Dir.glob("lib/**/*.rb")
|
17
|
+
spec.files += Dir.glob("bin/**/*")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
|
25
|
+
spec.add_runtime_dependency 'roadie', '~> 3.0.0.pre1'
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Efail
|
2
|
+
class Renderer
|
3
|
+
require 'roadie'
|
4
|
+
|
5
|
+
def initialize options
|
6
|
+
@dest = options[:dest]
|
7
|
+
@force = options[:force_overwrite]
|
8
|
+
@document = ::Roadie::Document.new File.open(options[:src]).read
|
9
|
+
@document.url_options = { host: options[:url].host, protocol: options[:url].scheme } unless options[:url].nil?
|
10
|
+
end
|
11
|
+
|
12
|
+
def render
|
13
|
+
if !@force && (File.exists? (File.expand_path @dest))
|
14
|
+
puts "#{@dest} already exists. Overwrite with the --force flag."
|
15
|
+
exit
|
16
|
+
end
|
17
|
+
|
18
|
+
file = File.new @dest, 'w'
|
19
|
+
file.write @document.transform
|
20
|
+
file.close
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/efail.rb
ADDED
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: efail
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Peter Mellett
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-22 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.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
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: roadie
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.0.0.pre1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.0.0.pre1
|
55
|
+
description: A simple wrapper for Roadie v3+ gem to render html email with external
|
56
|
+
stylesheet dependencies from the command line. Because inlining styles is so 1996
|
57
|
+
email:
|
58
|
+
- pjm@petermellett.co.uk
|
59
|
+
executables:
|
60
|
+
- efail
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- efail.gemspec
|
68
|
+
- lib/efail.rb
|
69
|
+
- lib/efail/version.rb
|
70
|
+
- lib/efail/renderer.rb
|
71
|
+
- bin/efail
|
72
|
+
homepage: http://github.com/wadtech/efail
|
73
|
+
licenses:
|
74
|
+
- MIT
|
75
|
+
metadata: {}
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubyforge_project:
|
92
|
+
rubygems_version: 2.0.3
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: A simple wrapper for Roadie v3+ gem to render html email with external stylesheet
|
96
|
+
dependencies from the command line.
|
97
|
+
test_files: []
|