csd 0.1.9 → 0.1.10

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.
Files changed (48) hide show
  1. data/.gitignore +5 -1
  2. data/Rakefile +7 -7
  3. data/VERSION +1 -1
  4. data/bin/ai +1 -1
  5. data/csd.gemspec +21 -9
  6. data/lib/csd.rb +15 -8
  7. data/lib/csd/application/decklink.rb +27 -0
  8. data/lib/csd/application/decklink/about.yml +7 -0
  9. data/lib/csd/application/decklink/base.rb +62 -0
  10. data/lib/csd/application/default.rb +5 -1
  11. data/lib/csd/application/default/base.rb +10 -0
  12. data/lib/csd/application/minisip.rb +8 -5
  13. data/lib/csd/application/minisip/about.yml +1 -1
  14. data/lib/csd/application/minisip/base.rb +29 -90
  15. data/lib/csd/application/minisip/component.rb +8 -0
  16. data/lib/csd/application/minisip/component/core.rb +288 -0
  17. data/lib/csd/application/minisip/component/ffmpeg.rb +78 -0
  18. data/lib/csd/application/minisip/component/gnome.rb +48 -0
  19. data/lib/csd/application/minisip/component/hdviper.rb +49 -0
  20. data/lib/csd/application/minisip/component/plugins.rb +53 -0
  21. data/lib/csd/application/minisip/component/x264.rb +42 -0
  22. data/lib/csd/application/minisip/error.rb +11 -5
  23. data/lib/csd/application/minisip/options/common.rb +4 -4
  24. data/lib/csd/application/minisip/options/compile.rb +10 -16
  25. data/lib/csd/application/minisip/unix.rb +19 -159
  26. data/lib/csd/application/minisip/unix/darwin.rb +1 -11
  27. data/lib/csd/application/minisip/unix/linux.rb +1 -1
  28. data/lib/csd/application/minisip/unix/linux/debian.rb +6 -14
  29. data/lib/csd/application/minisip/unix/linux/debian/ubuntu10.rb +6 -4
  30. data/lib/csd/applications.rb +16 -21
  31. data/lib/csd/commands.rb +34 -7
  32. data/lib/csd/error.rb +27 -11
  33. data/lib/csd/extensions/core/kernel.rb +9 -19
  34. data/lib/csd/extensions/core/object.rb +1 -0
  35. data/lib/csd/extensions/core/string.rb +1 -1
  36. data/lib/csd/extensions/gem/platform.rb +9 -3
  37. data/lib/csd/options_parser.rb +3 -3
  38. data/lib/csd/user_interface/base.rb +8 -5
  39. data/lib/csd/user_interface/cli.rb +9 -1
  40. data/lib/csd/user_interface/silent.rb +7 -4
  41. data/lib/csd/vendor/zentest/zentest_assertions.rb +39 -35
  42. data/test/application/test_minisip.rb +65 -26
  43. data/test/functional/test_applications.rb +4 -4
  44. data/test/functional/test_commands.rb +26 -2
  45. data/test/helper.rb +9 -5
  46. data/test/unit/test_pathname.rb +1 -1
  47. data/test/unit/test_platform.rb +30 -0
  48. metadata +18 -6
@@ -1,17 +1,18 @@
1
1
  require 'helper'
2
2
  require 'csd/application/minisip'
3
3
 
4
- class TestDir < Test::Unit::TestCase
4
+ class TestMinisip < Test::Unit::TestCase
5
5
 
6
6
  include CSD
7
+ include Application::Minisip::Component
7
8
 
8
- context "The Minisip Base application" do
9
-
9
+ context "The MiniSIP instance" do
10
+
10
11
  setup do
11
12
  ARGV.clear
12
13
  Options.clear
13
14
  ARGV.push(@name)
14
- Applications.current!
15
+ Applications.current
15
16
  @app = Application::Minisip::Base.new
16
17
  end
17
18
 
@@ -19,32 +20,70 @@ class TestDir < Test::Unit::TestCase
19
20
  assert @app.respond_to?(:compile)
