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
@@ -0,0 +1,53 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ module CSD
4
+ module Application
5
+ module Minisip
6
+ module Component
7
+ module Plugins
8
+ class << self
9
+
10
+ def compile
11
+ UI.debug "#{self}.compile was called"
12
+ if Path.plugins.directory? and !Options.reveal
13
+ UI.warn "The optional MiniSIP plugins will not be installed, because the directory #{Path.plugins.enquote} already exists."
14
+ else
15
+ checkout
16
+ copy
17
+ end
18
+ end
19
+
20
+ def introduction
21
+ end
22
+
23
+ def checkout
24
+ Cmd.git_clone('additional MiniSIP plugins', 'http://github.com/csd/minisip-plugins.git', Path.plugins)
25
+ end
26
+
27
+ # Copies the plugins from the repository to the final destination.
28
+ #
29
+ def copy
30
+ if Path.plugins_destination.directory?
31
+ UI.info "Installing optional MiniSIP plugins".green.bold
32
+ UI.info "Copying from `#{Path.plugins_destination}´ to `#{Path.plugins}´".yellow
33
+ Dir[File.join(Path.plugins, '{md,mg,mvideo}*.{a,la,so}')].each do |plugin|
34
+ if Gem::Platform.local.os == 'linux' or Gem::Platform.local.os == 'darwin'
35
+ optional_sudo = Options.this_user ? '' : 'sudo '
36
+ UI.info " #{File.basename(plugin)}"
37
+ Cmd.run("#{optional_sudo}cp #{plugin} #{Path.plugins_destination}", :internal => true)
38
+ else
39
+ # On other platforms we will have to do this without superuser privileges for now
40
+ Cmd.copy(plugin, Path.plugins_destination)
41
+ end
42
+ end
43
+ else
44
+ UI.warn "The target plugin directory could not be found: #{Path.plugins_destination.enquote}".green.bold
45
+ end
46
+ end
47
+
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,42 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ module CSD
4
+ module Application
5
+ module Minisip
6
+ module Component
7
+ module X264
8
+ class << self
9
+
10
+ def compile
11
+ UI.debug "#{self}.compile was called"
12
+ if Path.x264_repository.directory? and !Options.reveal
13
+ UI.warn "x264 will not be processed, because the directory #{Path.x264_repository.enquote} already exists."
14
+ else
15
+ checkout
16
+ make
17
+ end
18
+ end
19
+
20
+ def introduction
21
+ end
22
+
23
+ def checkout
24
+ Cmd.git_clone('x264 repository', 'http://github.com/csd/x264.git', Path.x264_repository)
25
+ end
26
+
27
+ # This method compiles x264, given that x264 was downloaded before.
28
+ #
29
+ def make
30
+ UI.info "Compiling and installing x264".green.bold
31
+ Cmd.cd Path.x264_repository, :internal => true
32
+ Cmd.run('./configure')
33
+ Cmd.run('make')
34
+ Cmd.run('sudo checkinstall --pkgname=x264 --pkgversion "99:-`git log -1 --pretty=format:%h`" --backup=no --default')
35
+ end
36
+
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -1,12 +1,18 @@
1
1
  # -*- encoding: UTF-8 -*-
2
- require File.join(File.dirname(__FILE__), '..', '..', 'error')
2
+ require 'csd/error'
3
3
 
4
4
  module CSD
5
5
  module Error
6
-
7
- module Options
8
- class PathNotFound < CSDError; status_code(200); end
6
+ module Minisip
7
+
8
+ # See 'csd/error' to find out which status code range has been assigned to MiniSIP
9
+
10
+ class BuildDirNotFound < CSDError; status_code(200); end
11
+
12
+ module Core
13
+ class FFmpegInstalled < CSDError; status_code(210); end
14
+ end
15
+
9
16
  end
10
-
11
17
  end
12
18
  end
@@ -2,12 +2,12 @@
2
2
 
3
3
  opts.headline 'WORKING DIRECTORY OPTIONS'.green.bold
4
4
 
5
- self.temp = false
6
- opts.on("-t", "--temp", "Use a system's temporary directory as working directory.") do |value|
7
- self.temp = value
5
+ self.temp = true
6
+ opts.on("--no-temp", "Use the current directory as working directory and not a system's temporary directory.") do |value|
7
+ self.temp = !value
8
8
  end
9
9
 
10
10
  self.work_dir = nil
11
- opts.on("--work-dir [PATH]", "Defines and/or creates the working directory. This will override the --temp option.") do |value|
11
+ opts.on("--work-dir [PATH]", "Defines and/or creates the working directory. This will override the --pwd option.") do |value|
12
12
  self.work_dir = value
