SATySFi-rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 90469f739d56737e4019b20c255201cb6d41d7265af68736c788d29046c20c69
4
+ data.tar.gz: 6c85a3f480b556c01e433b8950846479f3eb2c752815693554eb38b064ee6abd
5
+ SHA512:
6
+ metadata.gz: 101fe90dc7dfe79dabfbe5250db6892d3522e52facecf15719c4127bf73e286134a43ba6f3a7519fbd619b26e75818b98c6103b06e2c8c67aca04305b17b817a
7
+ data.tar.gz: fa3603a1331291a4b4e71978076e64134bff88411fc4c51caa0b24f308208aea2b29a51ec8c3536b91ddce2631a7bfc0bb425029690468e48d44f658cf0ed3f9
@@ -0,0 +1,20 @@
1
+ Copyright 2018 Seiei Miyagi
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,34 @@
1
+ # SATySFi::Rails
2
+ SATySFi template for Rails.
3
+
4
+ ## Usage
5
+ Under the `app/views/**/*`, create a template like below as `*.pdf.saty`
6
+
7
+ ```
8
+ @require: standalone
9
+ let-block ctx +hi = line-break true true ctx (read-inline ctx {hi}) in
10
+ standalone '<+hi;>
11
+ ```
12
+
13
+ ## Installation
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'SATySFi-rails'
18
+ ```
19
+
20
+ And then execute:
21
+ ```bash
22
+ $ bundle
23
+ ```
24
+
25
+ Or install it yourself as:
26
+ ```bash
27
+ $ gem install SATySFi-rails
28
+ ```
29
+
30
+ ## Contributing
31
+ Contribution directions go here.
32
+
33
+ ## License
34
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,17 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'SATySFi::Rails'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ require 'bundler/gem_tasks'
@@ -0,0 +1,29 @@
1
+ require "open3"
2
+ require "tmpdir"
3
+ require "SATySFi/rails/railtie"
4
+
5
+ module SATySFi
6
+ module Rails
7
+ class Error < StandardError; end
8
+
9
+ class << self
10
+ def call(template)
11
+ <<~TEMPLATE
12
+ Dir.mktmpdir do |dir|
13
+ saty_path = File.join(dir, "a.saty")
14
+ File.write(saty_path, #{template.source.inspect})
15
+
16
+ output_path = File.join(dir, "a.pdf")
17
+ Open3.capture2e("satysfi", "--bytecomp", "--output", output_path, saty_path) do |output, status|
18
+ unless status.success?
19
+ raise Error, output
20
+ end
21
+ end
22
+
23
+ File.read(output_path, encoding: Encoding::BINARY)
24
+ end
25
+ TEMPLATE
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,13 @@
1
+ require "rails"
2
+
3
+ module SATySFi
4
+ module Rails
5
+ class Railtie < ::Rails::Railtie
6
+ initializer :SATySFi_rails do
7
+ ActiveSupport.on_load :action_view do
8
+ ActionView::Template.register_template_handler :saty, SATySFi::Rails
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ module SATySFi
2
+ module Rails
3
+ VERSION = '0.1.0'
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :SATySFi_rails do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: SATySFi-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Seiei Miyagi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-11-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 5.2.1
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 5.2.1.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: 5.2.1
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 5.2.1.1
33
+ description:
34
+ email:
35
+ - hanachin@gmail.com
36
+ executables: []
37
+ extensions: []
38
+ extra_rdoc_files: []
39
+ files:
40
+ - MIT-LICENSE
41
+ - README.md
42
+ - Rakefile
43
+ - lib/SATySFi/rails.rb
44
+ - lib/SATySFi/rails/railtie.rb
45
+ - lib/SATySFi/rails/version.rb
46
+ - lib/tasks/SATySFi/rails_tasks.rake
47
+ homepage: https://github.com/hanachin/SATySFi-rails
48
+ licenses:
49
+ - MIT
50
+ metadata: {}
51
+ post_install_message:
52
+ rdoc_options: []
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubyforge_project:
67
+ rubygems_version: 2.7.6
68
+ signing_key:
69
+ specification_version: 4
70
+ summary: SATySFi template for Rails
71
+ test_files: []