20
21
  end
21
22
 
22
- should "know how to identify and sort a subset of internal MiniSIP libraries with --only" do
23
- Options.only = nil
24
- assert_equal Application::Minisip::Base::LIBRARIES, @app.libraries
25
- Options.only = %w{ libmcrypto }
26
- assert_equal %w{ libmcrypto }, @app.libraries
27
- Options.only = %w{ does-not-exist }
28
- assert @app.libraries == []
29
- Options.only = Application::Minisip::Base::LIBRARIES
30
- assert_equal Application::Minisip::Base::LIBRARIES, @app.libraries
31
- Options.only = %w{ minisip libmutil }
32
- assert_equal %w{ libmutil minisip }, @app.libraries
33
- end
34
-
23
+ context "in the Core component" do
35
24
 
25
+ setup do
26
+ Options.clear
27
+ end
36
28
 
29
+ should "know how to identify and sort a subset of internal MiniSIP libraries with --only" do
30
+ Options.only = nil
31
+ assert_equal Core::LIBRARIES, Core.libraries
32
+ Options.only = %w{ libmcrypto }
33
+ assert_equal %w{ libmcrypto }, Core.libraries
34
+ Options.only = %w{ does-not-exist }
35
+ assert Core.libraries == []
36
+ Options.only = Core::LIBRARIES
37
+ assert_equal Core::LIBRARIES, Core.libraries
38
+ Options.only = %w{ minisip libmutil }
39
+ assert_equal %w{ libmutil minisip }, Core.libraries
40
+ end
37
41
 
42
+ context "in theory" do
38
43
 
44
+ setup do
45
+ Options.clear
46
+ Options.reveal = true
47
+ end
48
+
49
+ should "know how to checkout the default branch of the source code" do
50
+ out, err = capture { Core.checkout }
51
+ assert_match /git clone /, out
52
+ assert_no_match /git pull/, out
53
+ assert err.empty?
54
+ end
55
+
56
+ should "know how to checkout a particular branch of the source code" do
57
+ Options.branch = 'cuttingedge'
58
+ out, err = capture { Core.checkout }
59
+ assert_match /git clone /, out
60
+ assert_match /git pull .+ cuttingedge/, out
61
+ assert err.empty?
62
+ end
63
+
64
+ should "use sudo make install instead of make install by default" do
65
+ Options.make_install = true
66
+ out, err = capture { Core.compile }
67
+ # TODO: This should be a more strict test
68
+ assert_match /sudo make install/, out
69
+ end
70
+
71
+ end # context "in theory"
72
+
73
+ context "in practice" do
74
+
75
+ if ONLINE
76
+
77
+ setup do
78
+ Options.clear
79
+ end
80
+
81
+ end # if ONLINE
82
+
83
+ end # context "in practice"
84
+
85
+ end # context "The Minisip Core component"
39
86
 
40
- context "when downloading source code" do
41
-
42
- should "dummy" do
43
- assert true
44
- end
45
-
46
- end # context "when downloading source code"
47
-
48
- end # context "The Minisip application"
87
+ end # context "The MiniSIP instance"
49
88
 
50
89
  end
@@ -25,27 +25,27 @@ class TestApplications < Test::Unit::TestCase
25
25
 
26
26
  should "find an application in the first argument" do
27
27
  ARGV.push(@name)
28
- assert_equal @name, Applications.current!.name
28
+ assert_equal @name, Applications.current.name
29
29
  end
30
30
 
31
31
  should "find an application in the second argument" do
32
32
  ARGV.push('dummy')
33
33
  ARGV.push(@name)
34
- assert_equal @name, Applications.current!.name
34
+ assert_equal @name, Applications.current.name
35
35
  end
36
36
 
37
37
  should "find an application in the third argument" do
38
38
  ARGV.push('foo')
39
39
  ARGV.push('bar')
40
40
  ARGV.push(@name)
41
- assert_equal @name, Applications.current!.name
41
+ assert_equal @name, Applications.current.name
42
42
  end
43
43
 
44
44
  should "set nothing, if there is no valid app" do