13
13
  end
@@ -1,31 +1,25 @@
1
1
  # -*- encoding: UTF-8 -*-
2
2
  # This file gets eval'ed by the global options parser in lib/csd/options_parser
3
3
 
4
+ self.this_user = false
5
+ opts.on("--this-user","Compile MiniSIP not for all users (sudo), but only for the current user") do |value|
6
+ self.this_user = value
7
+ end
8
+
4
9
  self.apt_get = true
5
10
  opts.on("--no-apt-get","Don't run any apt-get commands") do |value|
6
11
  self.apt_get = value
7
12
  end
8
13
 
9
- #self.owner = nil
10
- #opts.on("-o", "--owner [OWNER]","Specify OWNER:GROUP for this operation") do |value|
11
- # if owner = value
12
- # chmod = owner.split(':')
13
- # self.owner = chmod.first
14
- # self.group = chmod.last
15
- # end
16
- #end
17
-
18
- self.only_fix_giomm = false
19
- opts.on("--only-fix-giomm","Forces the AI to do nothing except trying to bugfix the Ubuntu 10.04 giomm") do |value|
20
- self.only_fix_giomm = value
21
- end
22
-
23
14
  self.ffmpeg_first = false
24
- opts.on("--ffmpeg-first","Compile FFmpeg before compiling MiniSIP. Default is first MiniSIP.") do |value|
15
+ opts.on("--ffmpeg-first","Compile FFmpeg before compiling MiniSIP (default is first MiniSIP)") do |value|
25
16
  self.ffmpeg_first = value
26
17
  end
27
18
 
28
-
19
+ self.branch = nil
20
+ opts.on('--branch BRANCH', 'Choose another branch than `master´ when downloading the source code') do |lib|
21
+ self.branch = value
22
+ end
29
23
 
30
24
  opts.headline 'MINISIP LIBRARY OPTIONS'.green.bold
31
25
 
@@ -9,8 +9,11 @@ module CSD
9
9
  # This method presents a general overview about the task that is to be performed.
10
10
  #
11
11
  def introduction
12
- UI.separator
13
- UI.info " MiniSIP libraries to process: ".green + libraries.join(', ').yellow
12
+ Core.introduction
13
+ # FFmpeg.introduction
14
+ # HDVIPER.introduction
15
+ # X264.introduction
16
+ # Plugins.introduction
14
17
  super
15
18
  end
16
19
 
@@ -18,10 +21,10 @@ module CSD
18
21
  #
19
22
  def compile
20
23
  UI.separator
21
- UI.info "This operation will download and compile MiniSIP.".green.bold
24
+ UI.info "This operation will compile MiniSIP and its dependencies.".green.bold
25
+ UI.separator
22
26
  introduction
23
27
  compile!
24
- run_minisip_gtk_gui
25
28
  end
26
29
 
27
30
  # This method is called by the AI when the user requests the task "package" for MiniSIP.
@@ -33,166 +36,23 @@ module CSD
33
36
  package!
34
37
  end
35
38
 
36
- # This is the internal compile procedure for MiniSIP
39
+ # This is the internal compile procedure for MiniSIP and its components.
37
40
  #
38
41
  def compile!
39
- Cmd.mkdir Path.work
40
- make_hdviper unless checkout_hdviper.already_exists?
41
- modify_minisip unless checkout_minisip.already_exists?
42
- checkout_plugins
42
+ create_working_directory
43
+ HDVIPER.compile
43
44
  if Options.ffmpeg_first
44
- make_x264 unless checkout_x264.already_exists?
45
- unless checkout_ffmpeg.already_exists?
46
- modify_libavutil
47
- checkout_libswscale
48
- make_ffmpeg
49
- end
50
- make_minisip
45
+ X264.compile
46
+ FFmpeg.compile
47
+ Core.compile
51
48
  else
