bit_player 0.2.5 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -3
- data/Rakefile +7 -8
- data/app/models/bit_player/content_provider.rb +42 -0
- data/db/migrate/20140619200219_add_config_fields_to_providers.rb +9 -0
- data/lib/bit_player/version.rb +1 -1
- data/spec/dummy/db/schema.rb +6 -1
- data/spec/dummy/log/development.log +25 -0
- data/spec/dummy/log/test.log +2071 -0
- data/spec/models/bit_player/content_provider_spec.rb +46 -0
- metadata +27 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65eefe9683e95026fb2ef0a51fc5a05bb84aacc9
|
4
|
+
data.tar.gz: bc7364b7a6a06109c40772ddf0459ae1fb63f8f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80a5f5a423ff5e5bb337c1f34119dde3e9a85f3af7c39739d400e9c5242b8e7285cc75dfb9f0459ef6ae420507c04260ff825291edb2a6cfa58674f361439d24
|
7
|
+
data.tar.gz: 30fe39730b2ee0d4f0593aa2c15cea498f3d51e606d716ca6f1205ad9c6386f3c978cce6ab7e5c07c1df8a863375c81e018139b42a06c24a1af35d4687e6b7d2
|
data/README.md
CHANGED
@@ -1,14 +1,13 @@
|
|
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
3
|
## Installation
|
6
4
|
|
7
5
|
gem install bit-player
|
8
6
|
|
9
7
|
## Run tests
|
10
8
|
|
11
|
-
rake test
|
9
|
+
bin/rake app:db:drop app:db:create app:db:migrate RAILS_ENV=test
|
10
|
+
bin/rspec
|
12
11
|
|
13
12
|
## Build the gem
|
14
13
|
|
data/Rakefile
CHANGED
@@ -8,15 +8,14 @@ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
|
8
8
|
|
9
9
|
load "rails/tasks/engine.rake"
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
RSpec::Core::RakeTask.new(:spec)
|
11
|
+
Bundler::GemHelper.install_tasks
|
14
12
|
|
15
|
-
|
13
|
+
Dir[File.join(File.dirname(__FILE__), "tasks/**/*.rake")].each {|f| load f }
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
end
|
15
|
+
require 'rspec/core'
|
16
|
+
require 'rspec/core/rake_task'
|
20
17
|
|
21
|
-
|
18
|
+
desc "Run all specs in spec directory (excluding plugin specs)"
|
19
|
+
RSpec::Core::RakeTask.new(:spec => "app:db:test:prepare")
|
22
20
|
|
21
|
+
task :default => :spec
|
@@ -11,11 +11,53 @@ module BitPlayer
|
|
11
11
|
|
12
12
|
validates :content_module, :position, presence: true
|
13
13
|
validates :position, numericality: { greater_than_or_equal_to: 1 }
|
14
|
+
validates :show_next_nav, inclusion: { in: [true, false] }
|
15
|
+
validate :template_path_exists
|
16
|
+
validate :data_class_exists
|
17
|
+
validate :data_attributes_exist
|
18
|
+
|
19
|
+
serialize :data_attributes
|
20
|
+
serialize :locals
|
14
21
|
|
15
22
|
delegate :context, to: :content_module, prefix: false
|
16
23
|
|
17
24
|
def exists?(position)
|
18
25
|
false
|
19
26
|
end
|
27
|
+
|
28
|
+
def data_class
|
29
|
+
data_class_name.constantize
|
30
|
+
rescue NameError
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
|
34
|
+
# compatibility method
|
35
|
+
def show_nav_link?
|
36
|
+
show_next_nav
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def template_path_exists
|
42
|
+
path = File.join(Rails.root, "app", "views", template_path || "")
|
43
|
+
return if Dir.exists?(path)
|
44
|
+
errors.add(:template_path, "not found at #{ path }")
|
45
|
+
end
|
46
|
+
|
47
|
+
def data_class_exists
|
48
|
+
unless data_class
|
49
|
+
errors.add(:data_class_name,
|
50
|
+
"unable to find class '#{ data_class_name }'")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def data_attributes_exist
|
55
|
+
if data_attributes
|
56
|
+
attribute_names = data_class.try(:attribute_names) || []
|
57
|
+
unless data_attributes.all? { |a| attribute_names.include?(a.to_str) }
|
58
|
+
errors.add(:data_attributes, "must be attributes on the model class")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
20
62
|
end
|
21
63
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class AddConfigFieldsToProviders < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_column :bit_player_content_providers, :template_path, :string
|
4
|
+
add_column :bit_player_content_providers, :data_class_name, :string
|
5
|
+
add_column :bit_player_content_providers, :data_attributes, :text
|
6
|
+
add_column :bit_player_content_providers, :show_next_nav, :boolean
|
7
|
+
add_column :bit_player_content_providers, :locals, :text
|
8
|
+
end
|
9
|
+
end
|
data/lib/bit_player/version.rb
CHANGED
data/spec/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20140619200219) do
|
15
15
|
|
16
16
|
# These are extensions that must be enabled in order to support this database
|
17
17
|
enable_extension "plpgsql"
|
@@ -32,6 +32,11 @@ ActiveRecord::Schema.define(version: 20140402225703) do
|
|
32
32
|
t.integer "position", default: 1, null: false
|
33
33
|
t.datetime "created_at"
|
34
34
|
t.datetime "updated_at"
|
35
|
+
t.string "template_path"
|
36
|
+
t.string "data_class_name"
|
37
|
+
t.text "data_attributes"
|
38
|
+
t.boolean "show_next_nav"
|
39
|
+
t.text "locals"
|
35
40
|
end
|
36
41
|
|
37
42
|
add_index "bit_player_content_providers", ["bit_player_content_module_id"], name: "content_module_index", using: :btree
|
@@ -0,0 +1,25 @@
|
|
1
|
+
[1m[36m (118.6ms)[0m [1mDROP DATABASE IF EXISTS "dummy_test"[0m
|
2
|
+
[1m[35m (250.2ms)[0m CREATE DATABASE "dummy_test" ENCODING = 'unicode'
|
3
|
+
[1m[36mSQL (1.1ms)[0m [1mCREATE EXTENSION IF NOT EXISTS "plpgsql"[0m
|
4
|
+
[1m[35m (8.4ms)[0m CREATE TABLE "bit_player_content_modules" ("id" serial primary key, "title" character varying(255) NOT NULL, "position" integer DEFAULT 1 NOT NULL, "created_at" timestamp, "updated_at" timestamp, "bit_player_tool_id" integer NOT NULL)
|
5
|
+
[1m[36m (7.2ms)[0m [1mCREATE TABLE "bit_player_content_providers" ("id" serial primary key, "type" character varying(255) NOT NULL, "source_content_type" character varying(255), "source_content_id" integer, "bit_player_content_module_id" integer NOT NULL, "position" integer DEFAULT 1 NOT NULL, "created_at" timestamp, "updated_at" timestamp) [0m
|
6
|
+
[1m[35m (1.7ms)[0m CREATE INDEX "content_module_index" ON "bit_player_content_providers" USING btree ("bit_player_content_module_id")
|
7
|
+
[1m[36m (4.2ms)[0m [1mCREATE TABLE "bit_player_participant_statuses" ("id" serial primary key, "context" character varying(255), "module_position" integer, "provider_position" integer, "content_position" integer, "participant_id" integer NOT NULL, "created_at" timestamp, "updated_at" timestamp) [0m
|
8
|
+
[1m[35m (1.7ms)[0m CREATE INDEX "index_participant_statuses_on_participant_id" ON "bit_player_participant_statuses" USING btree ("participant_id")
|
9
|
+
[1m[36m (7.8ms)[0m [1mCREATE TABLE "bit_player_slides" ("id" serial primary key, "title" character varying(255), "body" text NOT NULL, "position" integer DEFAULT 1 NOT NULL, "bit_player_slideshow_id" integer NOT NULL, "type" character varying(255), "options" text, "is_title_visible" boolean DEFAULT 't' NOT NULL, "created_at" timestamp, "updated_at" timestamp) [0m
|
10
|
+
[1m[35m (1.7ms)[0m CREATE UNIQUE INDEX "bit_player_slide_position" ON "bit_player_slides" USING btree ("bit_player_slideshow_id", "position")
|
11
|
+
[1m[36m (1.4ms)[0m [1mCREATE INDEX "index_bit_player_slides_on_bit_player_slideshow_id" ON "bit_player_slides" USING btree ("bit_player_slideshow_id")[0m
|
12
|
+
[1m[35m (3.9ms)[0m CREATE TABLE "bit_player_slideshows" ("id" serial primary key, "title" character varying(255) NOT NULL, "created_at" timestamp, "updated_at" timestamp)
|
13
|
+
[1m[36m (5.1ms)[0m [1mCREATE TABLE "bit_player_tools" ("id" serial primary key, "title" character varying(255) NOT NULL, "position" integer, "is_home" boolean DEFAULT 'f' NOT NULL, "created_at" timestamp, "updated_at" timestamp) [0m
|
14
|
+
[1m[35m (1.5ms)[0m CREATE UNIQUE INDEX "index_bit_player_tools_on_position" ON "bit_player_tools" USING btree ("position")
|
15
|
+
[1m[36m (1.8ms)[0m [1mCREATE UNIQUE INDEX "index_bit_player_tools_on_title" ON "bit_player_tools" USING btree ("title")[0m
|
16
|
+
[1m[35m (1.6ms)[0m CREATE TABLE "schema_migrations" ("version" character varying(255) NOT NULL)
|
17
|
+
[1m[36m (1.5ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
18
|
+
[1m[35m (0.5ms)[0m SELECT version FROM "schema_migrations"
|
19
|
+
[1m[36m (0.7ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20140402225703')[0m
|
20
|
+
[1m[35m (0.5ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20140305200438')
|
21
|
+
[1m[36m (0.4ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20140305201300')[0m
|
22
|
+
[1m[35m (0.4ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20140305232705')
|
23
|
+
[1m[36m (0.4ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20140305232706')[0m
|
24
|
+
[1m[35m (0.4ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20140305234327')
|
25
|
+
[1m[36m (0.4ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20140402224913')[0m
|