45
45
  ARGV.push('foo')
46
46
  ARGV.push('bar')
47
47
  ARGV.push('bob')
48
- assert !Applications.current!
48
+ assert !Applications.current
49
49
  end
50
50
 
51
51
  end # context "the find function"
@@ -320,7 +320,31 @@ That we in truth can nothing know!}
320
320
  assert_equal '', err
321
321
  end
322
322
 
323
- context "in verbose mode" do
323
+ context "and in reveal mode" do
324
+
325
+ setup do
326
+ Options.reveal = true
327
+ end
328
+
329
+ should "not really execute the command but announce something" do
330
+ out, err = capture do
331
+ assert_kind_of(CommandResult, result = Cmd.run('/this/will//definitely/break/if/executed'))
332
+ assert result.success?
333
+ end
334
+ assert !out.empty?
335
+ end
336
+
337
+ should "still execute the command if force_in_reveal is true" do
338
+ out, err = capture do
339
+ assert_kind_of(CommandResult, result = Cmd.run('/this/will//definitely/break/if/executed', :die_on_failure => false, :force_in_reveal => true))
340
+ assert !result.success?
341
+ end
342
+ assert !out.empty?
343
+ end
344
+
345
+ end
346
+
347
+ context "and in verbose mode" do
324
348
 
325
349
  setup do
326
350
  Options.verbose = true
@@ -335,7 +359,7 @@ That we in truth can nothing know!}
335
359
  assert_equal '', err
336
360
  end
337
361
 
338
- end # context "in verbose mode"
362
+ end # context "and in verbose mode"
339
363
 
340
364
  end # context "in normal mode"
341
365
 
@@ -2,19 +2,23 @@ require 'rubygems'
2
2
  require 'test/unit'
3
3
  require 'tmpdir'
4
4
  require 'shoulda'
5
- require 'redgreen'
5
+ begin
6
+ require 'redgreen'
7
+ rescue LoadError
8
+ # Does not work on Ruby 1.9.1, but it is not really needed
9
+ end
6
10
 
7
11
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
8
12
  $LOAD_PATH.unshift(File.dirname(__FILE__))
9
13
  require 'csd'
10
14
  require 'csd/vendor/zentest/zentest_assertions'
11
15
 
16
+ # This will cause tests to be executed which require Internet connection
17
+ ONLINE = system 'ping -c 1 www.google.com'
18
+ puts "WARNING:".red.blink + " Tests which require Internet connectivity will not be executed!".red unless ONLINE
19
+
12
20
  class Test::Unit::TestCase
13
21
 
14
- # This will cause tests to be executed which require Internet connection
15
- #
16
- ONLINE = true
17
-
18
22
  # Even though the CSD library offers this function as an Kernel extension, we override it here.
19
23
  # It must be guaranteed it works during running the tests.
20
24
  #
@@ -6,7 +6,7 @@ class TestPathname < Test::Unit::TestCase
6
6
  context "A normal Pathname object" do
7
7
 
8
8
  should "be enquotable" do
9
- assert_equal '"/"', Pathname.new('/').enquote
9
+ assert_equal '/'.enquote, Pathname.new('/').enquote
10
10
  end
11
11
 
12
12
  should "know if its the current pwd or not (regardless of the requested directory actually existing)" do