52
- make_minisip
53
- make_x264 unless checkout_x264.already_exists?
54
- unless checkout_ffmpeg.already_exists?
55
- checkout_libswscale
56
- make_ffmpeg
57
- end
58
- end
59
- copy_plugins
60
- end
61
-
62
- # This method compiles FFmpeg, given that FFmpeg was downloaded before.
63
- #
64
- def make_ffmpeg
65
- Cmd.cd Path.ffmpeg_repository, :internal => true
66
- Cmd.run('./configure --enable-gpl --enable-libx264 --enable-x11grab')
67
- Cmd.run('make')
68
- Cmd.run('sudo checkinstall --pkgname=ffmpeg --pkgversion "99:-`git log -1 --pretty=format:%h`" --backup=no --default')
69
- end
70
-
71
- # This method compiles x264, given that x264 was downloaded before.
72
- #
73
- def make_x264
74
- Cmd.cd Path.x264_repository, :internal => true
75
- Cmd.run('./configure')
76
- Cmd.run('make')
77
- Cmd.run('sudo checkinstall --pkgname=x264 --pkgversion "99:-`git log -1 --pretty=format:%h`" --backup=no --default')
78
- end
79
-
80
- # This method compiles HDVIPER, given that HDVIPER was downloaded before.
81
- #
82
- def make_hdviper
83
- Cmd.cd Path.hdviper_x264, :internal => true
84
- Cmd.run('./configure')
85
- Cmd.run('make')
86
- Cmd.cd Path.hdviper_x264_test_x264api, :internal => true
87
- Cmd.run('make')
88
- end
89
-
90
- # Creates all build directories such as +lib+, +share+, +bin+, etc.
91
- #
92
- def create_build_dir
93
- UI.info "Creating target build directories".green.bold
94
- [Path.build, Path.build_include, Path.build_lib, Path.build_share, Path.build_share_aclocal].each { |target| Cmd.mkdir target }
95
- end
96
-
97
- # Copies the plugins from the repository to the final destination.
98
- #
99
- def copy_plugins
100
- UI.info "Creating plugin target directory".green.bold
101
- # result = Path.plugins_destination.parent.directory? ? Cmd.run("sudo mkdir #{Path.plugins_destination}") : CommandResult.new
102
- # TODO: This will maybe need sudo rights in the future
103
- Cmd.copy(Dir[File.join(Path.plugins, '*.{l,la,so}')], Path.plugins_destination) if Path.plugins_destination.directory?
104
- end
105
-
106
- # Iteratively configures and compiles the internal MiniSIP libraries.
107
- #
108
- def make_minisip
109
- create_build_dir
110
- libraries.each do |library|
111
- directory = Pathname.new(File.join(Path.repository, library))
112
- next if Options.only and !Options.only.include?(library)
113
- if Cmd.cd(directory) or Options.reveal
114
- if Options.bootstrap
115
- UI.info "Bootstrapping #{library}".green.bold
116
- Cmd.run("./bootstrap -I #{Path.build_share_aclocal.enquote}")
117
- end
118
- if Options.configure
119
- UI.info "Configuring #{library}".green.bold
120
- individual_options = case library
121
- when 'libminisip'
122
- %Q{--enable-debug --enable-video --disable-mil --enable-decklink --enable-opengl --disable-sdl #{libminisip_c_flags} #{libminisip_cpp_flags} #{libminisip_ld_flags}}
123
- when 'minisip'
124
- %Q{--enable-debug --enable-video --enable-textui --enable-opengl}
125
- else
126
- ''
127
- end
128
- Cmd.run(%Q{./configure #{individual_options} --prefix=#{Path.build.enquote} PKG_CONFIG_PATH=#{Path.build_lib_pkg_config.enquote} ACLOCAL_FLAGS=#{Path.build_share_aclocal} LD_LIBRARY_PATH=#{Path.build_lib.enquote}})
129
- end
130
- if Options.make
131
- UI.info "Make #{library}".green.bold
132
- Cmd.run("make")
133
- end
134
- if Options.make_install
135
- UI.info "Make install #{library}".green.bold
136
- Cmd.run("make install")
137
- end
138
- else
139
- UI.warn "Skipping minisip library #{library} because it not be found: #{directory}".green.bold
140
- end
49
+ Core.compile
50
+ X264.compile
51
+ FFmpeg.compile
141
52
  end
142
- end
143
-
144
- # Iteratively makes debian packages of the internal MiniSIP libraries.
145
- #
146
- def package!
147
- Cmd.mkdir(Path.packaging)
148
- libraries.each do |library|
149
- directory = Pathname.new(File.join(Path.repository, library))
150
- next if Options.only and !Options.only.include?(library)
151
- UI.info "Making #{library} with target dist".green.bold
152
- if Cmd.cd(directory) or Options.reveal
153
- Cmd.run("make dist")
154
-
155
- tar_filename = File.basename(Dir[File.join(directory, '*.tar.gz')].first)
156
- Cmd.move(File.join(directory, tar_filename.to_s), Path.packaging) if tar_filename or Options.reveal
157
-
158
- if Cmd.cd(Path.packaging) or Options.reveal
159
- Cmd.run("tar -xzf #{tar_filename}")
160
- tar_dirname = File.basename(tar_filename.to_s, '.tar.gz')
161
- if Cmd.cd(File.join(Path.packaging, tar_dirname))
162
- Cmd.run("dpkg-buildpackage -rfakeroot")
163
- if library == 'minisip'
164
- if Cmd.cd(Path.packaging)
165
- package = File.basename(Dir[File.join(Path.packaging, "#{library}*.deb")].first)
166
- Cmd.run("sudo dpkg -i #{package}") if package or Options.reveal
167
- end
168
- else
169
- if Cmd.cd(Path.packaging)
170
- package = File.basename(Dir[File.join(Path.packaging, "#{library}0*.deb")].first)
171
- Cmd.run("sudo dpkg -i #{package}") if package or Options.reveal
172
- dev_package = File.basename(Dir[File.join(Path.packaging, "#{library}-dev*.deb")].first)
173
- Cmd.run("sudo dpkg -i #{dev_package}") if dev_package or Options.reveal
174
- end
175
- end
176
- else
177
- UI.error "Could not enter #{File.join(Path.packaging, tar_dirname)}."
178
- end
179
-
180
- else
181
- UI.error "Could not enter #{Path.packaging}."
182
- end
183
-
184
- else
185
- UI.error "Could not enter #{directory}."
186
- end
187
- end
188
- Cmd.cd '/'
189
- Cmd.run('minisip_gtk_gui')
190
- end
191
-
192
- # Executed the MiniSIP GTK GUI.
193
- #
194
- def run_minisip_gtk_gui
195
- Cmd.run(Path.build_gtkgui, :die_on_failure => false)
53
+ Plugins.compile
54
+ Gnome.compile
55
+ Core.run_gtkgui
196
56
  end
197
57
 
198
58
  end
@@ -1,20 +1,10 @@
1
1
  # -*- encoding: UTF-8 -*-
2
- require File.join(File.dirname(__FILE__), '..', 'unix')
2
+ require 'csd/application/minisip/unix'
3
3
 
4
4
  module CSD
5
5
  module Application
6
6
  module Minisip
7
7
  class Darwin < Unix
8
-
9
- def compile!
10
- Cmd.mkdir Path.work
11
- #checkout_hdviper
12
- #make_hdviper
13
- checkout_minisip
14
- modify_minisip
15
- checkout_plugins
16
- make_minisip
17
- end
18
8
 
19
9
  end
20
10
  end
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: UTF-8 -*-
2
- require File.join(File.dirname(__FILE__), '..', 'unix')
2
+ require 'csd/application/minisip/unix'
3
3
 
4
4
  module CSD
5
5
  module Application
@@ -11,33 +11,25 @@ module CSD
11
11
  DEBIAN_DEPENDENCIES = %w{ automake build-essential checkinstall git-core libasound2-dev libavcodec-dev libglademm-2.4-dev libgtkmm-2.4-dev libltdl3-dev libsdl-dev libsdl-ttf2.0-dev libssl-dev libtool libswscale-dev libx11-dev libxv-dev nasm subversion yasm }
12
12
 
13
13
  def compile!
14
- install_aptitude_dependencies if Options.apt_get
15
- after_aptitude_dependencies
14
+ aptitude if Options.apt_get
15
+ after_aptitude
16
16
  super
17
17
  end
18
18
 
19
- def after_aptitude_dependencies
19
+ def after_aptitude
20
20
  end
21
21
 
22
22
  def package!
23
- modify_libminisip_rules
23
+ Core.modify_libminisip_rules # TODO: Oursource into Component::Core
24
24
  super
25
25
  end
26
26
 
27
- def install_aptitude_dependencies
27
+ def aptitude
28
+ UI.info "Installing Debian dependencies".green.bold
28
29
  Cmd.run("sudo apt-get update")
29
30
  Cmd.run("sudo apt-get install #{DEBIAN_DEPENDENCIES.sort.join(' ')} --yes --fix-missing")
30
31
  end
31
32
 
32
- def modify_libminisip_rules
33
- if Path.repository_libminisip_rules_backup.file?
34
- UI.warn "The libminisip rules seem to be fixed already, I won't touch them now. Delete #{Path.repository_libminisip_rules_backup.enquote} to enforce it."
35
- else
36
- Cmd.copy Path.repository_libminisip_rules, Path.repository_libminisip_rules_backup
37
- Cmd.replace Path.repository_libminisip_rules, 'AUTOMATED_INSTALLER_PLACEHOLDER=""', [libminisip_cpp_flags, libminisip_ld_flags].join(' ')
38
- end
39
- end
40
-
41
33
  end
42
34
  end
43
35
  end