convertr 0.0.1 → 0.0.2

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/Rakefile CHANGED
@@ -36,6 +36,7 @@ begin
36
36
  test.libs << 'test'
37
37
  test.pattern = 'test/**/test_*.rb'
38
38
  test.verbose = true
39
+ test.rcov_opts = ['-x gems']
39
40
  end
40
41
  rescue LoadError
41
42
  task :rcov do
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{convertr}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ilya Lityuga", "Alexander Svetkin"]
12
- s.date = %q{2010-10-12}
12
+ s.date = %q{2010-10-13}
13
13
  s.default_executable = %q{convertr}
14
14
  s.description = %q{Convertr works with database and handles converting tasks. It fetches files from remote sources and converts them to appropriate formats with ffmpeg}
15
15
  s.email = %q{ilya.lityuga@gmail.com}
@@ -47,9 +47,12 @@ Gem::Specification.new do |s|
47
47
  "test/settings.yml",
48
48
  "test/test_convertor.rb",
49
49
  "test/test_file.rb",
50
+ "test/test_runner.rb",
51
+ "test/test_scheduler.rb",
50
52
  "test/test_scheduler_allbtfirst.rb",
51
53
  "test/test_scheduler_factory.rb",
52
- "test/test_task.rb"
54
+ "test/test_task.rb",
55
+ "test/test_version.rb"
53
56
  ]
54
57
  s.homepage = %q{http://github.com/tulaman/convertr}
55
58
  s.rdoc_options = ["--charset=UTF-8"]
@@ -58,12 +61,15 @@ Gem::Specification.new do |s|
58
61
  s.rubygems_version = %q{1.3.7}
59
62
  s.summary = %q{Useful utility for converting video files with ffmpeg}
60
63
  s.test_files = [
61
- "test/factories/files.rb",
64
+ "test/test_version.rb",
65
+ "test/test_runner.rb",
66
+ "test/factories/files.rb",
62
67
  "test/factories/tasks.rb",
63
68
  "test/test_scheduler_allbtfirst.rb",
64
69
  "test/test_scheduler_factory.rb",
65
70
  "test/test_file.rb",
66
71
  "test/helper.rb",
72
+ "test/test_scheduler.rb",
67
73
  "test/test_task.rb",
68
74
  "test/test_convertor.rb"
69
75
  ]
@@ -10,7 +10,7 @@ module Convertr
10
10
  module Version
11
11
  class << self
12
12
  def to_s
13
- File.read( File.join(File.dirname(__FILE__), '..', 'VERSION') ).chomp
13
+ ::File.read( ::File.join(::File.dirname(__FILE__), '..', 'VERSION') ).chomp
14
14
  end
15
15
  end
16
16
  end
@@ -8,7 +8,6 @@ module Convertr
8
8
  options.db_config_file = "~/.convertr/database.yml"
9
9
  options.settings_file = "~/.convertr/settings.yml"
10
10
  options.max_tasks = 0
11
- options.force_reset_database = false
12
11
  opts = OptionParser.new do |opts|
13
12
  opts.banner = "Usage: convertr [options]"
14
13
  opts.separator ""
@@ -28,11 +27,6 @@ module Convertr
28
27
  "Specify the maximum tasks to complete") do |m|
29
28
  options.max_tasks = m
30
29
  end
31
-
32
- opts.on("-f", "--force",
33
- "Force recreating database tables") do |f|
34
- options.force = f
35
- end
36
30
  end
37
31
  opts.parse!(args)
38
32
  options
@@ -42,12 +36,12 @@ module Convertr
42
36
  attr_reader :db_config, :config, :options
43
37
 
44
38
  def initialize(opts) # {{{
45
- config = Convertr::Runner::OptParser.parse(opts)
46
- Convertr.configure(config)
39
+ @config = Convertr::Runner::OptParser.parse(opts)
40
+ Convertr.configure(@config)
47
41
  end
48
42
  # }}}
49
43
  def run # {{{
50
- puts "Running"
44
+ Convertr::Convertor.new(@config.max_tasks).run
51
45
  end # }}}
52
46
  end
53
47
  end
@@ -14,7 +14,7 @@ module Convertr
14
14
 
15
15
  private
16
16
 
17
- def get_task_for_schedule # abstract
17
+ def get_task_for_schedule(convertor) # abstract
18
18
  raise "Should be overriden"
19
19
  end
20
20
 
@@ -16,12 +16,15 @@ class TestFile < Test::Unit::TestCase
16
16
  end
17
17
  context "File" do
18
18
  setup do
19
- @file = Convertr::File.new
19
+ @file = Factory.build(:file, :aspect => '16:9')
20
20
  end
21
21
  subject { @file }
22
22
  should have_many(:tasks)
23
23
  should "be valid" do
24
24
  assert @file.valid?
25
25
  end
26
+ should "be able to calculate aspect ratio as float" do
27
+ assert_in_delta 1.777, @file.float_aspect, 0.001
28
+ end
26
29
  end
27
30
  end
@@ -0,0 +1,17 @@
1
+ require 'test/helper'
2
+
3
+ class TestRunner < Test::Unit::TestCase
4
+ context "Runner" do
5
+ setup do
6
+ @runner = Convertr::Runner.new(%w{
7
+ -d test/database.yml -c test/settings.yml -m 10
8
+ })
9
+ end
10
+ should "should parse arguments from command line" do
11
+ c = Convertr::Config.instance
12
+ assert_equal 'test/database.yml', c.db_config_file
13
+ assert_equal 'test/settings.yml', c.settings_file
14
+ assert_equal 10, c.max_tasks
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,14 @@
1
+ require 'test/helper'
2
+
3
+ class TestScheduler < Test::Unit::TestCase
4
+ context "Base Scheduler" do
5
+ setup do
6
+ @scheduler = Convertr::Scheduler::Base.new
7
+ end
8
+ should "raise exception on calling abstract methods" do
9
+ assert_raise RuntimeError do
10
+ @scheduler.instance_eval { get_task_for_schedule('convertor1') }
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ require 'test/helper'
2
+
3
+ class TestVersion < Test::Unit::TestCase
4
+ context "Convertr::Version" do
5
+ setup do
6
+ @version = File.read('VERSION').chomp
7
+ end
8
+ should "return valid version" do
9
+ assert_equal @version, "#{Convertr::Version}"
10
+ end
11
+ end
12
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: convertr
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ilya Lityuga
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-10-12 00:00:00 +04:00
19
+ date: 2010-10-13 00:00:00 +04:00
20
20
  default_executable: convertr
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -115,9 +115,12 @@ files:
115
115
  - test/settings.yml
116
116
  - test/test_convertor.rb
117
117
  - test/test_file.rb
118
+ - test/test_runner.rb
119
+ - test/test_scheduler.rb
118
120
  - test/test_scheduler_allbtfirst.rb
119
121
  - test/test_scheduler_factory.rb
120
122
  - test/test_task.rb
123
+ - test/test_version.rb
121
124
  has_rdoc: true
122
125
  homepage: http://github.com/tulaman/convertr
123
126
  licenses: []
@@ -153,11 +156,14 @@ signing_key:
153
156
  specification_version: 3
154
157
  summary: Useful utility for converting video files with ffmpeg
155
158
  test_files:
159
+ - test/test_version.rb
160
+ - test/test_runner.rb
156
161
  - test/factories/files.rb
157
162
  - test/factories/tasks.rb
158
163
  - test/test_scheduler_allbtfirst.rb
159
164
  - test/test_scheduler_factory.rb
160
165
  - test/test_file.rb
161
166
  - test/helper.rb
167
+ - test/test_scheduler.rb
162
168
  - test/test_task.rb
163
169
  - test/test_convertor.rb