tvml 0.0.0.pre → 0.0.1.pre

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: 9a30416fcf22715c05309280f4aee930c059a30a
4
- data.tar.gz: 15667ab57c5367f8cbf231fb168c1b6a7431307b
3
+ metadata.gz: 697968941bc21b59c1a4ccf04ce9ee006549cfb3
4
+ data.tar.gz: 11a94e8193d2ae1f55a9ee5d5c6c162ac378dbd9
5
5
  SHA512:
6
- metadata.gz: 7fe63526c1fe6c72e624c2d76794aef93bb62dc6ebf1d3e39392f92e1f5573193d58ae1e075805d442818dab643c0ab41ef63002ee326377f42f7e621b4c118b
7
- data.tar.gz: 8238ae8dfce8a76f23864961d265d74ca4bbde310d3eccd8d3d53f481f3f74594f50133cf0b823750a8f935b46e5d5b76209660bb0edb96f1821079b64c96a7c
6
+ metadata.gz: 8fdc9797028daf0cc4bce4fc46f99611fc289d593d4dc2b24763f89f2f18a24b347afb64422804ef0cbd3589a1c10651900dc6bc1bf46d60afe282b8c7d6df55
7
+ data.tar.gz: 9c374ce2f82335b570b0ef9bc79ed0f6f34985b7b88ade0321be57f6481eb5ea821412c2c5f17b14817c442c45174e397db734cbd134f003734be4872c797c2c
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.gem
@@ -0,0 +1,49 @@
1
+ module TVML
2
+ module Element
3
+ class Base
4
+ delegate :node_name, to: :class
5
+
6
+ def self.inherited(subclass)
7
+ subclass.cattr_accessor(:elements) { [] }
8
+ end
9
+
10
+ def self.element(*element_names)
11
+ element_names.each do |element_name|
12
+ attr_accessor element_name
13
+ elements << element_name.to_sym
14
+ end
15
+ end
16
+
17
+ def self.node_name
18
+ name.demodulize.camelize :lower
19
+ end
20
+
21
+ def self.build(&block)
22
+ new.build(&block)
23
+ end
24
+
25
+ def initialize_builder(&block)
26
+ Builder::XmlMarkup.new.__send__(node_name, &block)
27
+ end
28
+
29
+ def build(&block)
30
+ if block_given?
31
+ initialize_builder(&block)
32
+ else
33
+ initialize_builder { |b| marshal_elements b }
34
+ end
35
+ end
36
+
37
+ def to_tvml
38
+ @builder.to_s
39
+ end
40
+
41
+ def marshal_elements(node, *element_list)
42
+ element_list = self.class.elements if element_list.empty?
43
+ element_list.each do |ele|
44
+ node.__send__ ele, send(ele) if send(ele).present?
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,7 @@
1
+ module TVML
2
+ module Element
3
+ class Button < Base
4
+ element :text
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,30 @@
1
+ module TVML
2
+ module Template
3
+ class Alert < Base
4
+ element :description, :title
5
+ attr_accessor :buttons
6
+
7
+ def initialize
8
+ super
9
+ @buttons = []
10
+ end
11
+
12
+ def collapse_button_list
13
+ @buttons = buttons.map do |button|
14
+ next button if button.is_a?(TVML::Element::Button)
15
+ btn = TVML::Element::Button.new
16
+ btn.text = button
17
+ btn
18
+ end
19
+ end
20
+
21
+ def build
22
+ collapse_button_list
23
+ super do |node|
24
+ marshal_elements node
25
+ node << buttons.map(&:build).join
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,9 @@
1
+ module TVML
2
+ module Template
3
+ class Base < TVML::Element::Base
4
+ def self.node_name
5
+ "#{super}Template"
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ module TVML
2
+ module Template
3
+ class Catalog < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module TVML
2
+ module Template
3
+ class DescriptiveAlert < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module TVML
2
+ module Template
3
+ class Div < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module TVML
2
+ module Template
3
+ class Form < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module TVML
2
+ module Template
3
+ class List < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module TVML
2
+ module Template
3
+ class Loading < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module TVML
2
+ module Template
3
+ class Main < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module TVML
2
+ module Template
3
+ class Oneup < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module TVML
2
+ module Template
3
+ class Parade < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module TVML
2
+ module Template
3
+ class ProductBundle < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module TVML
2
+ module Template
3
+ class Rating < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module TVML
2
+ module Template
3
+ class Search < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module TVML
2
+ module Template
3
+ class Showcase < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module TVML
2
+ module Template
3
+ class Stack < Base
4
+ end
5
+ end
6
+ end
data/lib/TVML/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module TVML
2
- VERSION = "0.0.0.pre"
2
+ VERSION = "0.0.1.pre"
3
3
  end
