bit_player 0.1.0 → 0.1.1

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: 4b2d5d8096e365de9d335d230f6865993721dc7c
4
- data.tar.gz: b18f30ab2f346fba0562b380cd0f511a7765e066
3
+ metadata.gz: 3e4455d7bf8af7a7f4a309297ecaafc8d3dbd5e9
4
+ data.tar.gz: 7393b3ba91eb1256ca5029c60b6954346f4f0b0f
5
5
  SHA512:
6
- metadata.gz: 1975759ec72e5e80dc790f98c507eea831cc58d5b6c28655ed2d8e32917e7ab77ab6b4a2acc0d50f7d3fb4875784c06fc03fc7b76c2e0e2996c916da07dd76b0
7
- data.tar.gz: d70cd1cd408107cce47cedaebc8e121f4bce76faac67cc93b35d562b5ee05848f57b1b52c829434b0db631ba34db84b09bb544bc31f01a6dd8145ad4207f8bdb
6
+ metadata.gz: c58bfb616134fb1ecfebe88c9f1924b6e45ffbe4cc49d79d9979a4ab04bf0af179187f0b6a0668e3d6ab7e1f0372cf6aee8271622983b30ae4b978f71b17f4dc
7
+ data.tar.gz: 879bdf6446f42d40233c2b7211d6d9ab1f48eb74c87ff66d15d9671947f81ae856c3d0705a1b872acaab1ed5edbdc464ba34f426eb657a131d647d98d297b758
data/README.md CHANGED
@@ -1,3 +1,7 @@
1
1
  # BitPlayer
2
2
 
3
+ [![Build Status](https://travis-ci.org/nupmmarkbegale/bit_player.png?branch=master)](https://travis-ci.org/nupmmarkbegale/bit_player)
4
+
5
+ ## Installation
6
+
3
7
  gem install bit-player
@@ -1,7 +1,7 @@
1
1
  module BitPlayer
2
2
  class ContentModule < ActiveRecord::Base
3
3
  has_many :content_providers,
4
- class_name: 'BitPlayer::ContentProvider',
4
+ class_name: "BitPlayer::ContentProvider",
5
5
  foreign_key: :bit_player_content_module_id,
6
6
  inverse_of: :content_module
7
7
 
@@ -3,7 +3,7 @@ module BitPlayer
3
3
  include BitPlayer::ContentProviders::ViewProvider
4
4
 
5
5
  belongs_to :content_module,
6
- class_name: 'BitPlayer::ContentModule',
6
+ class_name: "BitPlayer::ContentModule",
7
7
  foreign_key: :bit_player_content_module_id,
8
8
  inverse_of: :content_providers
9
9
  belongs_to :source_content, polymorphic: true
@@ -0,0 +1,52 @@
1
+ module BitPlayer
2
+ module ContentProviders::FormViewProvider
3
+ def self.included(base)
4
+ base.class_eval do
5
+ def self.data_class(klass)
6
+ @source_class = klass
7
+ end
8
+
9
+ def self.source_class
10
+ @source_class || fail("Classes inheriting from #{ self } must define a source class with `data_class <class>`")
11
+ end
12
+
13
+ def self.show_nav_link
14
+ @show_nav_link = true
15
+ end
16
+
17
+ def self.hide_nav_link
18
+ @show_nav_link = false
19
+ end
20
+
21
+ def self.show_nav_link?
22
+ @show_nav_link
23
+ end
24
+
25
+ def self.view_type(type)
26
+ unless ["new", "edit"].include?(type)
27
+ fail("view type must be one of 'new', 'edit'")
28
+ end
29
+ @view_type = type
30
+ end
31
+
32
+ def self.get_view_type
33
+ @view_type
34
+ end
35
+ end
36
+ end
37
+
38
+ def show_nav_link?
39
+ self.class.show_nav_link?
40
+ end
41
+
42
+ def template
43
+ "#{ plural_name }/#{ self.class.get_view_type }"
44
+ end
45
+
46
+ private
47
+
48
+ def plural_name
49
+ self.class.source_class.to_s.underscore.pluralize
50
+ end
51
+ end
52
+ end
@@ -6,7 +6,7 @@ module BitPlayer
6
6
 
7
7
  def render_current(options)
8
8
  options.view_context.render(
9
- template: 'slides/show',
9
+ template: "slides/show",
10
10
  locals: {
11
11
  slide: slide(options.position)
12
12
  }
@@ -14,7 +14,7 @@ module BitPlayer
14
14
  end
15
15
 
16
16
  def slide(position)
17
- slideshow.slides.where(position: position).first || BitPlayer::Slide.new(body: 'no slides')
17
+ slideshow.slides.where(position: position).first || BitPlayer::Slide.new(body: "no slides")
18
18
  end
19
19
 
20
20
  def exists?(position)
@@ -7,7 +7,7 @@ module BitPlayer
7
7
  end
8
8
 
9
9
  def self.source_class
10
- @source_class || raise("Classes inheriting from #{ self } must define a source class with `data_class <class>`")
10
+ @source_class || fail("Classes inheriting from #{ self } must define a source class with `data_class <class>`")
11
11
  end
12
12
 
13
13
  def self.show_nav_link
@@ -23,8 +23,8 @@ module BitPlayer
23
23
  end
24
24
 
25
25
  def self.view_type(type)
26
- unless ['show', 'index'].include?(type)
27
- raise("view type must be one of 'show', 'index'")
26
+ unless ["show", "index"].include?(type)
27
+ fail("view type must be one of 'show', 'index'")
28
28
  end
29
29
  @view_type = type
30
30
  end
@@ -7,7 +7,7 @@ module BitPlayer
7
7
  self.module_position = 1
8
8
  self.provider_position = 1
9
9
  self.content_position = 1
10
-
10
+
11
11
  save
12
12
  end
13
13
 
@@ -1,7 +1,9 @@
1
+ require "redcarpet"
2
+
1
3
  module BitPlayer
2
4
  class Slide < ActiveRecord::Base
3
5
  belongs_to :slideshow,
4
- class_name: 'BitPlayer::Slideshow',
6
+ class_name: "BitPlayer::Slideshow",
5
7
  foreign_key: :bit_player_slideshow_id,
6
8
  inverse_of: :slides
7
9
 
@@ -1,8 +1,8 @@
1
1
  module BitPlayer
2
2
  class Slideshow < ActiveRecord::Base
3
3
  has_many :slides,
4
- -> { order 'position' },
5
- class_name: 'BitPlayer::Slide',
4
+ -> { order "position" },
5
+ class_name: "BitPlayer::Slide",
6
6
  foreign_key: :bit_player_slideshow_id,
7
7
  dependent: :destroy,
8
8
  inverse_of: :slideshow
@@ -10,7 +10,7 @@ class CreateBitPlayerContentProviders < ActiveRecord::Migration
10
10
  t.timestamps
11
11
  end
12
12
 
13
- add_index :bit_player_content_providers, :bit_player_content_module_id, name: 'content_module_index'
13
+ add_index :bit_player_content_providers, :bit_player_content_module_id, name: "content_module_index"
14
14
 
15
15
  reversible do |dir|
16
16
  dir.up do
@@ -1,3 +1,3 @@
1
1
  module BitPlayer
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -34,3 +34,53 @@
34
34
   (0.3ms) BEGIN
35
35
  BitPlayer::ContentModule Load (2.3ms) SELECT "bit_player_content_modules".* FROM "bit_player_content_modules" WHERE "bit_player_content_modules"."context" = 'a' AND "bit_player_content_modules"."position" = 1 ORDER BY "bit_player_content_modules"."id" ASC LIMIT 1
36
36
   (0.3ms) ROLLBACK
37
+  (0.2ms) BEGIN
38
+  (0.2ms) ROLLBACK
39
+  (0.1ms) BEGIN
40
+ BitPlayer::ContentModule Load (6.9ms) SELECT "bit_player_content_modules".* FROM "bit_player_content_modules" WHERE "bit_player_content_modules"."context" = 'a' AND "bit_player_content_modules"."position" = 1 ORDER BY "bit_player_content_modules"."id" ASC LIMIT 1
41
+  (0.2ms) ROLLBACK
42
+  (0.2ms) BEGIN
43
+  (0.2ms) ROLLBACK
44
+  (0.2ms) BEGIN
45
+ BitPlayer::ContentModule Load (1.8ms) SELECT "bit_player_content_modules".* FROM "bit_player_content_modules" WHERE "bit_player_content_modules"."context" = 'a' AND "bit_player_content_modules"."position" = 1 ORDER BY "bit_player_content_modules"."id" ASC LIMIT 1
46
+  (0.3ms) ROLLBACK
47
+  (0.2ms) BEGIN
48
+  (0.2ms) ROLLBACK
49
+  (0.2ms) BEGIN
50
+ BitPlayer::ContentModule Load (1.9ms) SELECT "bit_player_content_modules".* FROM "bit_player_content_modules" WHERE "bit_player_content_modules"."context" = 'a' AND "bit_player_content_modules"."position" = 1 ORDER BY "bit_player_content_modules"."id" ASC LIMIT 1
51
+  (0.3ms) ROLLBACK
52
+  (0.2ms) BEGIN
53
+  (0.4ms) ROLLBACK
54
+  (0.2ms) BEGIN
55
+ BitPlayer::ContentModule Load (1.7ms) SELECT "bit_player_content_modules".* FROM "bit_player_content_modules" WHERE "bit_player_content_modules"."context" = 'a' AND "bit_player_content_modules"."position" = 1 ORDER BY "bit_player_content_modules"."id" ASC LIMIT 1
56
+  (0.3ms) ROLLBACK
57
+  (0.2ms) BEGIN
58
+  (0.2ms) ROLLBACK
59
+  (0.2ms) BEGIN
60
+ BitPlayer::ContentModule Load (1.8ms) SELECT "bit_player_content_modules".* FROM "bit_player_content_modules" WHERE "bit_player_content_modules"."context" = 'a' AND "bit_player_content_modules"."position" = 1 ORDER BY "bit_player_content_modules"."id" ASC LIMIT 1
61
+  (0.3ms) ROLLBACK
62
+  (0.2ms) BEGIN
63
+  (0.2ms) ROLLBACK
64
+  (0.1ms) BEGIN
65
+  (0.4ms) ROLLBACK
66
+  (0.2ms) BEGIN
67
+  (0.5ms) ROLLBACK
68
+  (0.2ms) BEGIN
69
+ BitPlayer::ContentModule Load (2.0ms) SELECT "bit_player_content_modules".* FROM "bit_player_content_modules" WHERE "bit_player_content_modules"."context" = 'a' AND "bit_player_content_modules"."position" = 1 ORDER BY "bit_player_content_modules"."id" ASC LIMIT 1
70
+  (0.3ms) ROLLBACK
71
+  (0.2ms) BEGIN
72
+  (0.3ms) ROLLBACK
73
+  (0.1ms) BEGIN
74
+ BitPlayer::ContentModule Load (1.9ms) SELECT "bit_player_content_modules".* FROM "bit_player_content_modules" WHERE "bit_player_content_modules"."context" = 'a' AND "bit_player_content_modules"."position" = 1 ORDER BY "bit_player_content_modules"."id" ASC LIMIT 1
75
+  (0.3ms) ROLLBACK
76
+  (0.2ms) BEGIN
77
+  (0.3ms) ROLLBACK
78
+  (0.2ms) BEGIN
79
+  (0.3ms) ROLLBACK
80
+  (0.2ms) BEGIN
81
+  (0.2ms) ROLLBACK
82
+  (0.2ms) BEGIN
83
+ BitPlayer::ContentModule Load (1.7ms) SELECT "bit_player_content_modules".* FROM "bit_player_content_modules" WHERE "bit_player_content_modules"."context" = 'a' AND "bit_player_content_modules"."position" = 1 ORDER BY "bit_player_content_modules"."id" ASC LIMIT 1
84
+  (0.3ms) ROLLBACK
85
+  (0.2ms) BEGIN
86
+  (0.3ms) ROLLBACK
@@ -1,10 +1,10 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe BitPlayer::ContentProviders::ViewProvider do
4
4
  class S; include BitPlayer::ContentProviders::ViewProvider; end
5
5
 
6
- describe '.source_class' do
7
- it 'should raise an exception when no source class has been defined' do
6
+ describe ".source_class" do
7
+ it "should raise an exception when no source class has been defined" do
8
8
  expect { S.source_class }.to raise_error(RuntimeError)
9
9
  end
10
10
  end
@@ -1,11 +1,19 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe BitPlayer::Navigator do
4
- let(:status) { double('status', context: 'a', module_position: 1, provider_position: 2, content_position: 3) }
5
- let(:participant) { double('participant', navigation_status: status) }
6
- let(:view_context) { double('view context', current_participant: participant) }
4
+ let(:status) do
5
+ double(
6
+ "status",
7
+ context: "a",
8
+ module_position: 1,
9
+ provider_position: 2,
10
+ content_position: 3
11
+ )
12
+ end
13
+ let(:participant) { double("participant", navigation_status: status) }
14
+ let(:view_context) { double("context", current_participant: participant) }
7
15
 
8
- it 'should render the content from the current provider' do
16
+ it "should render the content from the current provider" do
9
17
  nav = BitPlayer::Navigator.new(participant)
10
18
  expect(nav.render_current_content(view_context)).to match(/Oops/)
11
19
  end
@@ -0,0 +1,11 @@
1
+ require "spec_helper"
2
+
3
+ describe BitPlayer::Slide do
4
+ describe "#render_body" do
5
+ let(:slide) { BitPlayer::Slide.new(body: "# header") }
6
+
7
+ it "should render markdown as html" do
8
+ expect(slide.render_body).to match(/<h1>header<\/h1>/)
9
+ end
10
+ end
11
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,7 @@
1
- ENV['RAILS_ENV'] ||= 'test'
1
+ ENV["RAILS_ENV"] ||= "test"
2
2
 
3
3
  require File.expand_path("../dummy/config/environment.rb", __FILE__)
4
- require 'rspec/rails'
4
+ require "rspec/rails"
5
5
 
6
6
  Rails.backtrace_cleaner.remove_silencers!
7
7
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bit_player
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Carty-Fickes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-09 00:00:00.000000000 Z
11
+ date: 2014-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -28,16 +28,30 @@ dependencies:
28
28
  name: pg
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '0.17'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '0.17'
41
+ - !ruby/object:Gem::Dependency
42
+ name: redcarpet
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '2.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
39
53
  - !ruby/object:Gem::Version
40
- version: '0'
54
+ version: '2.3'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rspec-rails
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -65,6 +79,7 @@ files:
65
79
  - app/helpers/bit_player/application_helper.rb
66
80
  - app/models/bit_player/content_module.rb
67
81
  - app/models/bit_player/content_provider.rb
82
+ - app/models/bit_player/content_providers/form_view_provider.rb
68
83
  - app/models/bit_player/content_providers/null.rb
69
84
  - app/models/bit_player/content_providers/slideshow_provider.rb
70
85
  - app/models/bit_player/content_providers/view_provider.rb
@@ -127,6 +142,7 @@ files:
127
142
  - spec/dummy/README.rdoc
128
143
  - spec/models/bit_player/content_providers/view_provider_spec.rb
129
144
  - spec/models/bit_player/navigator_spec.rb
145
+ - spec/models/bit_player/slide_spec.rb
130
146
  - spec/spec_helper.rb
131
147
  homepage: https://github.com/nupmmarkbegale/bit_player
132
148
  licenses: []
@@ -192,4 +208,5 @@ test_files:
192
208
  - spec/dummy/README.rdoc
193
209
  - spec/models/bit_player/content_providers/view_provider_spec.rb
194
210
  - spec/models/bit_player/navigator_spec.rb
211
+ - spec/models/bit_player/slide_spec.rb
195
212
  - spec/spec_helper.rb