zencodable 0.0.1 → 0.1.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.
- data/lib/generators/zencodable/migration_generator.rb +1 -0
- data/lib/generators/zencodable/templates/add_zencoder_job_tracking_columns.rb +8 -0
- data/lib/zencodable/version.rb +1 -1
- data/lib/zencodable.rb +19 -17
- data/test/debug.log +422 -2913
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20111130180309_create_dummy_videos.rb +0 -5
- data/test/dummy/db/migrate/20111202212901_add_zencoder_job_tracking_columns.rb +8 -0
- data/test/dummy/db/schema.rb +1 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +118 -15
- data/test/dummy/log/test.log +74 -21
- data/test/dummy/tmp/db/migrate/20111202214515_add_zencoder_job_tracking_columns_to_kitteh_movies.rb +8 -0
- data/test/dummy/tmp/db/migrate/{20111202054112_create_encoded_kitteh_vids.rb → 20111202214515_create_encoded_kitteh_vids.rb} +0 -0
- data/test/zencodable_generators_test.rb +10 -0
- data/test/zencodable_test.rb +31 -2
- metadata +157 -149
Binary file
|
@@ -2,11 +2,6 @@ class CreateDummyVideos < ActiveRecord::Migration
|
|
2
2
|
def change
|
3
3
|
create_table "videos", :force => true do |t|
|
4
4
|
t.string "title"
|
5
|
-
t.string "origin_url"
|
6
|
-
t.string "zencoder_job_id"
|
7
|
-
t.string "zencoder_job_status"
|
8
|
-
t.datetime "zencoder_job_created"
|
9
|
-
t.datetime "zencoder_job_finished"
|
10
5
|
t.timestamps
|
11
6
|
end
|
12
7
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class AddZencoderJobTrackingColumns < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_column :videos, :origin_url, :string
|
4
|
+
add_column :videos, :zencoder_job_status, :string
|
5
|
+
add_column :videos, :zencoder_job_created, :datetime
|
6
|
+
add_column :videos, :zencoder_job_finished, :datetime
|
7
|
+
end
|
8
|
+
end
|
data/test/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended to check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:version =>
|
14
|
+
ActiveRecord::Schema.define(:version => 20111202212901) do
|
15
15
|
|
16
16
|
create_table "video_file_thumbnails", :force => true do |t|
|
17
17
|
t.string "thumbnail_file_name"
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -1,22 +1,125 @@
|
|
1
1
|
[1m[36m (0.1ms)[0m [1mselect sqlite_version(*)[0m
|
2
|
-
[1m[35m (
|
2
|
+
[1m[35m (54.3ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
3
3
|
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
4
|
-
[1m[35m (
|
4
|
+
[1m[35m (2.4ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
5
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
6
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
7
|
+
[1m[35m (0.0ms)[0m select sqlite_version(*)
|
8
|
+
[1m[36m (50.8ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
9
|
+
[1m[35m (0.1ms)[0m PRAGMA index_list("schema_migrations")
|
10
|
+
[1m[36m (2.8ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
11
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
12
|
+
[1m[36m (2.4ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('0')[0m
|
13
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
14
|
+
[1m[35m (0.0ms)[0m select sqlite_version(*)
|
15
|
+
[1m[36m (45.5ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
16
|
+
[1m[35m (0.1ms)[0m PRAGMA index_list("schema_migrations")
|
17
|
+
[1m[36m (2.2ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
18
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
19
|
+
[1m[36m (2.3ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('0')[0m
|
20
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
21
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
22
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
5
23
|
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
6
24
|
Migrating to CreateDummyVideos (20111130180309)
|
7
|
-
[1m[35m (0.
|
8
|
-
[1m[36m (0.
|
25
|
+
[1m[35m (0.0ms)[0m select sqlite_version(*)
|
26
|
+
[1m[36m (0.5ms)[0m [1mCREATE TABLE "videos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "origin_url" varchar(255), "zencoder_job_id" varchar(255), "zencoder_job_status" varchar(255), "zencoder_job_created" datetime, "zencoder_job_finished" datetime, "created_at" datetime, "updated_at" datetime) [0m
|
27
|
+
[1m[35m (0.6ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20111130180309')
|
9
28
|
Migrating to CreateVideoFiles (20111130192331)
|
10
|
-
[1m[
|
11
|
-
[1m[
|
29
|
+
[1m[36m (0.4ms)[0m [1mCREATE TABLE "video_files" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "url" varchar(255), "format" varchar(255), "zencoder_file_id" integer, "video_id" integer, "created_at" datetime, "updated_at" datetime, "duration_sec" integer, "width" integer, "height" integer, "file_size" integer, "error_message" varchar(255), "state" varchar(255)) [0m
|
30
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20111130192331')
|
12
31
|
Migrating to CreateVideoThumbnails (20111130193231)
|
13
|
-
[1m[
|
14
|
-
[1m[
|
32
|
+
[1m[36m (0.5ms)[0m [1mCREATE TABLE "video_thumbnails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "thumbnail_file_name" varchar(255), "thumbnail_content_type" varchar(255), "thumbnail_file_size" integer, "thumbnail_updated_at" datetime, "video_id" integer, "created_at" datetime, "updated_at" datetime) [0m
|
33
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20111130193231')
|
15
34
|
Migrating to RenameVideoThumbnails (20111201135457)
|
16
|
-
[1m[
|
17
|
-
[1m[
|
18
|
-
[1m[
|
19
|
-
[1m[
|
20
|
-
[1m[
|
21
|
-
[1m[
|
22
|
-
[1m[
|
35
|
+
[1m[36m (0.6ms)[0m [1mALTER TABLE "video_thumbnails" RENAME TO "video_file_thumbnails"[0m
|
36
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20111201135457')
|
37
|
+
[1m[36m (0.4ms)[0m [1mselect sqlite_version(*)[0m
|
38
|
+
[1m[35m (0.1ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
39
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("video_file_thumbnails")[0m
|
40
|
+
[1m[35m (0.0ms)[0m PRAGMA index_list("video_files")
|
41
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("videos")[0m
|
42
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
43
|
+
Migrating to CreateDummyVideos (20111130180309)
|
44
|
+
Migrating to CreateVideoFiles (20111130192331)
|
45
|
+
Migrating to CreateVideoThumbnails (20111130193231)
|
46
|
+
Migrating to RenameVideoThumbnails (20111201135457)
|
47
|
+
Migrating to AddZencoderJobTrackingColumns (20111202212901)
|
48
|
+
[1m[35m (0.0ms)[0m select sqlite_version(*)
|
49
|
+
[1m[36m (0.2ms)[0m [1mALTER TABLE "videos" ADD "origin_url" varchar(255)[0m
|
50
|
+
SQLite3::SQLException: duplicate column name: origin_url: ALTER TABLE "videos" ADD "origin_url" varchar(255)
|
51
|
+
[1m[36m (0.3ms)[0m [1mselect sqlite_version(*)[0m
|
52
|
+
[1m[35m (52.7ms)[0m CREATE TABLE "video_file_thumbnails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "thumbnail_file_name" varchar(255), "thumbnail_content_type" varchar(255), "thumbnail_file_size" integer, "thumbnail_updated_at" datetime, "video_id" integer, "created_at" datetime, "updated_at" datetime)
|
53
|
+
[1m[36m (2.5ms)[0m [1mCREATE TABLE "video_files" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "url" varchar(255), "format" varchar(255), "zencoder_file_id" integer, "video_id" integer, "created_at" datetime, "updated_at" datetime, "duration_sec" integer, "width" integer, "height" integer, "file_size" integer, "error_message" varchar(255), "state" varchar(255)) [0m
|
54
|
+
[1m[35m (2.9ms)[0m CREATE TABLE "videos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "origin_url" varchar(255), "zencoder_job_id" varchar(255), "zencoder_job_status" varchar(255), "zencoder_job_created" datetime, "zencoder_job_finished" datetime, "created_at" datetime, "updated_at" datetime)
|
55
|
+
[1m[36m (2.8ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
56
|
+
[1m[35m (0.1ms)[0m PRAGMA index_list("schema_migrations")
|
57
|
+
[1m[36m (3.0ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
58
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
59
|
+
[1m[36m (3.2ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20111201135457')[0m
|
60
|
+
[1m[35m (3.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20111130180309')
|
61
|
+
[1m[36m (3.4ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20111130192331')[0m
|
62
|
+
[1m[35m (4.2ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20111130193231')
|
63
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
64
|
+
[1m[36m (0.3ms)[0m [1mselect sqlite_version(*)[0m
|
65
|
+
[1m[35m (46.5ms)[0m CREATE TABLE "video_file_thumbnails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "thumbnail_file_name" varchar(255), "thumbnail_content_type" varchar(255), "thumbnail_file_size" integer, "thumbnail_updated_at" datetime, "video_id" integer, "created_at" datetime, "updated_at" datetime)
|
66
|
+
[1m[36m (2.6ms)[0m [1mCREATE TABLE "video_files" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "url" varchar(255), "format" varchar(255), "zencoder_file_id" integer, "video_id" integer, "created_at" datetime, "updated_at" datetime, "duration_sec" integer, "width" integer, "height" integer, "file_size" integer, "error_message" varchar(255), "state" varchar(255)) [0m
|
67
|
+
[1m[35m (3.2ms)[0m CREATE TABLE "videos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "origin_url" varchar(255), "zencoder_job_id" varchar(255), "zencoder_job_status" varchar(255), "zencoder_job_created" datetime, "zencoder_job_finished" datetime, "created_at" datetime, "updated_at" datetime)
|
68
|
+
[1m[36m (2.9ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
69
|
+
[1m[35m (0.1ms)[0m PRAGMA index_list("schema_migrations")
|
70
|
+
[1m[36m (3.3ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
71
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
72
|
+
[1m[36m (2.9ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20111201135457')[0m
|
73
|
+
[1m[35m (4.4ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20111130180309')
|
74
|
+
[1m[36m (3.6ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20111130192331')[0m
|
75
|
+
[1m[35m (3.0ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20111130193231')
|
76
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
77
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
78
|
+
Migrating to CreateDummyVideos (20111130180309)
|
79
|
+
Migrating to CreateVideoFiles (20111130192331)
|
80
|
+
Migrating to CreateVideoThumbnails (20111130193231)
|
81
|
+
Migrating to RenameVideoThumbnails (20111201135457)
|
82
|
+
Migrating to AddZencoderJobTrackingColumns (20111202212901)
|
83
|
+
[1m[35m (0.0ms)[0m select sqlite_version(*)
|
84
|
+
[1m[36m (0.2ms)[0m [1mALTER TABLE "videos" ADD "origin_url" varchar(255)[0m
|
85
|
+
SQLite3::SQLException: duplicate column name: origin_url: ALTER TABLE "videos" ADD "origin_url" varchar(255)
|
86
|
+
[1m[36m (0.3ms)[0m [1mselect sqlite_version(*)[0m
|
87
|
+
[1m[35m (50.5ms)[0m CREATE TABLE "video_file_thumbnails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "thumbnail_file_name" varchar(255), "thumbnail_content_type" varchar(255), "thumbnail_file_size" integer, "thumbnail_updated_at" datetime, "video_id" integer, "created_at" datetime, "updated_at" datetime)
|
88
|
+
[1m[36m (2.4ms)[0m [1mCREATE TABLE "video_files" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "url" varchar(255), "format" varchar(255), "zencoder_file_id" integer, "video_id" integer, "created_at" datetime, "updated_at" datetime, "duration_sec" integer, "width" integer, "height" integer, "file_size" integer, "error_message" varchar(255), "state" varchar(255)) [0m
|
89
|
+
[1m[35m (2.9ms)[0m CREATE TABLE "videos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "origin_url" varchar(255), "zencoder_job_id" varchar(255), "zencoder_job_status" varchar(255), "zencoder_job_created" datetime, "zencoder_job_finished" datetime, "created_at" datetime, "updated_at" datetime)
|
90
|
+
[1m[36m (3.3ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
91
|
+
[1m[35m (0.1ms)[0m PRAGMA index_list("schema_migrations")
|
92
|
+
[1m[36m (3.2ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
93
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
94
|
+
[1m[36m (3.3ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20111201135457')[0m
|
95
|
+
[1m[35m (4.4ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20111130180309')
|
96
|
+
[1m[36m (3.0ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20111130192331')[0m
|
97
|
+
[1m[35m (3.7ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20111130193231')
|
98
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
99
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
100
|
+
Migrating to CreateDummyVideos (20111130180309)
|
101
|
+
Migrating to CreateVideoFiles (20111130192331)
|
102
|
+
Migrating to CreateVideoThumbnails (20111130193231)
|
103
|
+
Migrating to RenameVideoThumbnails (20111201135457)
|
104
|
+
Migrating to AddZencoderJobTrackingColumns (20111202212901)
|
105
|
+
[1m[35m (0.0ms)[0m select sqlite_version(*)
|
106
|
+
[1m[36m (0.4ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ('20111202212901')[0m
|
107
|
+
[1m[35m (0.3ms)[0m select sqlite_version(*)
|
108
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
109
|
+
[1m[35m (0.0ms)[0m PRAGMA index_list("video_file_thumbnails")
|
110
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("video_files")[0m
|
111
|
+
[1m[35m (0.0ms)[0m PRAGMA index_list("videos")
|
112
|
+
[1m[36m (0.3ms)[0m [1mselect sqlite_version(*)[0m
|
113
|
+
[1m[35m (47.4ms)[0m CREATE TABLE "video_file_thumbnails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "thumbnail_file_name" varchar(255), "thumbnail_content_type" varchar(255), "thumbnail_file_size" integer, "thumbnail_updated_at" datetime, "video_id" integer, "created_at" datetime, "updated_at" datetime)
|
114
|
+
[1m[36m (2.4ms)[0m [1mCREATE TABLE "video_files" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "url" varchar(255), "format" varchar(255), "zencoder_file_id" integer, "video_id" integer, "created_at" datetime, "updated_at" datetime, "duration_sec" integer, "width" integer, "height" integer, "file_size" integer, "error_message" varchar(255), "state" varchar(255)) [0m
|
115
|
+
[1m[35m (3.0ms)[0m CREATE TABLE "videos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "origin_url" varchar(255), "zencoder_job_id" varchar(255), "zencoder_job_status" varchar(255), "zencoder_job_created" datetime, "zencoder_job_finished" datetime, "created_at" datetime, "updated_at" datetime)
|
116
|
+
[1m[36m (2.8ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
117
|
+
[1m[35m (0.1ms)[0m PRAGMA index_list("schema_migrations")
|
118
|
+
[1m[36m (3.2ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
119
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
120
|
+
[1m[36m (2.9ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20111202212901')[0m
|
121
|
+
[1m[35m (3.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20111130180309')
|
122
|
+
[1m[36m (4.2ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20111130192331')[0m
|
123
|
+
[1m[35m (2.9ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20111130193231')
|
124
|
+
[1m[36m (3.6ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20111201135457')[0m
|
125
|
+
[1m[35m (0.1ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
data/test/dummy/log/test.log
CHANGED
@@ -1,42 +1,95 @@
|
|
1
1
|
[1m[36m (0.1ms)[0m [1mselect sqlite_version(*)[0m
|
2
|
-
[1m[35m (
|
2
|
+
[1m[35m (55.5ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
3
3
|
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
4
|
-
[1m[35m (
|
4
|
+
[1m[35m (2.5ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
5
|
+
[1m[36m (0.3ms)[0m [1mselect sqlite_version(*)[0m
|
6
|
+
[1m[35m (0.1ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
7
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
8
|
+
Migrating to CreateDummyVideos (20111130180309)
|
9
|
+
[1m[35m (0.0ms)[0m select sqlite_version(*)
|
10
|
+
[1m[36m (0.5ms)[0m [1mCREATE TABLE "videos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "origin_url" varchar(255), "zencoder_job_id" varchar(255), "zencoder_job_status" varchar(255), "zencoder_job_created" datetime, "zencoder_job_finished" datetime, "created_at" datetime, "updated_at" datetime) [0m
|
11
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20111130180309')
|
12
|
+
[1m[36m (0.3ms)[0m [1mselect sqlite_version(*)[0m
|
13
|
+
[1m[35m (0.1ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
14
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("videos")[0m
|
15
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
16
|
+
[1m[35m (0.2ms)[0m select sqlite_version(*)
|
17
|
+
[1m[36m (54.9ms)[0m [1mCREATE TABLE "videos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "origin_url" varchar(255), "zencoder_job_id" varchar(255), "zencoder_job_status" varchar(255), "zencoder_job_created" datetime, "zencoder_job_finished" datetime, "created_at" datetime, "updated_at" datetime) [0m
|
18
|
+
[1m[35m (2.6ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
19
|
+
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
20
|
+
[1m[35m (3.2ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
21
|
+
[1m[36m (0.2ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
22
|
+
[1m[35m (2.7ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20111130180309')
|
23
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
24
|
+
Migrating to CreateDummyVideos (20111130180309)
|
25
|
+
Migrating to CreateVideoFiles (20111130192331)
|
26
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
27
|
+
[1m[36m (0.6ms)[0m [1mCREATE TABLE "video_files" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "url" varchar(255), "format" varchar(255), "zencoder_file_id" integer, "video_id" integer, "created_at" datetime, "updated_at" datetime, "duration_sec" integer, "width" integer, "height" integer, "file_size" integer, "error_message" varchar(255), "state" varchar(255)) [0m
|
28
|
+
[1m[35m (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20111130192331')
|
29
|
+
[1m[36m (0.3ms)[0m [1mselect sqlite_version(*)[0m
|
30
|
+
[1m[35m (0.1ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
31
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("video_files")[0m
|
32
|
+
[1m[35m (0.0ms)[0m PRAGMA index_list("videos")
|
5
33
|
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
6
34
|
Migrating to CreateDummyVideos (20111130180309)
|
7
|
-
[1m[35m (0.6ms)[0m CREATE TABLE "videos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "origin_url" varchar(255), "zencoder_job_id" varchar(255), "zencoder_job_status" varchar(255), "zencoder_job_created" datetime, "zencoder_job_finished" datetime, "created_at" datetime, "updated_at" datetime)
|
8
|
-
[1m[36m (0.2ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ('20111130180309')[0m
|
9
35
|
Migrating to CreateVideoFiles (20111130192331)
|
10
|
-
[1m[35m (0.9ms)[0m CREATE TABLE "video_files" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "url" varchar(255), "format" varchar(255), "zencoder_file_id" integer, "video_id" integer, "created_at" datetime, "updated_at" datetime, "duration_sec" integer, "width" integer, "height" integer, "file_size" integer, "error_message" varchar(255), "state" varchar(255))
|
11
|
-
[1m[36m (0.3ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ('20111130192331')[0m
|
12
36
|
Migrating to CreateVideoThumbnails (20111130193231)
|
13
|
-
[1m[35m (
|
14
|
-
[1m[36m (0.
|
15
|
-
[1m[35m (0.
|
16
|
-
[1m[36m (0.
|
17
|
-
[1m[35m (0.1ms)[0m
|
18
|
-
[1m[36m (0.
|
19
|
-
[1m[35m (0.
|
20
|
-
[1m[36m (0.
|
37
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
38
|
+
[1m[36m (0.5ms)[0m [1mCREATE TABLE "video_thumbnails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "thumbnail_file_name" varchar(255), "thumbnail_content_type" varchar(255), "thumbnail_file_size" integer, "thumbnail_updated_at" datetime, "video_id" integer, "created_at" datetime, "updated_at" datetime) [0m
|
39
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20111130193231')
|
40
|
+
[1m[36m (0.4ms)[0m [1mselect sqlite_version(*)[0m
|
41
|
+
[1m[35m (0.1ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
42
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("video_files")[0m
|
43
|
+
[1m[35m (0.0ms)[0m PRAGMA index_list("video_thumbnails")
|
44
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("videos")[0m
|
45
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
21
46
|
Migrating to CreateDummyVideos (20111130180309)
|
22
47
|
Migrating to CreateVideoFiles (20111130192331)
|
23
48
|
Migrating to CreateVideoThumbnails (20111130193231)
|
24
49
|
Migrating to RenameVideoThumbnails (20111201135457)
|
25
|
-
[1m[35m (0.
|
26
|
-
[1m[36m (0.
|
27
|
-
[1m[35m (0.
|
28
|
-
[1m[36m (0.
|
29
|
-
[1m[35m (0.
|
50
|
+
[1m[35m (0.0ms)[0m select sqlite_version(*)
|
51
|
+
[1m[36m (0.6ms)[0m [1mALTER TABLE "video_thumbnails" RENAME TO "video_file_thumbnails"[0m
|
52
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20111201135457')
|
53
|
+
[1m[36m (0.3ms)[0m [1mselect sqlite_version(*)[0m
|
54
|
+
[1m[35m (0.1ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
30
55
|
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("video_file_thumbnails")[0m
|
31
56
|
[1m[35m (0.0ms)[0m PRAGMA index_list("video_files")
|
32
57
|
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("videos")[0m
|
33
|
-
[1m[36m (0.
|
58
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
34
59
|
Migrating to CreateDummyVideos (20111130180309)
|
35
60
|
Migrating to CreateVideoFiles (20111130192331)
|
36
61
|
Migrating to CreateVideoThumbnails (20111130193231)
|
37
62
|
Migrating to RenameVideoThumbnails (20111201135457)
|
63
|
+
Migrating to AddZencoderJobTrackingColumns (20111202212901)
|
64
|
+
[1m[35m (0.0ms)[0m select sqlite_version(*)
|
65
|
+
[1m[36m (0.4ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ('20111202212901')[0m
|
38
66
|
[1m[35m (0.4ms)[0m select sqlite_version(*)
|
39
|
-
[1m[36m (0.
|
67
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
68
|
+
[1m[35m (0.0ms)[0m PRAGMA index_list("video_file_thumbnails")
|
69
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("video_files")[0m
|
70
|
+
[1m[35m (0.0ms)[0m PRAGMA index_list("videos")
|
71
|
+
[1m[36m (0.3ms)[0m [1mselect sqlite_version(*)[0m
|
72
|
+
[1m[35m (54.5ms)[0m CREATE TABLE "video_file_thumbnails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "thumbnail_file_name" varchar(255), "thumbnail_content_type" varchar(255), "thumbnail_file_size" integer, "thumbnail_updated_at" datetime, "video_id" integer, "created_at" datetime, "updated_at" datetime)
|
73
|
+
[1m[36m (2.5ms)[0m [1mCREATE TABLE "video_files" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "url" varchar(255), "format" varchar(255), "zencoder_file_id" integer, "video_id" integer, "created_at" datetime, "updated_at" datetime, "duration_sec" integer, "width" integer, "height" integer, "file_size" integer, "error_message" varchar(255), "state" varchar(255)) [0m
|
74
|
+
[1m[35m (3.1ms)[0m CREATE TABLE "videos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "origin_url" varchar(255), "zencoder_job_id" varchar(255), "zencoder_job_status" varchar(255), "zencoder_job_created" datetime, "zencoder_job_finished" datetime, "created_at" datetime, "updated_at" datetime)
|
75
|
+
[1m[36m (3.0ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
76
|
+
[1m[35m (0.1ms)[0m PRAGMA index_list("schema_migrations")
|
77
|
+
[1m[36m (3.1ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
78
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
79
|
+
[1m[36m (3.0ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20111202212901')[0m
|
80
|
+
[1m[35m (4.2ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20111130180309')
|
81
|
+
[1m[36m (3.7ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20111130192331')[0m
|
82
|
+
[1m[35m (3.0ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20111130193231')
|
83
|
+
[1m[36m (3.5ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20111201135457')[0m
|
84
|
+
[1m[35m (0.1ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
85
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
86
|
+
Migrating to CreateDummyVideos (20111130180309)
|
87
|
+
Migrating to CreateVideoFiles (20111130192331)
|
88
|
+
Migrating to CreateVideoThumbnails (20111130193231)
|
89
|
+
Migrating to RenameVideoThumbnails (20111201135457)
|
90
|
+
Migrating to AddZencoderJobTrackingColumns (20111202212901)
|
91
|
+
[1m[35m (0.3ms)[0m select sqlite_version(*)
|
92
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
40
93
|
[1m[35m (0.0ms)[0m PRAGMA index_list("video_file_thumbnails")
|
41
94
|
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("video_files")[0m
|
42
95
|
[1m[35m (0.0ms)[0m PRAGMA index_list("videos")
|
data/test/dummy/tmp/db/migrate/20111202214515_add_zencoder_job_tracking_columns_to_kitteh_movies.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
class AddZencoderJobTrackingColumns < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_column :kitteh_movies, :origin_url, :string
|
4
|
+
add_column :kitteh_movies, :zencoder_job_status, :string
|
5
|
+
add_column :kitteh_movies, :zencoder_job_created, :datetime
|
6
|
+
add_column :kitteh_movies, :zencoder_job_finished, :datetime
|
7
|
+
end
|
8
|
+
end
|
File without changes
|
@@ -19,6 +19,16 @@ class ZencodableGeneratorTest < Rails::Generators::TestCase
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
test "creates a migration to add job tracking columns to the named model" do
|
23
|
+
run_generator %w(KittehMovie encoded_kitteh_vids)
|
24
|
+
assert_migration "db/migrate/add_zencoder_job_tracking_columns_to_kitteh_movies.rb" do |migration|
|
25
|
+
assert_match /add_column :kitteh_movies, :origin_url, :string/, migration
|
26
|
+
assert_match /add_column :kitteh_movies, :zencoder_job_status, :string/, migration
|
27
|
+
assert_match /add_column :kitteh_movies, :zencoder_job_created, :datetime/, migration
|
28
|
+
assert_match /add_column :kitteh_movies, :zencoder_job_finished, :datetime/, migration
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
22
32
|
test "does not create a migration for the thumbnails when --skip_thumbnails is given" do
|
23
33
|
run_generator %w(KittehMovie encoded_kitteh_vids --skip-thumbnails)
|
24
34
|
assert_migration "db/migrate/create_encoded_kitteh_vids.rb"
|
data/test/zencodable_test.rb
CHANGED
@@ -57,8 +57,37 @@ class ZencodableTest < ActiveSupport::TestCase
|
|
57
57
|
path = "videos/encoded/:basename"
|
58
58
|
origin_url = 'http://foo.com/somepath/2/4/Rainbows and puppies [HD].with unicorns.mov'
|
59
59
|
s3_config = '/some/path/to/s3.yml'
|
60
|
-
|
61
|
-
assert_equal "s3://zenbucket.s3.amazonaws.com/videos/encoded/rainbows-and-puppies-hd.with-unicorns/", Zencodable::Encoder::Job.s3_url(origin_url,
|
60
|
+
bucket = 'zenbucket'
|
61
|
+
assert_equal "s3://zenbucket.s3.amazonaws.com/videos/encoded/rainbows-and-puppies-hd.with-unicorns/", Zencodable::Encoder::Job.s3_url(origin_url, bucket, path)
|
62
|
+
end
|
63
|
+
|
64
|
+
test "builds the correct default settings" do
|
65
|
+
origin_url = 'http://foo.com/somepath/2/4/super_tricks.mov'
|
66
|
+
|
67
|
+
default_settings = [{
|
68
|
+
:public => true,
|
69
|
+
:format => "mp4",
|
70
|
+
:label => "mp4",
|
71
|
+
:base_url => "s3://zenbucket.s3.amazonaws.com/videos/encoded/"
|
72
|
+
}]
|
73
|
+
|
74
|
+
minimal_config = {:bucket => 'zenbucket', :path => 'videos/encoded'}
|
75
|
+
|
76
|
+
assert_equal default_settings, Zencodable::Encoder::Job.build_encoder_output_options(origin_url, minimal_config)
|
77
|
+
end
|
78
|
+
|
79
|
+
test "builds correct settings when a thumbnails are requested" do
|
80
|
+
origin_url = 'http://foo.com/somepath/2/4/super_tricks.mov'
|
81
|
+
|
82
|
+
config = {:formats => [:ogg, :mp4], :bucket => 'zenbucket', :path => 'videos/encoded', :thumbnails => { :number => 4 }}
|
83
|
+
|
84
|
+
output_options = Zencodable::Encoder::Job.build_encoder_output_options(origin_url, config)
|
85
|
+
|
86
|
+
# there should be a thumbnails option set for the first format request
|
87
|
+
assert_equal 4, output_options[0][:thumbnails][:number]
|
88
|
+
|
89
|
+
# but not for any subsequent ones
|
90
|
+
assert_nil output_options[1][:thumbnails]
|
62
91
|
end
|
63
92
|
|
64
93
|
end
|