data/lib/tvml.rb CHANGED
@@ -1,5 +1,31 @@
1
- require "TVML/version"
1
+ require 'TVML/version'
2
+ require 'active_support/all'
3
+ require 'builder'
2
4
 
3
5
  module TVML
4
- # Your code goes here...
6
+ extend ActiveSupport::Autoload
7
+
8
+ module Element
9
+ autoload :Base, 'TVML/element/base'
10
+ autoload :Button, 'TVML/element/button'
11
+ end
12
+
13
+ module Template
14
+ autoload :Base, 'TVML/template/base'
15
+ autoload :Alert, 'TVML/template/alert'
16
+ autoload :Catalog, 'TVML/template/catalog'
17
+ autoload :DescriptiveAlert, 'TVML/template/descriptive_alert'
18
+ autoload :Div, 'TVML/template/div'
19
+ autoload :Form, 'TVML/template/form'
20
+ autoload :List, 'TVML/template/list'
21
+ autoload :Loading, 'TVML/template/loading'
22
+ autoload :Main, 'TVML/template/main'
23
+ autoload :Oneup, 'TVML/template/oneup'
24
+ autoload :Parade, 'TVML/template/parade'
25
+ autoload :ProductBundle, 'TVML/template/product_bundle'
26
+ autoload :Rating, 'TVML/template/rating'
27
+ autoload :Seach, 'TVML/template/search'
28
+ autoload :Showcase, 'TVML/template/showcase'
29
+ autoload :Stack, 'TVML/template/stack'
30
+ end
5
31
  end
data/tvml.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["chris@shadow.io"]
11
11
 
12
12
  spec.summary = "Ruby library for working with Apple's TVML"
13
- spec.description = "Ruby library for working with Apple's TVML built with Gyoku."
13
+ spec.description = "Ruby library for working with Apple's TVML built with Builder."
14
14
  spec.homepage = 'https://github.com/chrisb/tvml'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
@@ -19,8 +19,11 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
  spec.licenses = %w(MIT)
21
21
 
22
- spec.add_dependency 'gyoku', '~> 1.0'
22
+ spec.add_dependency 'builder', '~> 3.2'
23
+ spec.add_dependency 'activesupport', '>= 4.2'
23
24
 
24
- spec.add_development_dependency "bundler", "~> 1.10"
25
- spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency 'rspec', '~> 3.3'
26
+ spec.add_development_dependency 'simplecov', '~> 0.10'
27
+ spec.add_development_dependency 'bundler', '~> 1.10'
28
+ spec.add_development_dependency 'rake', '~> 10.0'
26
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tvml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0.pre
4
+ version: 0.0.1.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Bielinski
@@ -11,19 +11,61 @@ cert_chain: []
11
11
  date: 2015-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: gyoku
14
+ name: builder
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '3.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '3.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '4.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '4.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.10'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.10'
27
69
  - !ruby/object:Gem::Dependency
28
70
  name: bundler
29
71
  requirement: !ruby/object:Gem::Requirement
@@ -52,7 +94,7 @@ dependencies:
52
94
  - - "~>"
53
95
  - !ruby/object:Gem::Version
54
96
  version: '10.0'
55
- description: Ruby library for working with Apple's TVML built with Gyoku.
97
+ description: Ruby library for working with Apple's TVML built with Builder.
56
98
  email:
57
99
  - chris@shadow.io
58
100
  executables: []
@@ -66,6 +108,24 @@ files:
66
108
  - Rakefile
67
109
  - bin/console
68
110
  - bin/setup
111
+ - lib/TVML/element/base.rb
112
+ - lib/TVML/element/button.rb
113
+ - lib/TVML/template/alert.rb
114
+ - lib/TVML/template/base.rb
115
+ - lib/TVML/template/catalog.rb
116
+ - lib/TVML/template/descriptive_alert.rb
117
+ - lib/TVML/template/div.rb
118
+ - lib/TVML/template/form.rb
119
+ - lib/TVML/template/list.rb
120
+ - lib/TVML/template/loading.rb
121
+ - lib/TVML/template/main.rb
122
+ - lib/TVML/template/oneup.rb
123
+ - lib/TVML/template/parade.rb
124
+ - lib/TVML/template/product_bundle.rb
125
+ - lib/TVML/template/rating.rb
126
+ - lib/TVML/template/search.rb
127
+ - lib/TVML/template/showcase.rb
128
+ - lib/TVML/template/stack.rb
69
129
  - lib/TVML/version.rb
70
130
  - lib/tvml.rb
71
131
  - tvml.gemspec