active-component 0.1.1 → 0.1.2

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: a25b946f3c2dcac2bc08f225ee0750fc92b8dd3b
4
- data.tar.gz: 4bd337f140175fa144da9646015be48c5bb5981a
3
+ metadata.gz: ba4d45308921a66f144f54aeceb3cda1a874d72e
4
+ data.tar.gz: b3eec18c5050fc9ed0eb4fec26f3b9d2420c6ced
5
5
  SHA512:
6
- metadata.gz: 05d28e9c891720503d97aa596afb2bd37716e4e79f7d8b0368cec63e6d42b218dd9ad8f1cda7e5c1feab50cdd0d36ea390f4cfd4d727f3ab719fa49108d780e8
7
- data.tar.gz: 0c60c0052b1ce195d4165272b899f7722d4fb42bae956905d8eb37f76a61d5da1df1d9bd6747a2588a01e7b977f758087fd31cfc3bb197fc98bc73f4fcc42120
6
+ metadata.gz: 30a90132c878f34a78536f9181fdfcd3b5302ce416bedc454a1a0b91750fcb3e1bcbe0579cf5fb2fcdb2d9fecd13aabd76f409cf1f59a72a5913a4f8290ad484
7
+ data.tar.gz: 8e75888dc8938f024e956703c33e6ee79a36c9cb8837283dc0e0d385d9296be89e45ca4a8be916ed7c38638081ad11d9079b5ed9fe67f7cd2996b5d06a6a059c
@@ -1,5 +1,5 @@
1
1
  require 'active_component/renderable'
2
- require 'active_component/context'
2
+ require 'active_component/context' if defined?(Rails)
3
3
  require 'active_component/railtie' if defined?(Rails)
4
4
  require 'active_component/base'
5
5
 
@@ -12,7 +12,7 @@ module ActiveComponent
12
12
  # the application in order to allow this class to interact with
13
13
  # the rails conventions, especially with the asset pipeline.
14
14
  #
15
- include ActionView::Helpers::DateHelper
15
+ include ActionView::Helpers::DateHelper if defined?(ActionView)
16
16
  include ActiveComponent::Renderable
17
17
  #
18
18
  # Whenever the user creates a new object from a class inherited
@@ -36,7 +36,7 @@ module ActiveComponent
36
36
  #
37
37
  def initialize(args = {})
38
38
  assign_variables args
39
- @controller = ActiveComponent.get_controller
39
+ @controller = ActiveComponent.get_controller if defined?(Rails)
40
40
  end
41
41
 
42
42
  def assign_variables(args)
@@ -1,5 +1,3 @@
1
- require 'active_support/concern'
2
-
3
1
  #
4
2
  # This provides a clean implementation for rendering your template
5
3
  # inside your view.
@@ -64,4 +62,4 @@ module ActiveComponent
64
62
  end
65
63
  end
66
64
 
67
- ActionView::Base.send(:include, ActiveComponent::Renderable)
65
+ ActionView::Base.send(:include, ActiveComponent::Renderable) if defined?(ActionView)
@@ -1,3 +1,3 @@
1
1
  module ActiveComponent
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -0,0 +1,17 @@
1
+ require 'test/unit'
2
+ require 'rack/test'
3
+
4
+ class SinatraTest < Test::Unit::TestCase
5
+ include Rack::Test::Methods
6
+
7
+ def app
8
+ FooSinatra
9
+ end
10
+
11
+ def test_includes_render_component
12
+ get '/'
13
+ assert last_response.ok?
14
+ assert_equal '<div>Hello</div>world!', last_response.body
15
+ end
16
+
17
+ end
@@ -0,0 +1,7 @@
1
+ class FooSinatra < Sinatra::Base
2
+ helpers ActiveComponent::Renderable
3
+
4
+ get '/' do
5
+ render_component(:foo, bar: 'Hello', baz: 'world!')
6
+ end
7
+ end
@@ -5,6 +5,7 @@ require "dummy/application.rb"
5
5
  require "rails/test_help"
6
6
  require 'faker'
7
7
  require 'pry'
8
+ require 'sinatra'
8
9
  require 'mocha/setup'
9
10
  require 'coveralls'
10
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active-component
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antonio Chavez
@@ -9,30 +9,30 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-09 00:00:00.000000000 Z
12
+ date: 2013-10-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rails
15
+ name: mustache
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - '>='
19
19
  - !ruby/object:Gem::Version
20
- version: 3.0.0
20
+ version: '0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - '>='
26
26
  - !ruby/object:Gem::Version
27
- version: 3.0.0
27
+ version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
- name: mustache
29
+ name: sqlite3
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - '>='
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
- type: :runtime
35
+ type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
@@ -40,7 +40,7 @@ dependencies:
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
- name: sqlite3
43
+ name: faker
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
- name: faker
57
+ name: pry
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - '>='
@@ -68,7 +68,7 @@ dependencies:
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  - !ruby/object:Gem::Dependency
71
- name: pry
71
+ name: mocha
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - '>='
@@ -82,7 +82,7 @@ dependencies:
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
- name: mocha
85
+ name: coveralls
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - '>='
@@ -96,7 +96,21 @@ dependencies:
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  - !ruby/object:Gem::Dependency
99
- name: coveralls
99
+ name: sinatra
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: rails
100
114
  requirement: !ruby/object:Gem::Requirement
101
115
  requirements:
102
116
  - - '>='
@@ -136,8 +150,10 @@ files:
136
150
  - test/active_component_test.rb
137
151
  - test/dummy/application.rb
138
152
  - test/generators/component_generator_test.rb
153
+ - test/sinatra_test.rb
139
154
  - test/support/foo_component.rb
140
155
  - test/support/foo_controller.rb
156
+ - test/support/foo_sinatra.rb
141
157
  - test/test_helper.rb
142
158
  homepage: https://github.com/TheNaoX/active_component
143
159
  licenses:
@@ -171,7 +187,9 @@ test_files:
171
187
  - test/active_component_test.rb
172
188
  - test/dummy/application.rb
173
189
  - test/generators/component_generator_test.rb
190
+ - test/sinatra_test.rb
174
191
  - test/support/foo_component.rb
175
192
  - test/support/foo_controller.rb
193
+ - test/support/foo_sinatra.rb
176
194
  - test/test_helper.rb
177
195
  has_rdoc: