bit_player 0.2.5 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 89302c4dac14c35f125bc588872ab07789873039
4
- data.tar.gz: 47a8877e298438ebcea005d98f8fd222be78c655
3
+ metadata.gz: 65eefe9683e95026fb2ef0a51fc5a05bb84aacc9
4
+ data.tar.gz: bc7364b7a6a06109c40772ddf0459ae1fb63f8f7
5
5
  SHA512:
6
- metadata.gz: dedcb769358ecbb53a478688dd0fba652a8a6d2cd802deed87925b627d23d6b3f30ce6af8d2b9e5dd905eee6283fe6902fd6cf012a41a4c32318fd208038fffd
7
- data.tar.gz: 946d025635d0dc4664971a22cf8eec125650c59f056b31318d8970fd1d6c5c2bfe5a23d52f79148fc5ec55ed0446ed91dcf7ff6ab8e72ea96913a7427d4aa8ad
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
- require 'rspec/core/rake_task'
12
-
13
- RSpec::Core::RakeTask.new(:spec)
11
+ Bundler::GemHelper.install_tasks
14
12
 
15
- task default: :spec
13
+ Dir[File.join(File.dirname(__FILE__), "tasks/**/*.rake")].each {|f| load f }
16
14
 
17
- task :test do
18
- puts `RAILS_ENV=test rake app:db:drop app:db:create app:db:migrate; rspec`
19
- end
15
+ require 'rspec/core'
16
+ require 'rspec/core/rake_task'
20
17
 
21
- Bundler::GemHelper.install_tasks
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
@@ -1,3 +1,3 @@
1
1
  module BitPlayer
2
- VERSION = "0.2.5"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -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: 20140402225703) do
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
+  (118.6ms) DROP DATABASE IF EXISTS "dummy_test"
2
+  (250.2ms) CREATE DATABASE "dummy_test" ENCODING = 'unicode'
3
+ SQL (1.1ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
4
+  (8.4ms) 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
+  (7.2ms) CREATE 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) 
6
+  (1.7ms) CREATE INDEX "content_module_index" ON "bit_player_content_providers" USING btree ("bit_player_content_module_id")
7
+  (4.2ms) CREATE 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) 
8
+  (1.7ms) CREATE INDEX "index_participant_statuses_on_participant_id" ON "bit_player_participant_statuses" USING btree ("participant_id")
9
+  (7.8ms) CREATE 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) 
10
+  (1.7ms) CREATE UNIQUE INDEX "bit_player_slide_position" ON "bit_player_slides" USING btree ("bit_player_slideshow_id", "position")
11
+  (1.4ms) CREATE INDEX "index_bit_player_slides_on_bit_player_slideshow_id" ON "bit_player_slides" USING btree ("bit_player_slideshow_id")
12
+  (3.9ms) CREATE TABLE "bit_player_slideshows" ("id" serial primary key, "title" character varying(255) NOT NULL, "created_at" timestamp, "updated_at" timestamp)
13
+  (5.1ms) CREATE 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) 
14
+  (1.5ms) CREATE UNIQUE INDEX "index_bit_player_tools_on_position" ON "bit_player_tools" USING btree ("position")
15
+  (1.8ms) CREATE UNIQUE INDEX "index_bit_player_tools_on_title" ON "bit_player_tools" USING btree ("title")
16
+  (1.6ms) CREATE TABLE "schema_migrations" ("version" character varying(255) NOT NULL)
17
+  (1.5ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
18
+  (0.5ms) SELECT version FROM "schema_migrations"
19
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140402225703')
20
+  (0.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20140305200438')
21
+  (0.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20140305201300')
22
+  (0.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20140305232705')
23
+  (0.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20140305232706')
24
+  (0.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20140305234327')
25
+  (0.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20140402224913')