csd 0.2.2 → 0.3.0

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 (37) hide show
  1. data/.gitignore +1 -1
  2. data/README.rdoc +19 -6
  3. data/VERSION +1 -1
  4. data/lib/csd.rb +40 -18
  5. data/lib/csd/application.rb +1 -2
  6. data/lib/csd/application/decklink/about.yml +1 -1
  7. data/lib/csd/application/decklink/base.rb +1 -0
  8. data/lib/csd/application/decklink/options/{install.rb → common.rb} +0 -2
  9. data/lib/csd/application/decklink/options/common_defaults.rb +2 -0
  10. data/lib/csd/application/default.rb +62 -6
  11. data/lib/csd/application/graphics.rb +30 -0
  12. data/lib/csd/application/graphics/about.yml +8 -0
  13. data/lib/csd/application/graphics/base.rb +157 -0
  14. data/lib/csd/application/graphics/error.rb +16 -0
  15. data/lib/csd/application/graphics/options/common.rb +11 -0
  16. data/lib/csd/application/graphics/options/common_defaults.rb +2 -0
  17. data/lib/csd/application/graphics/options/install.rb +11 -0
  18. data/lib/csd/application/graphics/options/install_defaults.rb +2 -0
  19. data/lib/csd/application/i2conf.rb +2 -1
  20. data/lib/csd/application/i2conf/about.yml +1 -1
  21. data/lib/csd/application/minisip/about.yml +1 -1
  22. data/lib/csd/application/minisip/base.rb +1 -0
  23. data/lib/csd/application/minisip/component/core.rb +20 -9
  24. data/lib/csd/application/minisip/unix.rb +0 -1
  25. data/lib/csd/application/mslog.rb +29 -0
  26. data/lib/csd/application/mslog/about.yml +8 -0
  27. data/lib/csd/application/mslog/base.rb +123 -0
  28. data/lib/csd/application/mslog/options/common.rb +7 -0
  29. data/lib/csd/application/mslog/options/common_defaults.rb +2 -0
  30. data/lib/csd/applications.rb +2 -0
  31. data/lib/csd/commands.rb +28 -28
  32. data/lib/csd/container.rb +20 -16
  33. data/lib/csd/options_parser.rb +19 -2
  34. data/lib/csd/user_interface/base.rb +4 -0
  35. metadata +19 -7
  36. data/csd.gemspec +0 -161
  37. data/lib/csd/application/opensips/about.yml +0 -2
@@ -0,0 +1,16 @@
1
+ # -*- encoding: UTF-8 -*-
2
+ require 'csd/error'
3
+
4
+ module CSD
5
+ module Error
6
+ module Graphics
7
+
8
+ # See 'csd/error' to find out which status code range has been assigned to Graphics
9
+
10
+ class CardNotSupported < CSDError; status_code(300); end
11
+ class Amd64NotSupported < CSDError; status_code(301); end
12
+ class XServerStillRunning < CSDError; status_code(302); end
13
+
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,11 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ opts.headline 'WORKING DIRECTORY OPTIONS'.green.bold
4
+
5
+ opts.on("--no-temp", "Use a subdirectory in the current directory as working directory and not /tmp.") do |value|
6
+ self.temp = value
7
+ end
8
+
9
+ opts.on("--work-dir [PATH]", "Defines and/or creates the working directory. This will override the --no-temp option.") do |value|
10
+ self.work_dir = value
11
+ end
@@ -0,0 +1,2 @@
1
+ self.temp = true
2
+ self.work_dir = nil
@@ -0,0 +1,11 @@
1
+ # -*- encoding: UTF-8 -*-
2
+ # This file gets eval'ed by the global options parser in lib/csd/rb
3
+
4
+
5
+ opts.on("--force-geforce","Skip graphical card checking and force to install GeForce drivers") do |value|
6
+ self.force_geforce = value
7
+ end
8
+
9
+ opts.on("--force-radeon","Skip graphical card checking and force to install Radeon drivers") do |value|
10
+ self.force_radeon = value
11
+ end
@@ -0,0 +1,2 @@
1
+ self.force_geforce = nil
2
+ self.force_radeon = nil
@@ -11,7 +11,8 @@ module CSD
11
11
 
12
12
  include CSD::Application::Default
13
13
 
14
- # This method will check which system we're on and initialize the correct sub-module
14
+ # This method will check which system we're on and initialize the correct sub-module.
15
+ # Currently we only support Ubuntu.
15
16
  #
16
17
  def instance
