voxml 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Dockerfile +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/Makefile +26 -0
- data/README.md +31 -0
- data/Rakefile +2 -0
- data/lib/voxml/tilt.rb +35 -0
- data/lib/voxml/version.rb +3 -0
- data/lib/voxml.rb +43 -0
- data/voxml.gemspec +26 -0
- metadata +111 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4807f084ab92e2fcae1a74b1ec62d8260a528d73
|
4
|
+
data.tar.gz: 232f5141709eb9d326774513b86843fd7c1b17a4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cdc8e9cc1d11fddb9ffb3a7aed46fc764d9e53ba12fec4000ae270ffc1b8ee70034045605ba83c0dc19df6cad7cba11ed127e74274824079e8de879ffdb51ccb
|
7
|
+
data.tar.gz: f563519c5982d7969fadcf67f7d5eab8d91d925b7890bc4af1911dad25f5ed4f07baf919b7143d4f5e5f06da9a561a82912d2c8cf393c11ce69e4fb8465fb642
|
data/.gitignore
ADDED
data/Dockerfile
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 gregory
|
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/Makefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
.ONESHELL:
|
2
|
+
SHELL=/bin/bash
|
3
|
+
.SHELLFLAGS = -e
|
4
|
+
|
5
|
+
NAME=voxml
|
6
|
+
RELEASE ?= dev
|
7
|
+
SERVICE ?=dev
|
8
|
+
|
9
|
+
build: clean
|
10
|
+
docker build -t ${NAME}:${RELEASE} .
|
11
|
+
|
12
|
+
sh:
|
13
|
+
docker-compose run --service-ports --rm ${NAME}_${SERVICE} bash
|
14
|
+
|
15
|
+
release: build
|
16
|
+
docker push ${NAME}:${RELEASE}
|
17
|
+
|
18
|
+
clean_containers:
|
19
|
+
IDLE_CONTAINERS="$(shell docker ps -a | env -i grep -v Up | tail -n+2 | cut -d ' ' -f 1)" \
|
20
|
+
&& docker rm -fv $$IDLE_CONTAINERS 2>/dev/null; true
|
21
|
+
|
22
|
+
clean_images:
|
23
|
+
UNTAGED_IMAGES="$(shell docker images | env -i grep '^<none>' | awk '{print $$3}')" \
|
24
|
+
&& docker rmi -f $$UNTAGED_IMAGES 2>/dev/null; true
|
25
|
+
|
26
|
+
clean: clean_containers clean_images
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Voxml
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'voxml'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install voxml
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it ( https://github.com/[my-github-username]/voxml/fork )
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/lib/voxml/tilt.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'tilt'
|
2
|
+
|
3
|
+
module Tilt
|
4
|
+
class VoxML < Template
|
5
|
+
self.default_mime_type = 'text/xml'
|
6
|
+
|
7
|
+
def prepare; end
|
8
|
+
|
9
|
+
def evaluate(scope, locals, &block)
|
10
|
+
return super(scope, locals, &block) if data.respond_to?(:to_str)
|
11
|
+
voxml = ::VoxML::Response.new(start: 'answer') do |response|
|
12
|
+
data.call(response)
|
13
|
+
end.to_xml
|
14
|
+
end
|
15
|
+
|
16
|
+
def precompiled_template(local_keys)
|
17
|
+
data.to_str
|
18
|
+
end
|
19
|
+
|
20
|
+
def precompiled_preamble(locals)
|
21
|
+
return super if locals.include? :twiml
|
22
|
+
"::VoxML::Response.new(start: 'answer') do |voxml|\n#{super}"
|
23
|
+
end
|
24
|
+
|
25
|
+
def precompiled_postamble(locals)
|
26
|
+
"end.to_xml"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
if defined? register_lazy
|
31
|
+
register_lazy 'Tilt::VoxML', 'tilt/voxml', 'voxml'
|
32
|
+
else
|
33
|
+
register VoxML, '.voxml'
|
34
|
+
end
|
35
|
+
end
|
data/lib/voxml.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require "voxml/version"
|
2
|
+
require 'voxml/tilt'
|
3
|
+
require 'ox'
|
4
|
+
require 'ruby_speech'
|
5
|
+
|
6
|
+
module VoxML
|
7
|
+
class <<self
|
8
|
+
attr_accessor :root
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.render(view)
|
12
|
+
path = File.join(root, "#{view}.voxml")
|
13
|
+
fail(ArgumentError, "File not exists #{path}") unless File.exists?(path)
|
14
|
+
Tilt.new(path).render
|
15
|
+
end
|
16
|
+
|
17
|
+
class Response
|
18
|
+
class VoxiMarkup < Builder::XmlMarkup
|
19
|
+
# NOTE: more info here for the supported ssml:
|
20
|
+
# https://msdn.microsoft.com/en-us/library/dd450827(v=office.13).aspx
|
21
|
+
def SSML(*attrs, &block)
|
22
|
+
self.Voice(*attrs) do |f|
|
23
|
+
xml = ::RubySpeech::SSML::Voice.new(::Nokogiri::XML::Document.new).eval_dsl_block(&block).to_xml
|
24
|
+
::Ox.parse(xml).nodes.each do |n|
|
25
|
+
if n.is_a?(::Ox::Element)
|
26
|
+
f << ::Ox.dump(n)
|
27
|
+
else
|
28
|
+
f << n
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
attr_reader :text
|
35
|
+
alias_method :to_xml , :text
|
36
|
+
|
37
|
+
def initialize(*args, &block)
|
38
|
+
xml = VoxiMarkup.new(indent: 2)
|
39
|
+
xml.instruct!
|
40
|
+
@text = xml.Response(Hash[*args], &block)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/voxml.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 'voxml/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "voxml"
|
8
|
+
spec.version = Voxml::VERSION
|
9
|
+
spec.authors = ["gregory"]
|
10
|
+
spec.email = ["greg2502@gmail.com"]
|
11
|
+
spec.summary = %q{build voxiplus xml files}
|
12
|
+
spec.description = spec.summary
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
|
23
|
+
spec.add_dependency "ox", "~> 2.3"
|
24
|
+
spec.add_dependency "tilt", "~> 2.0"
|
25
|
+
spec.add_dependency "ruby_speech", "~> 2.3"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: voxml
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- gregory
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-04-01 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.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ox
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.3'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: tilt
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: ruby_speech
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.3'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.3'
|
69
|
+
description: build voxiplus xml files
|
70
|
+
email:
|
71
|
+
- greg2502@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Dockerfile
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- Makefile
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- lib/voxml.rb
|
84
|
+
- lib/voxml/tilt.rb
|
85
|
+
- lib/voxml/version.rb
|
86
|
+
- voxml.gemspec
|
87
|
+
homepage: ''
|
88
|
+
licenses:
|
89
|
+
- MIT
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.2.2
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: build voxiplus xml files
|
111
|
+
test_files: []
|