active_encode 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +16 -0
- data/.rubocop.yml +76 -0
- data/.travis.yml +10 -0
- data/Gemfile +11 -0
- data/LICENSE +202 -0
- data/README.md +106 -0
- data/Rakefile +38 -0
- data/active_encode.gemspec +28 -0
- data/lib/active_encode.rb +2 -0
- data/lib/active_encode/base.rb +16 -0
- data/lib/active_encode/callbacks.rb +69 -0
- data/lib/active_encode/core.rb +79 -0
- data/lib/active_encode/engine_adapter.rb +51 -0
- data/lib/active_encode/engine_adapters.rb +27 -0
- data/lib/active_encode/engine_adapters/active_job_adapter.rb +23 -0
- data/lib/active_encode/engine_adapters/inline_adapter.rb +42 -0
- data/lib/active_encode/engine_adapters/matterhorn_adapter.rb +312 -0
- data/lib/active_encode/engine_adapters/shingoncoder_adapter.rb +56 -0
- data/lib/active_encode/engine_adapters/test_adapter.rb +38 -0
- data/lib/active_encode/engine_adapters/zencoder_adapter.rb +143 -0
- data/lib/active_encode/status.rb +38 -0
- data/lib/active_encode/technical_metadata.rb +11 -0
- data/lib/active_encode/version.rb +3 -0
- data/spec/fixtures/Bars_512kb.mp4 +0 -0
- data/spec/fixtures/matterhorn/cancelled_response.xml +323 -0
- data/spec/fixtures/matterhorn/completed_response.xml +4 -0
- data/spec/fixtures/matterhorn/create_response.xml +300 -0
- data/spec/fixtures/matterhorn/delete_track_response.xml +2 -0
- data/spec/fixtures/matterhorn/failed_response.xml +4 -0
- data/spec/fixtures/matterhorn/purged_response.xml +342 -0
- data/spec/fixtures/matterhorn/running_response.xml +1 -0
- data/spec/fixtures/matterhorn/stop_completed_response.xml +228 -0
- data/spec/fixtures/matterhorn/stop_running_response.xml +339 -0
- data/spec/fixtures/zencoder/job_create.json +1 -0
- data/spec/fixtures/zencoder/job_details_cancelled.json +1 -0
- data/spec/fixtures/zencoder/job_details_completed.json +1 -0
- data/spec/fixtures/zencoder/job_details_create.json +1 -0
- data/spec/fixtures/zencoder/job_details_failed.json +73 -0
- data/spec/fixtures/zencoder/job_details_running.json +1 -0
- data/spec/fixtures/zencoder/job_progress_cancelled.json +13 -0
- data/spec/fixtures/zencoder/job_progress_completed.json +13 -0
- data/spec/fixtures/zencoder/job_progress_create.json +1 -0
- data/spec/fixtures/zencoder/job_progress_failed.json +13 -0
- data/spec/fixtures/zencoder/job_progress_running.json +1 -0
- data/spec/integration/matterhorn_adapter_spec.rb +186 -0
- data/spec/integration/shingoncoder_adapter_spec.rb +152 -0
- data/spec/integration/zencoder_adapter_spec.rb +152 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/units/callbacks_spec.rb +66 -0
- data/spec/units/engine_adapter_spec.rb +78 -0
- data/spec/units/status_spec.rb +62 -0
- metadata +210 -0
@@ -0,0 +1,152 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'zencoder'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
describe ActiveEncode::EngineAdapters::ZencoderAdapter do
|
6
|
+
before(:all) do
|
7
|
+
ActiveEncode::Base.engine_adapter = :zencoder
|
8
|
+
end
|
9
|
+
after(:all) do
|
10
|
+
ActiveEncode::Base.engine_adapter = :inline
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:create_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_create.json'))) }
|
14
|
+
|
15
|
+
before do
|
16
|
+
allow(Zencoder::Job).to receive(:create).and_return(create_response)
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:file) { "file://#{File.absolute_path('spec/fixtures/Bars_512kb.mp4')}" }
|
20
|
+
|
21
|
+
describe "#create" do
|
22
|
+
before do
|
23
|
+
allow(Zencoder::Job).to receive(:details).and_return(details_response)
|
24
|
+
allow(Zencoder::Job).to receive(:progress).and_return(progress_response)
|
25
|
+
end
|
26
|
+
|
27
|
+
let(:details_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_details_create.json'))) }
|
28
|
+
let(:progress_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_progress_create.json'))) }
|
29
|
+
let(:create_output) { [{ id: "511404522", url: "https://zencoder-temp-storage-us-east-1.s3.amazonaws.com/o/20150610/c09b61e4d130ddf923f0653418a80b9c/399ae101c3f99b4f318635e78a4e587a.mp4?AWSAccessKeyId=AKIAI456JQ76GBU7FECA&Signature=GY/9LMkQAiDOrMQwS5BkmOE200s%3D&Expires=1434033527", label: nil }] }
|
30
|
+
|
31
|
+
subject { ActiveEncode::Base.create(file) }
|
32
|
+
it { is_expected.to be_a ActiveEncode::Base }
|
33
|
+
its(:id) { is_expected.not_to be_empty }
|
34
|
+
it { is_expected.to be_running }
|
35
|
+
its(:output) { is_expected.to eq create_output }
|
36
|
+
its(:current_operations) { is_expected.to be_empty }
|
37
|
+
its(:percent_complete) { is_expected.to eq 0 }
|
38
|
+
its(:errors) { is_expected.to be_empty }
|
39
|
+
its(:tech_metadata) { is_expected.to be_empty }
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "#find" do
|
43
|
+
before do
|
44
|
+
allow(Zencoder::Job).to receive(:details).and_return(details_response)
|
45
|
+
allow(Zencoder::Job).to receive(:progress).and_return(progress_response)
|
46
|
+
end
|
47
|
+
|
48
|
+
context "a running encode" do
|
49
|
+
let(:details_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_details_running.json'))) }
|
50
|
+
let(:progress_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_progress_running.json'))) }
|
51
|
+
let(:running_output) { [{ id: "510582971", url: "https://zencoder-temp-storage-us-east-1.s3.amazonaws.com/o/20150609/48a6907086c012f68b9ca43461280515/1726d7ec3e24f2171bd07b2abb807b6c.mp4?AWSAccessKeyId=AKIAI456JQ76GBU7FECA&Signature=vSvlxU94wlQLEbpG3Zs8ibp4MoY%3D&Expires=1433953106", label: nil }] }
|
52
|
+
let(:running_tech_metadata) { { audio_bitrate: "52", audio_codec: "aac", audio_channels: "2", duration: "57992", mime_type: "mpeg4", video_framerate: "29.97", height: "240", video_bitrate: "535", video_codec: "h264", width: "320" } }
|
53
|
+
|
54
|
+
subject { ActiveEncode::Base.find('166019107') }
|
55
|
+
it { is_expected.to be_a ActiveEncode::Base }
|
56
|
+
its(:id) { is_expected.to eq '166019107' }
|
57
|
+
it { is_expected.to be_running }
|
58
|
+
its(:output) { is_expected.to eq running_output }
|
59
|
+
its(:current_operations) { is_expected.to be_empty }
|
60
|
+
its(:percent_complete) { is_expected.to eq 30.0 }
|
61
|
+
its(:errors) { is_expected.to be_empty }
|
62
|
+
its(:tech_metadata) { is_expected.to eq running_tech_metadata }
|
63
|
+
end
|
64
|
+
|
65
|
+
context "a cancelled encode" do
|
66
|
+
let(:details_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_details_cancelled.json'))) }
|
67
|
+
let(:progress_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_progress_cancelled.json'))) }
|
68
|
+
|
69
|
+
subject { ActiveEncode::Base.find('165866551') }
|
70
|
+
it { is_expected.to be_a ActiveEncode::Base }
|
71
|
+
its(:id) { is_expected.to eq '165866551' }
|
72
|
+
it { is_expected.to be_cancelled }
|
73
|
+
its(:current_operations) { is_expected.to be_empty }
|
74
|
+
its(:percent_complete) { is_expected.to eq 0 }
|
75
|
+
its(:errors) { is_expected.to be_empty }
|
76
|
+
its(:tech_metadata) { is_expected.to be_empty }
|
77
|
+
end
|
78
|
+
|
79
|
+
context "a completed encode" do
|
80
|
+
let(:details_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_details_completed.json'))) }
|
81
|
+
let(:progress_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_progress_completed.json'))) }
|
82
|
+
let(:completed_output) { { id: "509856876", audio_bitrate: "53", audio_codec: "aac", audio_channels: "2", duration: "5000", mime_type: "mpeg4", video_framerate: "29.97", height: "240", video_bitrate: "549", video_codec: "h264", width: "320", url: "https://zencoder-temp-storage-us-east-1.s3.amazonaws.com/o/20150608/ebbe865f8ef1b960d7c2bb0663b88a12/0f1948dcb2fd701fba30ff21908fe460.mp4?AWSAccessKeyId=AKIAI456JQ76GBU7FECA&Signature=1LgIyl/el9E7zeyPxzd/%2BNwez6Y%3D&Expires=1433873646", label: nil } }
|
83
|
+
let(:completed_tech_metadata) { { audio_bitrate: "52", audio_codec: "aac", audio_channels: "2", duration: "57992", mime_type: "mpeg4", video_framerate: "29.97", height: "240", video_bitrate: "535", video_codec: "h264", width: "320" } }
|
84
|
+
|
85
|
+
subject { ActiveEncode::Base.find('165839139') }
|
86
|
+
it { is_expected.to be_a ActiveEncode::Base }
|
87
|
+
its(:id) { is_expected.to eq '165839139' }
|
88
|
+
it { is_expected.to be_completed }
|
89
|
+
its(:output) { is_expected.to include completed_output }
|
90
|
+
its(:current_operations) { is_expected.to be_empty }
|
91
|
+
its(:percent_complete) { is_expected.to eq 100 }
|
92
|
+
its(:errors) { is_expected.to be_empty }
|
93
|
+
its(:tech_metadata) { is_expected.to eq completed_tech_metadata }
|
94
|
+
end
|
95
|
+
|
96
|
+
context "a failed encode" do
|
97
|
+
let(:details_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_details_failed.json'))) }
|
98
|
+
let(:progress_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_progress_failed.json'))) }
|
99
|
+
let(:failed_tech_metadata) { { mime_type: "video/mp4", checksum: "7ae24368ccb7a6c6422a14ff73f33c9a", duration: "6314", audio_codec: "AAC", audio_channels: "2", audio_bitrate: "171030.0", video_codec: "AVC", video_bitrate: "74477.0", video_framerate: "23.719", width: "200", height: "110" } }
|
100
|
+
let(:failed_errors) { "The file is an XML file, and doesn't contain audio or video tracks." }
|
101
|
+
|
102
|
+
subject { ActiveEncode::Base.find('166079902') }
|
103
|
+
it { is_expected.to be_a ActiveEncode::Base }
|
104
|
+
its(:id) { is_expected.to eq '166079902' }
|
105
|
+
it { is_expected.to be_failed }
|
106
|
+
its(:current_operations) { is_expected.to be_empty }
|
107
|
+
its(:percent_complete) { is_expected.to eq 0 }
|
108
|
+
its(:errors) { is_expected.to include failed_errors }
|
109
|
+
its(:tech_metadata) { is_expected.to be_empty }
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
describe "#cancel!" do
|
114
|
+
before do
|
115
|
+
allow(Zencoder::Job).to receive(:cancel).and_return(cancel_response)
|
116
|
+
allow(Zencoder::Job).to receive(:details).and_return(details_response)
|
117
|
+
allow(Zencoder::Job).to receive(:progress).and_return(progress_response)
|
118
|
+
end
|
119
|
+
|
120
|
+
let(:cancel_response) { Zencoder::Response.new(code: 200) } # TODO: check that this is the correct response code for a successful cancel
|
121
|
+
let(:details_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_details_cancelled.json'))) }
|
122
|
+
let(:progress_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_progress_cancelled.json'))) }
|
123
|
+
|
124
|
+
let(:encode) { ActiveEncode::Base.create(file) }
|
125
|
+
subject { encode.cancel! }
|
126
|
+
it { is_expected.to be_a ActiveEncode::Base }
|
127
|
+
its(:id) { is_expected.to eq '165866551' }
|
128
|
+
it { is_expected.to be_cancelled }
|
129
|
+
end
|
130
|
+
|
131
|
+
describe "reload" do
|
132
|
+
before do
|
133
|
+
allow(Zencoder::Job).to receive(:details).and_return(details_response)
|
134
|
+
allow(Zencoder::Job).to receive(:progress).and_return(progress_response)
|
135
|
+
end
|
136
|
+
|
137
|
+
let(:details_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_details_running.json'))) }
|
138
|
+
let(:progress_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_progress_running.json'))) }
|
139
|
+
let(:reload_output) { [{ id: "510582971", url: "https://zencoder-temp-storage-us-east-1.s3.amazonaws.com/o/20150609/48a6907086c012f68b9ca43461280515/1726d7ec3e24f2171bd07b2abb807b6c.mp4?AWSAccessKeyId=AKIAI456JQ76GBU7FECA&Signature=vSvlxU94wlQLEbpG3Zs8ibp4MoY%3D&Expires=1433953106", label: nil }] }
|
140
|
+
let(:reload_tech_metadata) { { audio_bitrate: "52", audio_codec: "aac", audio_channels: "2", duration: "57992", mime_type: "mpeg4", video_framerate: "29.97", height: "240", video_bitrate: "535", video_codec: "h264", width: "320" } }
|
141
|
+
|
142
|
+
subject { ActiveEncode::Base.find('166019107').reload }
|
143
|
+
it { is_expected.to be_a ActiveEncode::Base }
|
144
|
+
its(:id) { is_expected.to eq '166019107' }
|
145
|
+
it { is_expected.to be_running }
|
146
|
+
its(:output) { is_expected.to eq reload_output }
|
147
|
+
its(:current_operations) { is_expected.to be_empty }
|
148
|
+
its(:percent_complete) { is_expected.to eq 30.0 }
|
149
|
+
its(:errors) { is_expected.to be_empty }
|
150
|
+
its(:tech_metadata) { is_expected.to eq reload_tech_metadata }
|
151
|
+
end
|
152
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ActiveEncode::Callbacks do
|
4
|
+
before do
|
5
|
+
class CallbackEncode < ActiveEncode::Base
|
6
|
+
before_create ->(encode) { encode.history << "CallbackEncode ran before_create" }
|
7
|
+
after_create ->(encode) { encode.history << "CallbackEncode ran after_create" }
|
8
|
+
|
9
|
+
before_cancel ->(encode) { encode.history << "CallbackEncode ran before_cancel" }
|
10
|
+
after_cancel ->(encode) { encode.history << "CallbackEncode ran after_cancel" }
|
11
|
+
|
12
|
+
before_purge ->(encode) { encode.history << "CallbackEncode ran before_purge" }
|
13
|
+
after_purge ->(encode) { encode.history << "CallbackEncode ran after_purge" }
|
14
|
+
|
15
|
+
around_create do |encode, block|
|
16
|
+
encode.history << "CallbackEncode ran around_create_start"
|
17
|
+
block.call
|
18
|
+
encode.history << "CallbackEncode ran around_create_stop"
|
19
|
+
end
|
20
|
+
|
21
|
+
around_cancel do |encode, block|
|
22
|
+
encode.history << "CallbackEncode ran around_cancel_start"
|
23
|
+
block.call
|
24
|
+
encode.history << "CallbackEncode ran around_cancel_stop"
|
25
|
+
end
|
26
|
+
|
27
|
+
around_purge do |encode, block|
|
28
|
+
encode.history << "CallbackEncode ran around_purge_start"
|
29
|
+
block.call
|
30
|
+
encode.history << "CallbackEncode ran around_purge_stop"
|
31
|
+
end
|
32
|
+
|
33
|
+
def history
|
34
|
+
@history ||= []
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
after do
|
40
|
+
Object.send(:remove_const, :CallbackEncode)
|
41
|
+
end
|
42
|
+
|
43
|
+
describe 'create callbacks' do
|
44
|
+
subject { CallbackEncode.create("sample.mp4").history }
|
45
|
+
it { is_expected.to include("CallbackEncode ran before_create") }
|
46
|
+
it { is_expected.to include("CallbackEncode ran after_create") }
|
47
|
+
it { is_expected.to include("CallbackEncode ran around_create_start") }
|
48
|
+
it { is_expected.to include("CallbackEncode ran around_create_stop") }
|
49
|
+
end
|
50
|
+
|
51
|
+
describe 'cancel callbacks' do
|
52
|
+
subject { CallbackEncode.create("sample.mp4").cancel!.history }
|
53
|
+
it { is_expected.to include("CallbackEncode ran before_cancel") }
|
54
|
+
it { is_expected.to include("CallbackEncode ran after_cancel") }
|
55
|
+
it { is_expected.to include("CallbackEncode ran around_cancel_start") }
|
56
|
+
it { is_expected.to include("CallbackEncode ran around_cancel_stop") }
|
57
|
+
end
|
58
|
+
|
59
|
+
describe 'purge callbacks' do
|
60
|
+
subject { CallbackEncode.create("sample.mp4").purge!.history }
|
61
|
+
it { is_expected.to include("CallbackEncode ran before_purge") }
|
62
|
+
it { is_expected.to include("CallbackEncode ran after_purge") }
|
63
|
+
it { is_expected.to include("CallbackEncode ran around_purge_start") }
|
64
|
+
it { is_expected.to include("CallbackEncode ran around_purge_stop") }
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ActiveEncode::EngineAdapter do
|
4
|
+
before do
|
5
|
+
module ActiveEncode
|
6
|
+
module EngineAdapters
|
7
|
+
class StubOneAdapter
|
8
|
+
def create(_); end
|
9
|
+
|
10
|
+
def find(_, _ = {}); end
|
11
|
+
|
12
|
+
def list(*); end
|
13
|
+
|
14
|
+
def cancel(_encode); end
|
15
|
+
|
16
|
+
def purge(_encode); end
|
17
|
+
|
18
|
+
def remove_output(_encode, _output_id); end
|
19
|
+
end
|
20
|
+
|
21
|
+
class StubTwoAdapter
|
22
|
+
def create(_encode); end
|
23
|
+
|
24
|
+
def find(_id, _opts = {}); end
|
25
|
+
|
26
|
+
def list(*); end
|
27
|
+
|
28
|
+
def cancel(_encode); end
|
29
|
+
|
30
|
+
def purge(_encode); end
|
31
|
+
|
32
|
+
def remove_output(_encode, _output_id); end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
after do
|
39
|
+
ActiveEncode::EngineAdapters.send(:remove_const, :StubOneAdapter)
|
40
|
+
ActiveEncode::EngineAdapters.send(:remove_const, :StubTwoAdapter)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'does not allow classes as arguments' do
|
44
|
+
expect { ActiveEncode::Base.engine_adapter = ActiveEncode::EngineAdapters::StubOneAdapter }.to raise_error(ArgumentError)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'does not allow arguments that are not engine adapters' do
|
48
|
+
expect { ActiveEncode::Base.engine_adapter = Mutex.new }.to raise_error(ArgumentError)
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'overriding' do
|
52
|
+
let(:base_engine_adapter) { ActiveEncode::Base.engine_adapter }
|
53
|
+
|
54
|
+
it 'does not affect the parent' do
|
55
|
+
child_encode_one = Class.new(ActiveEncode::Base)
|
56
|
+
child_encode_one.engine_adapter = :stub_one
|
57
|
+
|
58
|
+
expect(child_encode_one.engine_adapter).not_to eq base_engine_adapter
|
59
|
+
expect(child_encode_one.engine_adapter).to be_kind_of ActiveEncode::EngineAdapters::StubOneAdapter
|
60
|
+
expect(ActiveEncode::Base.engine_adapter).to eq base_engine_adapter
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'does not affect its sibling' do
|
64
|
+
child_encode_one = Class.new(ActiveEncode::Base)
|
65
|
+
child_encode_one.engine_adapter = :stub_one
|
66
|
+
child_encode_two = Class.new(ActiveEncode::Base)
|
67
|
+
child_encode_two.engine_adapter = :stub_two
|
68
|
+
|
69
|
+
expect(child_encode_two.engine_adapter).not_to eq base_engine_adapter
|
70
|
+
expect(child_encode_two.engine_adapter).to be_kind_of ActiveEncode::EngineAdapters::StubTwoAdapter
|
71
|
+
# child_encode_one's engine adapter should remain unchanged
|
72
|
+
expect(child_encode_one.engine_adapter).to be_kind_of ActiveEncode::EngineAdapters::StubOneAdapter
|
73
|
+
expect(ActiveEncode::Base.engine_adapter).to eq base_engine_adapter
|
74
|
+
# new encodes should not be affected
|
75
|
+
expect(Class.new(ActiveEncode::Base).engine_adapter).to eq base_engine_adapter
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ActiveEncode::Status do
|
4
|
+
subject { ActiveEncode::Base.new(nil) }
|
5
|
+
|
6
|
+
context 'new object' do
|
7
|
+
subject { ActiveEncode::Base.new(nil) }
|
8
|
+
it { is_expected.not_to be_created }
|
9
|
+
it { is_expected.not_to be_running }
|
10
|
+
it { is_expected.not_to be_cancelled }
|
11
|
+
it { is_expected.not_to be_completed }
|
12
|
+
it { is_expected.not_to be_failed }
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'running job' do
|
16
|
+
before do
|
17
|
+
subject.id = 1
|
18
|
+
subject.state = :running
|
19
|
+
end
|
20
|
+
it { is_expected.to be_created }
|
21
|
+
it { is_expected.to be_running }
|
22
|
+
it { is_expected.not_to be_cancelled }
|
23
|
+
it { is_expected.not_to be_completed }
|
24
|
+
it { is_expected.not_to be_failed }
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'cancelled job' do
|
28
|
+
before do
|
29
|
+
subject.id = 1
|
30
|
+
subject.state = :cancelled
|
31
|
+
end
|
32
|
+
it { is_expected.to be_created }
|
33
|
+
it { is_expected.not_to be_running }
|
34
|
+
it { is_expected.to be_cancelled }
|
35
|
+
it { is_expected.not_to be_completed }
|
36
|
+
it { is_expected.not_to be_failed }
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'completed job' do
|
40
|
+
before do
|
41
|
+
subject.id = 1
|
42
|
+
subject.state = :completed
|
43
|
+
end
|
44
|
+
it { is_expected.to be_created }
|
45
|
+
it { is_expected.not_to be_running }
|
46
|
+
it { is_expected.not_to be_cancelled }
|
47
|
+
it { is_expected.to be_completed }
|
48
|
+
it { is_expected.not_to be_failed }
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'failed job' do
|
52
|
+
before do
|
53
|
+
subject.id = 1
|
54
|
+
subject.state = :failed
|
55
|
+
end
|
56
|
+
it { is_expected.to be_created }
|
57
|
+
it { is_expected.not_to be_running }
|
58
|
+
it { is_expected.not_to be_cancelled }
|
59
|
+
it { is_expected.not_to be_completed }
|
60
|
+
it { is_expected.to be_failed }
|
61
|
+
end
|
62
|
+
end
|
metadata
ADDED
@@ -0,0 +1,210 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: active_encode
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Klein, Chris Colvard
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: coveralls
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec-its
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.2'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.2'
|
97
|
+
description: This gem serves as the basis for the interface between a Ruby (Rails)
|
98
|
+
application and a provider of transcoding services such as Opencast Matterhorn,
|
99
|
+
Zencoder, and Amazon Elastic Transcoder.
|
100
|
+
email:
|
101
|
+
- mbklein@gmail.com, chris.colvard@gmail.com
|
102
|
+
executables: []
|
103
|
+
extensions: []
|
104
|
+
extra_rdoc_files: []
|
105
|
+
files:
|
106
|
+
- ".coveralls.yml"
|
107
|
+
- ".gitignore"
|
108
|
+
- ".rubocop.yml"
|
109
|
+
- ".travis.yml"
|
110
|
+
- Gemfile
|
111
|
+
- LICENSE
|
112
|
+
- README.md
|
113
|
+
- Rakefile
|
114
|
+
- active_encode.gemspec
|
115
|
+
- lib/active_encode.rb
|
116
|
+
- lib/active_encode/base.rb
|
117
|
+
- lib/active_encode/callbacks.rb
|
118
|
+
- lib/active_encode/core.rb
|
119
|
+
- lib/active_encode/engine_adapter.rb
|
120
|
+
- lib/active_encode/engine_adapters.rb
|
121
|
+
- lib/active_encode/engine_adapters/active_job_adapter.rb
|
122
|
+
- lib/active_encode/engine_adapters/inline_adapter.rb
|
123
|
+
- lib/active_encode/engine_adapters/matterhorn_adapter.rb
|
124
|
+
- lib/active_encode/engine_adapters/shingoncoder_adapter.rb
|
125
|
+
- lib/active_encode/engine_adapters/test_adapter.rb
|
126
|
+
- lib/active_encode/engine_adapters/zencoder_adapter.rb
|
127
|
+
- lib/active_encode/status.rb
|
128
|
+
- lib/active_encode/technical_metadata.rb
|
129
|
+
- lib/active_encode/version.rb
|
130
|
+
- spec/fixtures/Bars_512kb.mp4
|
131
|
+
- spec/fixtures/matterhorn/cancelled_response.xml
|
132
|
+
- spec/fixtures/matterhorn/completed_response.xml
|
133
|
+
- spec/fixtures/matterhorn/create_response.xml
|
134
|
+
- spec/fixtures/matterhorn/delete_track_response.xml
|
135
|
+
- spec/fixtures/matterhorn/failed_response.xml
|
136
|
+
- spec/fixtures/matterhorn/purged_response.xml
|
137
|
+
- spec/fixtures/matterhorn/running_response.xml
|
138
|
+
- spec/fixtures/matterhorn/stop_completed_response.xml
|
139
|
+
- spec/fixtures/matterhorn/stop_running_response.xml
|
140
|
+
- spec/fixtures/zencoder/job_create.json
|
141
|
+
- spec/fixtures/zencoder/job_details_cancelled.json
|
142
|
+
- spec/fixtures/zencoder/job_details_completed.json
|
143
|
+
- spec/fixtures/zencoder/job_details_create.json
|
144
|
+
- spec/fixtures/zencoder/job_details_failed.json
|
145
|
+
- spec/fixtures/zencoder/job_details_running.json
|
146
|
+
- spec/fixtures/zencoder/job_progress_cancelled.json
|
147
|
+
- spec/fixtures/zencoder/job_progress_completed.json
|
148
|
+
- spec/fixtures/zencoder/job_progress_create.json
|
149
|
+
- spec/fixtures/zencoder/job_progress_failed.json
|
150
|
+
- spec/fixtures/zencoder/job_progress_running.json
|
151
|
+
- spec/integration/matterhorn_adapter_spec.rb
|
152
|
+
- spec/integration/shingoncoder_adapter_spec.rb
|
153
|
+
- spec/integration/zencoder_adapter_spec.rb
|
154
|
+
- spec/spec_helper.rb
|
155
|
+
- spec/units/callbacks_spec.rb
|
156
|
+
- spec/units/engine_adapter_spec.rb
|
157
|
+
- spec/units/status_spec.rb
|
158
|
+
homepage: ''
|
159
|
+
licenses:
|
160
|
+
- MIT
|
161
|
+
metadata: {}
|
162
|
+
post_install_message:
|
163
|
+
rdoc_options: []
|
164
|
+
require_paths:
|
165
|
+
- lib
|
166
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '0'
|
171
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
|
+
requirements:
|
173
|
+
- - ">="
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
requirements: []
|
177
|
+
rubyforge_project:
|
178
|
+
rubygems_version: 2.4.7
|
179
|
+
signing_key:
|
180
|
+
specification_version: 4
|
181
|
+
summary: Declare encode job classes that can be run by a variety of encoding services
|
182
|
+
test_files:
|
183
|
+
- spec/fixtures/Bars_512kb.mp4
|
184
|
+
- spec/fixtures/matterhorn/cancelled_response.xml
|
185
|
+
- spec/fixtures/matterhorn/completed_response.xml
|
186
|
+
- spec/fixtures/matterhorn/create_response.xml
|
187
|
+
- spec/fixtures/matterhorn/delete_track_response.xml
|
188
|
+
- spec/fixtures/matterhorn/failed_response.xml
|
189
|
+
- spec/fixtures/matterhorn/purged_response.xml
|
190
|
+
- spec/fixtures/matterhorn/running_response.xml
|
191
|
+
- spec/fixtures/matterhorn/stop_completed_response.xml
|
192
|
+
- spec/fixtures/matterhorn/stop_running_response.xml
|
193
|
+
- spec/fixtures/zencoder/job_create.json
|
194
|
+
- spec/fixtures/zencoder/job_details_cancelled.json
|
195
|
+
- spec/fixtures/zencoder/job_details_completed.json
|
196
|
+
- spec/fixtures/zencoder/job_details_create.json
|
197
|
+
- spec/fixtures/zencoder/job_details_failed.json
|
198
|
+
- spec/fixtures/zencoder/job_details_running.json
|
199
|
+
- spec/fixtures/zencoder/job_progress_cancelled.json
|
200
|
+
- spec/fixtures/zencoder/job_progress_completed.json
|
201
|
+
- spec/fixtures/zencoder/job_progress_create.json
|
202
|
+
- spec/fixtures/zencoder/job_progress_failed.json
|
203
|
+
- spec/fixtures/zencoder/job_progress_running.json
|
204
|
+
- spec/integration/matterhorn_adapter_spec.rb
|
205
|
+
- spec/integration/shingoncoder_adapter_spec.rb
|
206
|
+
- spec/integration/zencoder_adapter_spec.rb
|
207
|
+
- spec/spec_helper.rb
|
208
|
+
- spec/units/callbacks_spec.rb
|
209
|
+
- spec/units/engine_adapter_spec.rb
|
210
|
+
- spec/units/status_spec.rb
|