17
18
  if Gem::Platform.local.ubuntu?
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: UTF-8 -*-
2
2
  human: i2conf
3
- description: A SIP video conference MCU (Reflector).
3
+ description: SIP video conference MCU (Reflector).
4
4
  actions:
5
5
  public:
6
6
  - install: Downloads and installs the MCU.
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: UTF-8 -*-
2
2
  human: MiniSIP
3
- description: An open-source SIP client for high-definition video conferencing.
3
+ description: SIP client for high-definition video conferencing.
4
4
  actions:
5
5
  public:
6
6
  #- show: Shows further information about MiniSIP
@@ -108,6 +108,7 @@ module CSD
108
108
  Path.repository_open_gl_display = Pathname.new(File.join(Path.repository, 'libminisip', 'source', 'subsystem_media', 'video', 'display', 'OpenGLDisplay.cxx'))
109
109
  Path.repository_avcoder_cxx = Pathname.new(File.join(Path.repository, 'libminisip', 'source', 'subsystem_media', 'video', 'codec', 'AVCoder.cxx'))
110
110
  Path.repository_avdecoder_cxx = Pathname.new(File.join(Path.repository, 'libminisip', 'source', 'subsystem_media', 'video', 'codec', 'AVDecoder.cxx'))
111
+ Path.repository_sip_conf = Pathname.new(File.join(Path.repository, 'libminisip', 'source', 'subsystem_signaling', 'sip', 'SipSoftPhoneConfiguration.cxx'))
111
112
  Path.repository_decklinksdk = Pathname.new(File.join(Path.repository_grabber, 'decklinksdk'))
112
113
  Path.ffmpeg_repository = Pathname.new(File.join(Path.work, 'ffmpeg'))
113
114
  Path.ffmpeg_libavutil = Pathname.new(File.join(Path.ffmpeg_repository, 'libavutil'))
@@ -90,18 +90,29 @@ module CSD
90
90
  end
91
91
  end
92
92
 
93
- # Some places in the MiniSIP source code have to be modified before it can be compiled.
94
- # In this case, an absolute path must be replaced with the current absolute prefix path.
95
- # Furthermore, modifications of some constants will be done, because this is more compatible
96
- # with the most recent FFmpeg version. In fact, MiniSIP won't compile if FFmpeg is present
97
- # and this has not been modified.
98
- # See http://www.howgeek.com/2010/03/01/ffmpeg-php-error-‘pix_fmt_rgba32’-undeclared-first-use-in-this-function
99
- # and http://ffmpeg.org/doxygen/0.5/pixfmt_8h.html#33d341c4f443d24492a95fb7641d0986 for more information
100
- # about the FFmpeg pixel format constants.
93
+ # Some places in the MiniSIP source code have to be modified before MiniSIP can be compiled.
94
+ # * An absolute path must be replaced with the current absolute prefix path in
95
+ # <tt>libminisip/source/subsystem_media/video/display/OpenGLDisplay.cxx</tt>
96
+ # * The .minisip.conf configuration file generated by MiniSIP has a SIP proxy server by default.
97
+ # The configuration _key_ is $proxy_addr$ and the _value_ is $sip.domain.example$. We modify
98
+ # the source code file responsible for generating the default configuration file, so that it will
99
+ # not fill in a SIP proxy server by default. The reason is that during compilation there is no
100
+ # .minisip.conf file that we could edit! So we go for the source.
101
+ # * Modifications of some constants will be done, because this is more compatible
102
+ # with the most recent FFmpeg version. In fact, MiniSIP won't compile if FFmpeg is present
103
+ # and this has not been modified. See http://www.howgeek.com/2010/03/01/ffmpeg-php-error-‘pix_fmt_rgba32’-undeclared-first-use-in-this-function
104
+ # and http://ffmpeg.org/doxygen/0.5/pixfmt_8h.html#33d341c4f443d24492a95fb7641d0986 for more information
105
+ # about the FFmpeg pixel format constants.
101
106
  #
102
107
  def modify_source_code
103
108
  UI.info "Fixing MiniSIP OpenGL GUI source code".green.bold
104
- Cmd.replace Path.repository_open_gl_display, /(\s+)(string path = ")(.+)(".+)/, "\1\2#{Path.build}\4"
109
+ # Replacing the hardcoded path in the OpenGLDisplay.cxx
110
+ Cmd.replace Path.repository_open_gl_display, /\tstring path = "(.+)"\+/, %{\tstring path = "#{Path.build}"+}
111
+ # Removing the default SIP proxy server from the Configuration generator
112
+ Cmd.replace Path.repository_sip_conf, 'sip.domain.example', ''
113
+ #
114
+
115
+ # Making
105
116
  if Options.ffmpeg_first
106
117
  UI.info "Fixing MiniSIP Audio/Video en/decoder source code".green.bold
107
118
  Cmd.replace Path.repository_avcoder_cxx, 'PIX_FMT_RGBA32', 'PIX_FMT_RGB32'
@@ -78,7 +78,6 @@ module CSD
78
78
  UI.separator
79
79
  # Core.run_gtkgui # At this point we could run MiniSIP instead of ending the AI -- if we wanted to.
80
80
  end
81
-
82
81
  end
83
82
 
84
83
  end
@@ -0,0 +1,29 @@
1
+ # -*- encoding: UTF-8 -*-
2
+ require 'csd/application/default'
3
+ require 'csd/application/mslog/base'
4
+
5
+ module CSD
6
+ module Application
7
+ # This is the Application Module to install MiniSIP logging server.
8
+ #
9
+ module Mslog
10
+ class << self
11
+
12
+ include CSD::Application::Default
13
+
14
+ # This method will check which system we're on and initialize the correct sub-module.
15
+ # Currently we only support Ubuntu.
16
+ #
17
+ def instance
18
+ if Gem::Platform.local.ubuntu?
19
+ UI.debug "#{self}.instance finishes the system check"
20
+ Base.new
21
+ else
22
+ raise 'Sorry, currently only Ubuntu is supported.'
23
+ end
24
+ end
25
+
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,8 @@
1
+ # -*- encoding: UTF-8 -*-
2
+ human: Mslog
3
+ description: Logging Server Receiver Unit for MiniSIP.
4
+ actions:
5
+ public:
6
+ - install: Downloads and installs the logging server for MiniSIP.
7
+ scopes:
8
+ --- {}
@@ -0,0 +1,123 @@
1
+ # -*- encoding: UTF-8 -*-
2
+ require 'csd/application/default/base'
3
+
4
+ module CSD
5
+ module Application
6
+ module Mslog
7
+ class Base < CSD::Application::Base
8
+
9
+ DESKTOP_ENTRY = %{
10
+ [Desktop Entry]
11
+ Encoding=UTF-8
12
+ Name=MSlog Server
13
+ GenericName=A remote reveiver for MiniSIP log files
14
+ Comment=Provide a logging server for MiniSIP
15
+ Exec=PLACEHOLDER
16
+ Icon=mslog_gnome
17
+ Terminal=true
18
+ Type=Application
19
+ StartupNotify=true
20
+ Categories=Application;Internet;Network;Chat;AudioVideo}
21
+
22
+ # A list of apt-get packages that are required to install the logging server.
23
+ #
24
+ DEBIAN_DEPENDENCIES = %w{ ant openjdk-6-jre openjdk-6-jdk libnotify-bin }
25
+
26
+ def install
27
+ UI.separator
28
+ UI.info "This operation will install the logging server of MiniSIP.".green.bold
29
+ UI.separator
30
+ introduction
31
+ install!
32
+ end
33
+
34
+ def install!
35
+ create_working_directory
36
+ define_relative_paths
37
+ apt_get
38
+ download
39
+ process
40
+ create_desktop_entry
41
+ send_notification
42
+ congratulations
43
+ end
44
+
45
+ def introduction
46
+ UI.info " Working directory: ".green.bold + Path.work.to_s.yellow
47
+ if Options.debug
48
+ UI.info " Your Platform: ".green + Gem::Platform.local.humanize.to_s.yellow
49
+ UI.info(" Application module: ".green + self.class.name.to_s.yellow)
50
+ end
51
+ UI.separator
52
+ if Options.help
53
+ UI.info Options.helptext
54
+ raise CSD::Error::Argument::HelpWasRequested
55
+ else
56
+ raise Interrupt unless Options.yes or Options.reveal or UI.continue?
57
+ end
58
+ end
59
+
60
+ def apt_get
61
+ UI.info "Updating the package index".green.bold
62
+ Cmd.run "sudo apt-get update --yes --force-yes", :announce_pwd => false
63
+ UI.info "Installing Debian packages".green.bold
64
+ Cmd.run "sudo apt-get install #{DEBIAN_DEPENDENCIES.join(' ')} --yes --force-yes", :announce_pwd => false
65
+ end
66
+
67
+ def download
68
+ Cmd.git_clone 'Source code of logging server', 'git://github.com/csd/minisip-logging-server.git', Path.packages
69
+ end
70
+
71
+ def process
72
+ Cmd.cd Path.packages, :internal => true
73
+ Cmd.run %{echo "export JAVA_HOME=/usr" >> ~/.bashrc} unless File.read(Path.bashrc) =~ /JAVA_HOME/
74
+ # For some reason the bashrc file cannot be reloaded systemwide from within the AI.
75
+ # As a workaround we devine the JAVA_HOME constant manually instead of using the '.'-command
76
+ # Cmd.run ". ~/.bashrc"
77
+ ENV['JAVA_HOME'] = '/usr'
78
+ # Compiling the Java source code
79
+ Cmd.run 'ant'
80
+ # Giving execution permissions to the executable
81
+ Cmd.run "chmod +x #{Path.logging_server_run}", :announce_pwd => false
82
+ end
83
+
84
+ def create_desktop_entry
85
+ UI.info "Installing Gnome menu item".green.bold
86
+ Cmd.run("sudo cp #{Path.mslog_gnome_png} #{Path.mslog_gnome_pixmap}", :announce_pwd => false)
87
+ Cmd.touch_and_replace_content Path.mslog_new_desktop_entry, DESKTOP_ENTRY.sub('PLACEHOLDER', Path.logging_server_run), :internal => true
88
+ Cmd.run "sudo mv #{Path.mslog_new_desktop_entry} #{Path.mslog_desktop_entry}", :announce_pwd => false
89
+ update_gnome_menu_cache
90
+ end
91
+
92
+ def update_gnome_menu_cache
93
+ return unless Gem::Platform.local.ubuntu_10?
94
+ Cmd.run %{sudo sh -c "/usr/share/gnome-menus/update-gnome-menus-cache /usr/share/applications/ > /usr/share/applications/desktop.${LANG}.cache"}, :announce_pwd => false
95
+ Cmd.run "sudo chown root:root #{Path.mslog_desktop_entry}", :announce_pwd => false
96
+ end
97
+
98
+ def send_notification
99
+ Cmd.run %{notify-send --icon=mslog_gnome "MiniSIP Logging Server installation complete" "You are now ready to use your logging server." }, :internal => true, :die_on_failure => false
100
+ end
101
+
102
+ def congratulations
103
+ UI.separator
104
+ UI.info " MiniSIP Logging Server installation complete.".green.bold
105
+ UI.info " Please have a look in your applications menu -> Internet."
106
+ UI.separator
107
+ end
108
+
109
+ def define_relative_paths
110
+ Path.packages = Pathname.new(File.join(Path.work, 'minisip-logging-server'))
111
+ Path.bin = Pathname.new(File.join(Path.packages, 'bin'))
112
+ Path.logging_server_run = Pathname.new(File.join(Path.bin, 'logging-server-0.1.sh'))
113
+ Path.mslog_gnome_png = Pathname.new(File.join(Path.packages, 'img', 'mslog_gnome.png'))
114
+ Path.mslog_gnome_pixmap = Pathname.new(File.join('/', 'usr', 'share', 'pixmaps', 'mslog_gnome.png'))
115
+ Path.mslog_desktop_entry = Pathname.new(File.join('/', 'usr', 'share', 'applications', 'mslog.desktop'))
116
+ Path.mslog_new_desktop_entry = Pathname.new(File.join(Path.work, 'mslog.desktop'))
117
+ Path.bashrc = Pathname.new(File.join(ENV['HOME'], '.bashrc'))
118
+ end
119
+
120
+ end
121
+ end
122
+ end
123
+ end
@@ -0,0 +1,7 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ opts.headline 'WORKING DIRECTORY OPTIONS'.green.bold
4
+
5
+ opts.on("--work-dir [PATH]", "Defines and/or creates the working directory. This will override the --no-temp option.") do |value|
6
+ self.work_dir = value
7
+ end
@@ -0,0 +1,2 @@
1
+ self.temp = false
2
+ self.work_dir = nil
@@ -45,6 +45,8 @@ module CSD
45
45
  @@current ||= choose_current
46
46
  end
47
47
 
48
+ protected
49
+
48
50
  # This method identifies the desired application. No caching takes place here.
49
51
  # It is meant to be very robust, we expect the application to be any one of the first three arguments.
50
52
  #
@@ -255,33 +255,6 @@ module CSD
255
255
  result
256
256
  end
257
257
 
258
- private
259
-
260
- # The common backend for copy and move operations.
261
- #
262
- def transfer(action, src, dest, params={})
263
- default_params = { :die_on_failure => true }
264
- params = default_params.merge(params)
265
- result = CommandResult.new
266
- UI.info "#{action == :copy ? 'Copying' : 'Moving'} `#{src}´ to `#{dest}´".cyan
267
- begin
268
- FileUtils.send(action, src, dest) unless Options.reveal
269
- result.success = true
270
- rescue Exception => e
271
- result.success = false
272
- result.reason = "Could not perform #{action} operation! #{e.message}"
273
- if params[:die_on_failure]
274
- case action
275
- when :copy then raise CSD::Error::Command::CopyFailed, result.reason
276
- when :move then raise CSD::Error::Command::MoveFailed, result.reason
277
- end
278
- else
279
- UI.error result.reason
280
- end
281
- end
282
- result
283
- end
284
-
285
258
  # Clones the master branch of a repository using +git+. +name+ is a +String+ used for UI outputs,
286
259
  # +repository+ is the URL/path to the repository, +destination+ is an absolute or relative
287
260
  # path to where the repository should be downloaded to.
@@ -335,6 +308,34 @@ module CSD
335
308
  Cmd.run "wget #{url} -O #{destination}", :die_on_failure => false, :announce_pwd => false
336
309
  end
337
310
  end
311
+
312
+ protected
313
+
314
+ # The common backend for copy and move operations.
315
+ #
316
+ def transfer(action, src, dest, params={})
317
+ default_params = { :die_on_failure => true }
318
+ params = default_params.merge(params)
319
+ result = CommandResult.new
320
+ UI.info "#{action == :copy ? 'Copying' : 'Moving'} `#{src}´ to `#{dest}´".cyan
321
+ begin
322
+ FileUtils.send(action, src, dest) unless Options.reveal
323
+ result.success = true
324
+ rescue Exception => e
325
+ result.success = false
326
+ result.reason = "Could not perform #{action} operation! #{e.message}"
327
+ if params[:die_on_failure]
328
+ case action
329
+ when :copy then raise CSD::Error::Command::CopyFailed, result.reason
330
+ when :move then raise CSD::Error::Command::MoveFailed, result.reason
331
+ end
332
+ else
333
+ UI.error result.reason
334
+ end
335
+ end
336
+ result
337
+ end
338
+
338
339
  end
339
340
 
340
341
  # Objects of this class can be returned by Commands. Since it is an OpenStruct object,
@@ -352,7 +353,6 @@ module CSD
352
353
  def method_missing(meth, *args, &block)
353
354
  meth.to_s.ends_with?('?') ? self.send(meth.to_s.chop.to_sym, *args, &block) : super
354
355
  end
355
-
356
356
  end
357
357
 
358
358
  end
@@ -12,35 +12,38 @@ module CSD
12
12
  @@ui ||= choose_ui
13
13
  end
14
14
 
15
- # This method chooses an user interface instance according to the Options and returns a new instance of it.
16
- #
17
- def choose_ui
18
- if Options.silent
19
- UserInterface::Silent.new
20
- else
21
- UserInterface::CLI.new
22
- end
23
- end
24
-
25
- # This method chooses and holds the command execution instance.
15
+ # This method chooses and holds the command helper instance.
26
16
  #
27
17
  def cmd
28
18
  @@cmd ||= Commands.new
29
19
  end
30
-
31
- # This holds the container for paths.
20
+
21
+ # This method chooses and holds the container for paths.
32
22
  #
33
23
  def path
34
24
  @@path ||= PathContainer.new
35
25
  end
36
-
37
- # This holds the container for argument options.
26
+
27
+ # This method chooses and holds the container for argument options.
38
28
  #
39
29
  def options
40
30
  @@options ||= OptionsParser.new
41
31
  end
32
+
33
+ private
34
+
35
+ # This method chooses an user interface instance according to the Options and returns a new instance of it.
36
+ #
37
+ def choose_ui
38
+ if Options.silent
39
+ UserInterface::Silent.new
40
+ else
41
+ UserInterface::CLI.new
42
+ end
43
+ end
44
+
42
45
  end
43
-
46
+
44
47
  # A wrapper for the UI class to be able to run all methods as class methods.
45
48
  #
46
49
  class UI
@@ -77,4 +80,5 @@ module CSD
77
80
  ::CSD.options.send(meth, *args, &block)
78
81
  end
79
82
  end
83
+
80
84
  end