@@ -0,0 +1,30 @@
1
+ require 'helper'
2
+
3
+ class TestPlatform < Test::Unit::TestCase
4
+
5
+ include CSD
6
+
7
+ context "A Gem::Platform object for this machine" do
8
+
9
+ setup do
10
+ Options.clear
11
+ end
12
+
13
+ should "try to get kernel information if this is linux even in reveal mode" do
14
+ if Gem::Platform.local.os == 'linux'
15
+ Options.reveal = true
16
+ assert Gem::Platform.local.kernel_release
17
+ assert Gem::Platform.local.kernel_version
18
+ end
19
+ end
20
+
21
+ should "know whether it's debian or not" do
22
+ assert !Gem::Platform.local.debian? if Gem::Platform.local.os == 'darwin'
23
+ # TODO: This is not the best way to determine debian or red hat
24
+ assert Gem::Platform.local.debian? if Gem::Platform.local.os == 'linux' and Cmd.run('which dpkg', :internal => true, :die_on_failure => false).success?
25
+ assert !Gem::Platform.local.debian? if Gem::Platform.local.os == 'linux' and Cmd.run('which rpm', :internal => true, :die_on_failure => false).success?
26
+ end
27
+
28
+ end
29
+
30
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csd
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 9
10
- version: 0.1.9
9
+ - 10
10
+ version: 0.1.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Technology Transfer Alliance Team
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-29 00:00:00 +02:00
18
+ date: 2010-08-03 00:00:00 +02:00
19
19
  default_executable: ai
20
20
  dependencies: []
21
21
 
@@ -38,11 +38,21 @@ files:
38
38
  - csd.gemspec
39
39
  - lib/csd.rb
40
40
  - lib/csd/application.rb
41
+ - lib/csd/application/decklink.rb
42
+ - lib/csd/application/decklink/about.yml
43
+ - lib/csd/application/decklink/base.rb
41
44
  - lib/csd/application/default.rb
42
45
  - lib/csd/application/default/base.rb
43
46
  - lib/csd/application/minisip.rb
44
47
  - lib/csd/application/minisip/about.yml
45
48
  - lib/csd/application/minisip/base.rb
49
+ - lib/csd/application/minisip/component.rb
50
+ - lib/csd/application/minisip/component/core.rb
51
+ - lib/csd/application/minisip/component/ffmpeg.rb
52
+ - lib/csd/application/minisip/component/gnome.rb
53
+ - lib/csd/application/minisip/component/hdviper.rb
54
+ - lib/csd/application/minisip/component/plugins.rb
55
+ - lib/csd/application/minisip/component/x264.rb
46
56
  - lib/csd/application/minisip/error.rb
47
57
  - lib/csd/application/minisip/options/common.rb
48
58
  - lib/csd/application/minisip/options/compile.rb
@@ -93,14 +103,15 @@ files:
93
103
  - test/unit/test_dir.rb
94
104
  - test/unit/test_open_struct.rb
95
105
  - test/unit/test_pathname.rb
106
+ - test/unit/test_platform.rb
96
107
  - test/unit/test_string.rb
97
108
  has_rdoc: true
98
109
  homepage: http://github.com/csd/csd
99
110
  licenses: []
100
111
 
101
112
  post_install_message: "\n\
102
- ============================================================\n\n Thank you for installing the TTA Automated Installer!\n\n You can run it by typing `tta\xC2\xB4 in your command line.\n\n NOTE: On DEBIAN and UBUNTU the executable `tta\xC2\xB4 is *maybe*\n not in your PATH by default. If that is the case,\n you can fix it by running this command:\n\n echo \"export PATH=\\$PATH:$(gem env | grep \"E D\" | sed \"s/[^\\w]* //\")\" >> ~/.bashrc;. ~/.bashrc\n\n\
103
- ============================================================\n "
113
+ ============================================================\n\n Thank you for installing the TTA Automated Installer!\n\n You can run it by typing `ai\xC2\xB4 in your command line.\n\n NOTE: On DEBIAN and UBUNTU the executable `ai\xC2\xB4 is *maybe*\n not in your PATH by default. If that is the case,\n you can fix it by running this command:\n\n echo \"export PATH=\\$PATH:$(gem env | grep \"E D\" | sed \"s/[^\\w]* //\")\" >> ~/.bashrc;. ~/.bashrc\n\n\
114
+ ============================================================\n"
104
115
  rdoc_options:
105
116
  - --charset=UTF-8
106
117
  require_paths:
@@ -144,4 +155,5 @@ test_files:
144
155
  - test/unit/test_dir.rb
145
156
  - test/unit/test_open_struct.rb
146
157
  - test/unit/test_pathname.rb
158
+ - test/unit/test_platform.rb
147
159
  - test/unit/test_string.rb