juggalo 0.0.1 → 0.0.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: f8b50c5eb580f4cc53e634a4d042aefc679b750b
4
- data.tar.gz: 1fdffdfe4b03a9f106a04a5d299fe9e2e90e29c5
3
+ metadata.gz: d0479c42bf929c0531b81687e00843db8b394e5d
4
+ data.tar.gz: 81514ef0c85161c8ed511b2c27aab2916b9eac71
5
5
  SHA512:
6
- metadata.gz: 1210823bee56f4dd2f5c9ebedc0b40ea7bf5b6fd51dbc3261b3fde8b1ee9122e75cae5a1a446fde805363538fee5f4e4806d83918b654310403c3bebde95c558
7
- data.tar.gz: 7b20e6f4739af0a66eae8c1825b4e8f4fe24e6d91e1c944cbdcfddf940cacc966f03d7270d962fe38b38c40a679813fb74186a4bb827bb40daf25196ce295a1d
6
+ metadata.gz: 02db1108760334acfd201ed072979bcf150e1a9d71a9bd48c3b291c87005f7cdbe20e9db79f2a313c50fa43d52cda0f93ccfbf79a7a733f3ef0c68e235c3d5c0
7
+ data.tar.gz: 096d38e8401052f73b4ad38a1153d51d296ff8d1cb12fe9047693d39fa3781b04eaf60e43c29ce0c668fc0fd28b27267d0e63ae77f9995b74bc933f5d08b30f3
@@ -19,7 +19,7 @@ module Juggalo
19
19
  end
20
20
 
21
21
  def region(components)
22
- components.map { |c| c.render }.join unless components.nil?
22
+ components.map { |c| c.present }.join unless components.nil?
23
23
  end
24
24
 
25
25
  def valid_regions
@@ -1,12 +1,16 @@
1
1
  require 'juggalo/page'
2
2
  require 'juggalo/portlet'
3
+ require 'juggalo/portlet/factory'
3
4
 
4
5
  module Juggalo
5
6
  class Page::Loader
6
7
  class Base
7
8
  def components; raise NotImplementedError; end
9
+
10
+ def create_component_from(config)
11
+ Portlet::Factory.create(config)
12
+ end
8
13
  end
9
14
  end
10
15
  end
11
16
 
12
-
@@ -1,11 +1,9 @@
1
1
  module Juggalo
2
2
  class Page::Loader
3
3
  class HTTP < Base
4
-
5
4
  def components
6
5
  {}
7
6
  end
8
-
9
7
  end
10
8
  end
11
9
  end
@@ -1,4 +1,5 @@
1
1
  require 'yaml'
2
+ require 'juggalo/portlet'
2
3
  require 'juggalo/page'
3
4
  require 'juggalo/page/loader/base'
4
5
 
@@ -10,7 +11,7 @@ module Juggalo
10
11
  end
11
12
 
12
13
  def components
13
- page_hash["components"].map { |c| Juggalo::Portlet.new(c) }
14
+ page_hash["components"].map { |c| create_component_from c }
14
15
  end
15
16
 
16
17
  private
@@ -2,21 +2,15 @@ module Juggalo
2
2
  class Portlet
3
3
  attr_reader :id, :type, :opts, :location
4
4
 
5
- def initialize(opts, loader = nil)
6
- @opts = opts
7
-
5
+ def initialize(opts, loader)
6
+ @opts = opts
7
+ @loader = loader
8
8
  @location = opts["location"]
9
9
  end
10
10
 
11
- def render
12
- "<div>#{opts}</div>"
11
+ def present
12
+ @loader.load opts
13
13
  end
14
14
  end
15
-
16
- class Portlet::Loader
17
- attr_reader :adapter
18
-
19
- class HTTP; end
20
- end
21
15
  end
22
16
 
@@ -0,0 +1,14 @@
1
+ require 'juggalo/portlet'
2
+ require 'juggalo/portlet/loader/http'
3
+
4
+ module Juggalo
5
+ class Portlet::Factory
6
+ def self.create(c)
7
+ adapter = Portlet::Loader::HTTP.new
8
+ loader = Portlet::Loader.new(adapter)
9
+
10
+ Juggalo::Portlet.new(c, loader)
11
+ end
12
+ end
13
+ end
14
+
@@ -0,0 +1,17 @@
1
+ require 'juggalo/portlet'
2
+ require 'juggalo/portlet/loader/http'
3
+
4
+ module Juggalo
5
+ class Portlet::Loader
6
+ attr_reader :adapter
7
+
8
+ def initialize(adapter)
9
+ @adapter = adapter
10
+ end
11
+
12
+ def load(opts)
13
+ @adapter.get opts
14
+ end
15
+ end
16
+ end
17
+
@@ -0,0 +1,12 @@
1
+ require 'juggalo/portlet/loader'
2
+
3
+ module Juggalo
4
+ class Portlet::Loader
5
+ class HTTP
6
+ def get(foo)
7
+ "<div>#{foo}</div>"
8
+ end
9
+ end
10
+ end
11
+ end
12
+
@@ -1,3 +1,3 @@
1
1
  module Juggalo
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: juggalo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Kenny
@@ -73,6 +73,9 @@ files:
73
73
  - lib/juggalo/page/loader/http.rb
74
74
  - lib/juggalo/page/loader/yaml.rb
75
75
  - lib/juggalo/portlet.rb
76
+ - lib/juggalo/portlet/factory.rb
77
+ - lib/juggalo/portlet/loader.rb
78
+ - lib/juggalo/portlet/loader/http.rb
76
79
  - lib/juggalo/version.rb
77
80
  homepage: ''
78
81
  licenses: