dvr 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/dvr/dvr_server.rb +49 -0
- data/lib/dvr.rb +4 -2
- data/lib/dvr/cli/app.rb +8 -7
- data/lib/dvr/configuration.rb +27 -1
- data/lib/dvr/season.rb +0 -1
- data/lib/dvr/version.rb +1 -1
- data/my_downloads/dvr_server.rb +49 -0
- data/spec/dvr/configuration_spec.rb +26 -6
- data/spec/dvr/season_spec.rb +9 -1
- data/spec/dvr_spec.rb +14 -0
- metadata +5 -3
data/dvr/dvr_server.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'sinatra'
|
3
|
+
|
4
|
+
before { request.path_info += '/'+ request.query_string if request.query_string && !request.query_string.empty? }
|
5
|
+
|
6
|
+
post 'api/v1/har_records' do
|
7
|
+
'{"job_id":"00c5ff51ca644e3f3de14dd5"}'
|
8
|
+
end
|
9
|
+
|
10
|
+
get '/api/v1/har_records/account_id=1' do
|
11
|
+
'{"count":1,"har_records":{"1940":{"id":"1940","source_url":null,"wait_time":null,"dns_time":null,"send_time":null,"connect_time":null,"blocked_time":null,"receive_time":null,"browser":null,"creator":null,"domain":null,"har_url":"https://s3.amazonaws.com/checkdata.rigor.com/49.harp","entry_count":null,"error_count":null,"dom_load_time":null,"page_load_time":null,"server_time":null,"page_size":null,"client_error_count":null,"server_error_count":null,"connection_error_count":null,"created_at":"2013-12-09T22:40:54Z","updated_at":"2013-12-09T22:40:54Z","started_date_time":null,"account_id":1,"check_id":1,"check_run_history_id":1,"location_id":1,"image_count":null,"javascript_count":null,"css_count":null,"html_count":null,"flash_count":null,"other_count":null,"run_record_id":null}},"results":[{"key":"har_records","id":"1940"}]}'
|
12
|
+
end
|
13
|
+
|
14
|
+
get '/api/v1/har_records/check_id=1' do
|
15
|
+
'{"count":1,"har_records":{"1941":{"id":"1941","source_url":null,"wait_time":null,"dns_time":null,"send_time":null,"connect_time":null,"blocked_time":null,"receive_time":null,"browser":null,"creator":null,"domain":null,"har_url":"https://s3.amazonaws.com/checkdata.rigor.com/50.harp","entry_count":null,"error_count":null,"dom_load_time":null,"page_load_time":null,"server_time":null,"page_size":null,"client_error_count":null,"server_error_count":null,"connection_error_count":null,"created_at":"2013-12-09T22:40:54Z","updated_at":"2013-12-09T22:40:54Z","started_date_time":null,"account_id":1,"check_id":1,"check_run_history_id":1,"location_id":1,"image_count":null,"javascript_count":null,"css_count":null,"html_count":null,"flash_count":null,"other_count":null,"run_record_id":null}},"results":[{"key":"har_records","id":"1941"}]}'
|
16
|
+
end
|
17
|
+
|
18
|
+
get '/api/v1/har_records/check_run_history_id=1' do
|
19
|
+
'{"count":1,"har_records":{"1937":{"id":"1937","source_url":null,"wait_time":null,"dns_time":null,"send_time":null,"connect_time":null,"blocked_time":null,"receive_time":null,"browser":null,"creator":null,"domain":null,"har_url":"https://s3.amazonaws.com/checkdata.rigor.com/46.harp","entry_count":null,"error_count":null,"dom_load_time":null,"page_load_time":null,"server_time":null,"page_size":null,"client_error_count":null,"server_error_count":null,"connection_error_count":null,"created_at":"2013-12-09T22:40:54Z","updated_at":"2013-12-09T22:40:54Z","started_date_time":null,"account_id":1,"check_id":1,"check_run_history_id":1,"location_id":1,"image_count":null,"javascript_count":null,"css_count":null,"html_count":null,"flash_count":null,"other_count":null,"run_record_id":null}},"results":[{"key":"har_records","id":"1937"}]}'
|
20
|
+
end
|
21
|
+
|
22
|
+
get '/api/v1/har_records/start=2013-11-11&end=2013-11-21' do
|
23
|
+
'{"count":1,"har_records":{"1936":{"id":"1936","source_url":null,"wait_time":null,"dns_time":null,"send_time":null,"connect_time":null,"blocked_time":null,"receive_time":null,"browser":null,"creator":null,"domain":null,"har_url":"https://s3.amazonaws.com/checkdata.rigor.com/45.harp","entry_count":null,"error_count":null,"dom_load_time":null,"page_load_time":null,"server_time":null,"page_size":null,"client_error_count":null,"server_error_count":null,"connection_error_count":null,"created_at":"2013-12-09T22:40:54Z","updated_at":"2013-12-09T22:40:54Z","started_date_time":null,"account_id":1,"check_id":1,"check_run_history_id":1,"location_id":1,"image_count":null,"javascript_count":null,"css_count":null,"html_count":null,"flash_count":null,"other_count":null,"run_record_id":null}},"results":[{"key":"har_records","id":"1936"}]}'
|
24
|
+
end
|
25
|
+
|
26
|
+
get '/api/v1/har_records/location_id=1' do
|
27
|
+
'{"count":1,"har_records":{"1939":{"id":"1939","source_url":null,"wait_time":null,"dns_time":null,"send_time":null,"connect_time":null,"blocked_time":null,"receive_time":null,"browser":null,"creator":null,"domain":null,"har_url":"https://s3.amazonaws.com/checkdata.rigor.com/48.harp","entry_count":null,"error_count":null,"dom_load_time":null,"page_load_time":null,"server_time":null,"page_size":null,"client_error_count":null,"server_error_count":null,"connection_error_count":null,"created_at":"2013-12-09T22:40:54Z","updated_at":"2013-12-09T22:40:54Z","started_date_time":null,"account_id":1,"check_id":1,"check_run_history_id":1,"location_id":1,"image_count":null,"javascript_count":null,"css_count":null,"html_count":null,"flash_count":null,"other_count":null,"run_record_id":null}},"results":[{"key":"har_records","id":"1939"}]}'
|
28
|
+
end
|
29
|
+
|
30
|
+
get '/api/v1/har_records' do
|
31
|
+
'{"count":1,"har_records":{"1938":{"id":"1938","source_url":null,"wait_time":null,"dns_time":null,"send_time":null,"connect_time":null,"blocked_time":null,"receive_time":null,"browser":null,"creator":null,"domain":null,"har_url":"https://s3.amazonaws.com/checkdata.rigor.com/47.harp","entry_count":null,"error_count":null,"dom_load_time":null,"page_load_time":null,"server_time":null,"page_size":null,"client_error_count":null,"server_error_count":null,"connection_error_count":null,"created_at":"2013-12-09T22:40:54Z","updated_at":"2013-12-09T22:40:54Z","started_date_time":null,"account_id":1,"check_id":1,"check_run_history_id":1,"location_id":1,"image_count":null,"javascript_count":null,"css_count":null,"html_count":null,"flash_count":null,"other_count":null,"run_record_id":null}},"results":[{"key":"har_records","id":"1938"}]}'
|
32
|
+
end
|
33
|
+
|
34
|
+
get '/api/v1/har_records/per_page=1&page=1' do
|
35
|
+
'{"count":1,"har_records":{"1935":{"id":"1935","source_url":null,"wait_time":null,"dns_time":null,"send_time":null,"connect_time":null,"blocked_time":null,"receive_time":null,"browser":null,"creator":null,"domain":null,"har_url":"https://s3.amazonaws.com/checkdata.rigor.com/44.harp","entry_count":null,"error_count":null,"dom_load_time":null,"page_load_time":null,"server_time":null,"page_size":null,"client_error_count":null,"server_error_count":null,"connection_error_count":null,"created_at":"2013-12-09T22:40:54Z","updated_at":"2013-12-09T22:40:54Z","started_date_time":null,"account_id":1,"check_id":1,"check_run_history_id":1,"location_id":1,"image_count":null,"javascript_count":null,"css_count":null,"html_count":null,"flash_count":null,"other_count":null,"run_record_id":null}},"results":[{"key":"har_records","id":"1935"}]}'
|
36
|
+
end
|
37
|
+
|
38
|
+
post 'api/v1/har_records_bulk' do
|
39
|
+
'{"job_id":"b48c6bd17724fd2324a97f4b"}'
|
40
|
+
end
|
41
|
+
|
42
|
+
delete 'api/v1/har_records_bulk/destroy_by_account_id' do
|
43
|
+
'{"job_id":"997743e056e5d75ef0a142b4"}'
|
44
|
+
end
|
45
|
+
|
46
|
+
delete 'api/v1/har_records_bulk/destroy_by_check_id' do
|
47
|
+
'{"job_id":"d29dcc8754dc997a182f15b5"}'
|
48
|
+
end
|
49
|
+
|
data/lib/dvr.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'json'
|
2
|
+
require 'pathname'
|
3
|
+
require 'fileutils'
|
2
4
|
require "dvr/version"
|
3
5
|
require "dvr/configuration"
|
4
6
|
require "dvr/episode"
|
@@ -27,13 +29,13 @@ module DVR
|
|
27
29
|
end
|
28
30
|
|
29
31
|
def download_location
|
30
|
-
@download_location ||= File.join(DVR.configuration.
|
32
|
+
@download_location ||= File.join(DVR.configuration.full_destination, DVR.configuration.filename)
|
31
33
|
end
|
32
34
|
|
33
35
|
def prep_destination
|
34
36
|
unless File.directory?(DVR.configuration.destination)
|
37
|
+
FileUtils.mkdir_p(DVR.configuration.destination)
|
35
38
|
puts "Created destination directory at #{DVR.configuration.destination}"
|
36
|
-
Dir.mkdir(DVR.configuration.destination)
|
37
39
|
else
|
38
40
|
puts "Used existing destination directory at #{DVR.configuration.destination}"
|
39
41
|
end
|
data/lib/dvr/cli/app.rb
CHANGED
@@ -3,21 +3,22 @@ module DVR
|
|
3
3
|
class App < Thor
|
4
4
|
namespace :dvr
|
5
5
|
|
6
|
-
desc "record", "Record episodes from API docs and playback as a Sinatra server file"
|
7
|
-
method_option :episode_location, :aliases => "-l", :desc => "The location of the JSON files to record", :required => true
|
6
|
+
desc "record FROM_DIRECTORY", "Record episodes from API docs and playback as a Sinatra server file"
|
8
7
|
method_option :episode_format, :aliases => "-f", :desc => "The format of the provided files", :required => false
|
9
8
|
method_option :episode_source, :aliases => "-s", :desc => "The source of the JSON files", :required => false
|
10
9
|
method_option :destination, :aliases => "-d", :desc => "The destination for the recorded server file", :required => false
|
11
10
|
method_option :filename, :aliases => "-n", :desc => "The name for the recorded server file", :required => false
|
12
|
-
|
11
|
+
method_option :auto_create_directories, :aliases => "-a", :type => :boolean, :desc => "Flag to auto create directories", :required => false
|
12
|
+
def record(episode_location)
|
13
13
|
configure_options!
|
14
|
+
DVR.configure {|c| c.episode_location = episode_location}
|
14
15
|
DVR.record_and_download
|
15
16
|
end
|
16
17
|
|
17
|
-
desc "play", "Play back recorded episodes by starting a Sinatra server"
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
desc "play SERVER_FILE", "Play back recorded episodes by starting a Sinatra server"
|
19
|
+
def play(file)
|
20
|
+
puts "Playing episodes from #{file}"
|
21
|
+
DVR.configure {|c| c.recording_location = file}
|
21
22
|
DVR.play
|
22
23
|
end
|
23
24
|
|
data/lib/dvr/configuration.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
require 'pry'
|
1
2
|
module DVR
|
2
3
|
|
3
4
|
class Configuration
|
4
|
-
attr_accessor :episode_format, :episode_location, :episode_source, :filename, :destination, :recording_location
|
5
|
+
attr_accessor :episode_format, :episode_location, :episode_source, :filename, :destination, :auto_create_directories, :destination, :recording_location
|
5
6
|
|
6
7
|
def initialize
|
7
8
|
@episode_format = :rspec_api_documentation
|
@@ -10,6 +11,30 @@ module DVR
|
|
10
11
|
@filename = 'dvr_server.rb'
|
11
12
|
@destination = "#{Dir.pwd}/dvr"
|
12
13
|
@recording_location = File.join(@destination, @filename)
|
14
|
+
@auto_create_directories = true
|
15
|
+
end
|
16
|
+
|
17
|
+
def recording_location
|
18
|
+
get_real_path(@recording_location)
|
19
|
+
end
|
20
|
+
|
21
|
+
def full_destination
|
22
|
+
get_real_path(@destination)
|
23
|
+
end
|
24
|
+
|
25
|
+
protected
|
26
|
+
|
27
|
+
def get_real_path path
|
28
|
+
begin
|
29
|
+
Pathname.new(path).realpath.to_s
|
30
|
+
rescue Errno::ENOENT => e
|
31
|
+
if @auto_create_directories
|
32
|
+
DVR.prep_destination
|
33
|
+
self.destination = get_real_path(path)
|
34
|
+
else
|
35
|
+
raise InvalidConfiguration, "Invalid path #{path}. No such directory."
|
36
|
+
end
|
37
|
+
end
|
13
38
|
end
|
14
39
|
|
15
40
|
end
|
@@ -25,6 +50,7 @@ module DVR
|
|
25
50
|
|
26
51
|
def configure
|
27
52
|
yield(configuration)
|
53
|
+
@configuration
|
28
54
|
end
|
29
55
|
|
30
56
|
end
|
data/lib/dvr/season.rb
CHANGED
data/lib/dvr/version.rb
CHANGED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'sinatra'
|
3
|
+
|
4
|
+
before { request.path_info += '/'+ request.query_string if request.query_string && !request.query_string.empty? }
|
5
|
+
|
6
|
+
post 'api/v1/har_records' do
|
7
|
+
'{"job_id":"00c5ff51ca644e3f3de14dd5"}'
|
8
|
+
end
|
9
|
+
|
10
|
+
get '/api/v1/har_records/account_id=1' do
|
11
|
+
'{"count":1,"har_records":{"1940":{"id":"1940","source_url":null,"wait_time":null,"dns_time":null,"send_time":null,"connect_time":null,"blocked_time":null,"receive_time":null,"browser":null,"creator":null,"domain":null,"har_url":"https://s3.amazonaws.com/checkdata.rigor.com/49.harp","entry_count":null,"error_count":null,"dom_load_time":null,"page_load_time":null,"server_time":null,"page_size":null,"client_error_count":null,"server_error_count":null,"connection_error_count":null,"created_at":"2013-12-09T22:40:54Z","updated_at":"2013-12-09T22:40:54Z","started_date_time":null,"account_id":1,"check_id":1,"check_run_history_id":1,"location_id":1,"image_count":null,"javascript_count":null,"css_count":null,"html_count":null,"flash_count":null,"other_count":null,"run_record_id":null}},"results":[{"key":"har_records","id":"1940"}]}'
|
12
|
+
end
|
13
|
+
|
14
|
+
get '/api/v1/har_records/check_id=1' do
|
15
|
+
'{"count":1,"har_records":{"1941":{"id":"1941","source_url":null,"wait_time":null,"dns_time":null,"send_time":null,"connect_time":null,"blocked_time":null,"receive_time":null,"browser":null,"creator":null,"domain":null,"har_url":"https://s3.amazonaws.com/checkdata.rigor.com/50.harp","entry_count":null,"error_count":null,"dom_load_time":null,"page_load_time":null,"server_time":null,"page_size":null,"client_error_count":null,"server_error_count":null,"connection_error_count":null,"created_at":"2013-12-09T22:40:54Z","updated_at":"2013-12-09T22:40:54Z","started_date_time":null,"account_id":1,"check_id":1,"check_run_history_id":1,"location_id":1,"image_count":null,"javascript_count":null,"css_count":null,"html_count":null,"flash_count":null,"other_count":null,"run_record_id":null}},"results":[{"key":"har_records","id":"1941"}]}'
|
16
|
+
end
|
17
|
+
|
18
|
+
get '/api/v1/har_records/check_run_history_id=1' do
|
19
|
+
'{"count":1,"har_records":{"1937":{"id":"1937","source_url":null,"wait_time":null,"dns_time":null,"send_time":null,"connect_time":null,"blocked_time":null,"receive_time":null,"browser":null,"creator":null,"domain":null,"har_url":"https://s3.amazonaws.com/checkdata.rigor.com/46.harp","entry_count":null,"error_count":null,"dom_load_time":null,"page_load_time":null,"server_time":null,"page_size":null,"client_error_count":null,"server_error_count":null,"connection_error_count":null,"created_at":"2013-12-09T22:40:54Z","updated_at":"2013-12-09T22:40:54Z","started_date_time":null,"account_id":1,"check_id":1,"check_run_history_id":1,"location_id":1,"image_count":null,"javascript_count":null,"css_count":null,"html_count":null,"flash_count":null,"other_count":null,"run_record_id":null}},"results":[{"key":"har_records","id":"1937"}]}'
|
20
|
+
end
|
21
|
+
|
22
|
+
get '/api/v1/har_records/start=2013-11-11&end=2013-11-21' do
|
23
|
+
'{"count":1,"har_records":{"1936":{"id":"1936","source_url":null,"wait_time":null,"dns_time":null,"send_time":null,"connect_time":null,"blocked_time":null,"receive_time":null,"browser":null,"creator":null,"domain":null,"har_url":"https://s3.amazonaws.com/checkdata.rigor.com/45.harp","entry_count":null,"error_count":null,"dom_load_time":null,"page_load_time":null,"server_time":null,"page_size":null,"client_error_count":null,"server_error_count":null,"connection_error_count":null,"created_at":"2013-12-09T22:40:54Z","updated_at":"2013-12-09T22:40:54Z","started_date_time":null,"account_id":1,"check_id":1,"check_run_history_id":1,"location_id":1,"image_count":null,"javascript_count":null,"css_count":null,"html_count":null,"flash_count":null,"other_count":null,"run_record_id":null}},"results":[{"key":"har_records","id":"1936"}]}'
|
24
|
+
end
|
25
|
+
|
26
|
+
get '/api/v1/har_records/location_id=1' do
|
27
|
+
'{"count":1,"har_records":{"1939":{"id":"1939","source_url":null,"wait_time":null,"dns_time":null,"send_time":null,"connect_time":null,"blocked_time":null,"receive_time":null,"browser":null,"creator":null,"domain":null,"har_url":"https://s3.amazonaws.com/checkdata.rigor.com/48.harp","entry_count":null,"error_count":null,"dom_load_time":null,"page_load_time":null,"server_time":null,"page_size":null,"client_error_count":null,"server_error_count":null,"connection_error_count":null,"created_at":"2013-12-09T22:40:54Z","updated_at":"2013-12-09T22:40:54Z","started_date_time":null,"account_id":1,"check_id":1,"check_run_history_id":1,"location_id":1,"image_count":null,"javascript_count":null,"css_count":null,"html_count":null,"flash_count":null,"other_count":null,"run_record_id":null}},"results":[{"key":"har_records","id":"1939"}]}'
|
28
|
+
end
|
29
|
+
|
30
|
+
get '/api/v1/har_records' do
|
31
|
+
'{"count":1,"har_records":{"1938":{"id":"1938","source_url":null,"wait_time":null,"dns_time":null,"send_time":null,"connect_time":null,"blocked_time":null,"receive_time":null,"browser":null,"creator":null,"domain":null,"har_url":"https://s3.amazonaws.com/checkdata.rigor.com/47.harp","entry_count":null,"error_count":null,"dom_load_time":null,"page_load_time":null,"server_time":null,"page_size":null,"client_error_count":null,"server_error_count":null,"connection_error_count":null,"created_at":"2013-12-09T22:40:54Z","updated_at":"2013-12-09T22:40:54Z","started_date_time":null,"account_id":1,"check_id":1,"check_run_history_id":1,"location_id":1,"image_count":null,"javascript_count":null,"css_count":null,"html_count":null,"flash_count":null,"other_count":null,"run_record_id":null}},"results":[{"key":"har_records","id":"1938"}]}'
|
32
|
+
end
|
33
|
+
|
34
|
+
get '/api/v1/har_records/per_page=1&page=1' do
|
35
|
+
'{"count":1,"har_records":{"1935":{"id":"1935","source_url":null,"wait_time":null,"dns_time":null,"send_time":null,"connect_time":null,"blocked_time":null,"receive_time":null,"browser":null,"creator":null,"domain":null,"har_url":"https://s3.amazonaws.com/checkdata.rigor.com/44.harp","entry_count":null,"error_count":null,"dom_load_time":null,"page_load_time":null,"server_time":null,"page_size":null,"client_error_count":null,"server_error_count":null,"connection_error_count":null,"created_at":"2013-12-09T22:40:54Z","updated_at":"2013-12-09T22:40:54Z","started_date_time":null,"account_id":1,"check_id":1,"check_run_history_id":1,"location_id":1,"image_count":null,"javascript_count":null,"css_count":null,"html_count":null,"flash_count":null,"other_count":null,"run_record_id":null}},"results":[{"key":"har_records","id":"1935"}]}'
|
36
|
+
end
|
37
|
+
|
38
|
+
post 'api/v1/har_records_bulk' do
|
39
|
+
'{"job_id":"b48c6bd17724fd2324a97f4b"}'
|
40
|
+
end
|
41
|
+
|
42
|
+
delete 'api/v1/har_records_bulk/destroy_by_account_id' do
|
43
|
+
'{"job_id":"997743e056e5d75ef0a142b4"}'
|
44
|
+
end
|
45
|
+
|
46
|
+
delete 'api/v1/har_records_bulk/destroy_by_check_id' do
|
47
|
+
'{"job_id":"d29dcc8754dc997a182f15b5"}'
|
48
|
+
end
|
49
|
+
|
@@ -1,26 +1,46 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe DVR::Configuration do
|
4
|
-
|
4
|
+
def test_path(path)
|
5
|
+
File.exists?(path)
|
6
|
+
end
|
7
|
+
|
8
|
+
before :all do
|
9
|
+
@tmp_path = File.expand_path('../../tmp_dvr_destination', __FILE__)
|
10
|
+
tmp_dir = Dir.mkdir(@tmp_path)
|
11
|
+
@configuration = DVR.configure do |c|
|
12
|
+
c.destination = @tmp_path
|
13
|
+
c.recording_location = @tmp_path
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
after :all do
|
18
|
+
Dir.rmdir(@tmp_path)
|
19
|
+
end
|
20
|
+
|
5
21
|
describe 'default options' do
|
6
22
|
it 'uses filesystem as the episode source' do
|
7
|
-
expect(
|
23
|
+
expect(@configuration.episode_source).to eq(:filesystem)
|
8
24
|
end
|
9
25
|
|
10
26
|
it 'uses rspec api documentation as the episode format' do
|
11
|
-
expect(
|
27
|
+
expect(@configuration.episode_format).to eq(:rspec_api_documentation)
|
12
28
|
end
|
13
29
|
|
14
30
|
it 'has no default location from which to record episodes' do
|
15
|
-
expect(
|
31
|
+
expect(@configuration.episode_location).to be_nil
|
16
32
|
end
|
17
33
|
|
18
34
|
it 'has a destination directory to record to' do
|
19
|
-
expect(
|
35
|
+
expect(test_path(@configuration.destination)).to be_true
|
20
36
|
end
|
21
37
|
|
22
38
|
it 'has a server name to use for the recorded file' do
|
23
|
-
expect(
|
39
|
+
expect(@configuration.filename).to be_a(String)
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'has a recording location to use for playback' do
|
43
|
+
expect(test_path(@configuration.recording_location)).to be_true
|
24
44
|
end
|
25
45
|
end
|
26
46
|
|
data/spec/dvr/season_spec.rb
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe DVR::Season do
|
4
|
-
before
|
4
|
+
before :all do
|
5
|
+
@destination_path = File.expand_path('../../tmp_dvr_dir', __FILE__)
|
6
|
+
tmp_dir = Dir.mkdir(@destination_path)
|
7
|
+
DVR.configure {|c| c.destination = @destination_path }
|
8
|
+
end
|
9
|
+
|
10
|
+
after :all do
|
11
|
+
Dir.rmdir(@destination_path)
|
12
|
+
end
|
5
13
|
|
6
14
|
let(:content) { JSON.parse(File.open(example_request_file).read) }
|
7
15
|
let(:episode) { DVR::Episode.new(content) }
|
data/spec/dvr_spec.rb
CHANGED
@@ -7,6 +7,20 @@ module Kernel
|
|
7
7
|
end
|
8
8
|
|
9
9
|
describe DVR do
|
10
|
+
|
11
|
+
before :all do
|
12
|
+
@tmp_path = File.expand_path('../../tmp_dvr_destination', __FILE__)
|
13
|
+
tmp_dir = Dir.mkdir(@tmp_path)
|
14
|
+
@configuration = DVR.configure do |c|
|
15
|
+
c.destination = @tmp_path
|
16
|
+
c.recording_location = @tmp_path
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
after :all do
|
21
|
+
Dir.rmdir(@tmp_path)
|
22
|
+
end
|
23
|
+
|
10
24
|
describe '#play' do
|
11
25
|
it 'plays back a recorded server' do
|
12
26
|
expect(DVR.play).to eq("bundle exec ruby #{DVR.configuration.recording_location}")
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dvr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kyle Conarro
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- Rakefile
|
135
135
|
- bin/dvr
|
136
136
|
- dvr.gemspec
|
137
|
+
- dvr/dvr_server.rb
|
137
138
|
- lib/dvr.rb
|
138
139
|
- lib/dvr/cli.rb
|
139
140
|
- lib/dvr/cli/app.rb
|
@@ -142,6 +143,7 @@ files:
|
|
142
143
|
- lib/dvr/recorder.rb
|
143
144
|
- lib/dvr/season.rb
|
144
145
|
- lib/dvr/version.rb
|
146
|
+
- my_downloads/dvr_server.rb
|
145
147
|
- spec/dvr/configuration_spec.rb
|
146
148
|
- spec/dvr/episode_spec.rb
|
147
149
|
- spec/dvr/recorder_spec.rb
|