csd 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -29,6 +29,17 @@ module CSD
29
29
  cleanup_working_directory
30
30
  end
31
31
 
32
+ # This method is to provide general introductions to users, like current working directory.
33
+ #
34
+ # ====Options
35
+ # [debug] If debug option is set, users will be notified about system platform and current working module.
36
+ # [help] If help option is set, AI will provide all help information and cleanup in case the working directory was temporary and is empty.
37
+ # [reveal] If reveal option is set, AI will continue and process the next method.
38
+ # [yes] If yes option is set, AI will continue and process the next method.
39
+ #
40
+ # If users did not specify any option, AI will ask for their willingness to continue and process the next method
41
+ # after the users choose 'yes'. Or AI will terminate its operation.
42
+ #
32
43
  def introduction
33
44
  UI.info " Working directory: ".green.bold + Path.work.to_s.yellow
34
45
  if Options.debug
@@ -77,6 +88,11 @@ module CSD
77
88
  Cmd.run('lspci | grep VGA', :internal => true).output
78
89
  end
79
90
 
91
+ # The method is to check out ATI radeon driver from git repository and execute the shell script.
92
+ #
93
+ # * It will allow the script to be run as a program, Because Linux system will not grant this permission to shell script for security reason.
94
+ # * The method will ask for users' approval before initiate the shell script.
95
+ #
80
96
  def install_radeon
81
97
  Cmd.git_clone 'drivers for ATI radeon', 'git://github.com/csd/ati.git', Path.radeon
82
98
  Cmd.run "chmod +x #{Path.radeon_run}", :announce_pwd => false
@@ -84,6 +100,14 @@ module CSD
84
100
  Cmd.run "sh #{Path.radeon_run}", :announce_pwd => false
85
101
  end
86
102
 
103
+ # The method is to check installation environment and initiate installation method of GeForce.
104
+ # The installation process of GeForce driver need to update users' X configuration, so AI is suppose to
105
+ # turn off X server before initiating the installation procedure of GeForce driver.
106
+ # ==== X server status
107
+ #
108
+ # [X server is running] AI will terminate X server, but this operation will also stop GNOME and AI itself. In order to continue with the installation procedure, users will start AI again from CLI.
109
+ # [X server has be turned off] AI will initiate the installation process, but whenever there is an error occur, AI will restart GNOME mode and clean up the working directory.
110
+ #
87
111
  def install_geforce
88
112
  if xserver_running? or Options.reveal
89
113
  UI.separator
@@ -103,11 +127,30 @@ module CSD
103
127
  end
104
128
  end
105
129
 
130
+ # The method is to check X server status.
131
+ # ====Returns
132
+ # * +true+ if X server is running
133
+ # * +false+ if X server is not running
134
+ #
106
135
  def xserver_running?
107
136
  result = Cmd.run('ps -ef', :internal => true)
108
137
  result.success? and (result.output =~ /bin\/X.+gdm/ or result.output =~ /xinit/)
109
138
  end
110
139
 
140
+ # The method is to check out GeForce installation script for git repository and initiate installation GUI.
141
+ # Currently, MiniSIP is only run on x86 systems, and GeForce driver installation is to improve the video quality
142
+ # of MiniSIP. Thus, before checking out GeForce installation script, AI will check the architecture of system.
143
+ # When it is a 64-bit system, AI will raise an error and terminate the process. While the system has a x86 architecture,
144
+ # AI will continue with the installation process. AI will check out the installation script from git repositoy,
145
+ # and permit the script to run as a program.
146
+ # AI will ask for users' approval before initiate the shell script.
147
+ # ==== Notes
148
+ # we do not use Cmd.run to initiate the installation process, because the User input is not forwared to
149
+ # the executed application correctly. We will use Ruby's native command execution:
150
+ # system "sudo #{Path.geforce_run}"
151
+ # instead of
152
+ # Cmd.run "sudo #{Path.geforce_run}", :announce_pwd => false, :verbose => true, :die_on_failure => false
153
+ #
111
154
  def install_geforce!
112
155
  raise Error::Graphics::Amd64NotSupported, "Sorry, nVIDIA GeForce is currently only supported on x86" unless Gem::Platform.local.cpu == 'x86'
113
156
  Cmd.git_clone 'drivers for nVIDIA GeForce', 'git://github.com/csd/nvidia.git', Path.geforce
@@ -119,6 +162,9 @@ module CSD
119
162
  system "sudo #{Path.geforce_run}"
120
163
  end
121
164
 
165
+ # The method is to notify the user about following operation of AI and initiate the method of wait_for_confirmation,
166
+ # where users can choose to continue with the operation or not.
167
+ #
122
168
  def proprietary_continue
123
169
  UI.separator
124
170
  UI.info 'The proprietary installer for your graphic card will now be executed.'.green.bold
@@ -127,6 +173,10 @@ module CSD
127
173
  wait_for_confirmation
128
174
  end
129
175
 
176
+ # The method is to provide necessary tips for users to install GeForce. Because users need to allow GeForce to
177
+ # update X configuration in the installation wizard and restart the system to make all changes take effect.
178
+ # The method will also initiate the method of wait_for_confirmation, where users can choose to continue with the operation or not.
179
+ #
130
180
  def proprietary_continue_for_geforce
131
181
  UI.separator
132
182
  UI.info 'The proprietary installer for your graphic card will now be executed.'.green.bold
@@ -136,6 +186,9 @@ module CSD
136
186
  wait_for_confirmation
137
187
  end
138
188
 
189
+ # This method is to ask users about their willingness to continue. If the user choose to continue or AI is running
190
+ # in reveal mode, AI will continue with its operation. Or AI will clear up the working directory and terminate the process.
191
+ #
139
192
  def wait_for_confirmation
140
193
  unless UI.continue? or Options.reveal
141
194
  cleanup_working_directory
@@ -143,6 +196,8 @@ module CSD
143
196
  end
144
197
  end
145
198
 
199
+ #This method is to define relative path in graphics module. This will make the program clean and easy to read.
200
+ #
146
201
  def define_relative_paths
147
202
  UI.debug "#{self.class}#define_relative_paths defines relative graphics paths now"
148
203
  Path.radeon = Pathname.new(File.join(Path.work, 'radeon'))
@@ -126,6 +126,7 @@ module CSD
126
126
  Path.plugins = Pathname.new(File.join(Path.work, 'plugins'))
127
127
  Path.plugins_destination = Pathname.new(File.join(Path.build_lib, 'libminisip', 'plugins'))
128
128
  Path.minisip_gnome_png = Pathname.new(File.join(Path.repository, 'minisip', 'share', 'icon_gnome.png'))
129
+ Path.minisip_gnome_png_fallback = Pathname.new(File.join(Path.repository, 'minisip', 'share', 'minisip.png'))
129
130
  Path.minisip_gnome_pixmap = Pathname.new(File.join('/', 'usr', 'share', 'pixmaps', 'minisip_gnome.png'))
130
131
  Path.minisip_desktop_entry = Pathname.new(File.join('/', 'usr', 'share', 'applications', 'minisip.desktop'))
131
132
  Path.phonebook = Pathname.new(File.join(ENV['HOME'], '.minisip.addr'))
@@ -40,7 +40,7 @@ module CSD
40
40
 
41
41
  def remove_ffmpeg
42
42
  ffmpeg_available = Cmd.run('ffmpeg -h', :internal => true, :die_on_failure => false).success?
43
- return if Options.ffmpeg_first or !Options.configure or !libraries.include?('libminisip') or !ffmpeg_available
43
+ return if Options.ffmpeg_first or !libraries.include?('libminisip') or !ffmpeg_available
44
44
  UI.debug "MILESTONE_removing_ffmpeg"
45
45
  if Gem::Platform.local.debian?
46
46
  # Note that FFmpeg must have been installed via apt-get or via the AI in order for this to work,
@@ -88,6 +88,10 @@ module CSD
88
88
  Cmd.cd Path.repository, :internal => true
89
89
  Cmd.run "git checkout -b #{Options.branch} origin/#{Options.branch}"
90
90
  end
91
+ UI.info "Initializing any optional git submodules".green.bold
92
+ Cmd.cd Path.repository, :internal => true
93
+ Cmd.run 'git submodule init'
94
+ Cmd.run 'git submodule update'
91
95
  end
92
96
 
93
97
  # Some places in the MiniSIP source code have to be modified before MiniSIP can be compiled.
@@ -108,11 +112,12 @@ module CSD
108
112
  UI.info "Fixing MiniSIP OpenGL GUI source code".green.bold
109
113
  # Replacing the hardcoded path in the OpenGLDisplay.cxx
110
114
  Cmd.replace Path.repository_open_gl_display, /\tstring path = "(.+)"\+/, %{\tstring path = "#{Path.build}"+}
115
+ UI.info "Modifying default MiniSIP configuration parameters".green.bold
111
116
  # Removing the default SIP proxy server from the Configuration generator
112
117
  Cmd.replace Path.repository_sip_conf, 'sip.domain.example', ''
113
- #
114
-
115
- # Making
118
+ # We would like decklink to be the default video device
119
+ Cmd.replace Path.repository_sip_conf, 'be->commit();', %{be->save("video_device", "decklink:0/720p50@25");be->commit();}
120
+ # Making
116
121
  if Options.ffmpeg_first
117
122
  UI.info "Fixing MiniSIP Audio/Video en/decoder source code".green.bold
118
123
  Cmd.replace Path.repository_avcoder_cxx, 'PIX_FMT_RGBA32', 'PIX_FMT_RGB32'
@@ -39,7 +39,10 @@ Categories=Application;Internet;Network;Chat;AudioVideo}
39
39
  # So we do not return here now
40
40
  # return if Path.minisip_gnome_pixmap.file? and Path.minisip_desktop_entry.file?
41
41
  UI.info "Installing Gnome menu item".green.bold
42
- Cmd.run("sudo cp #{Path.minisip_gnome_png} #{Path.minisip_gnome_pixmap}", :announce_pwd => false)
42
+ # It might be that the requested branch does not have the new gnome_icon.png in minisip/share
43
+ # That's why we have to use the default logo as a fallback solution
44
+ Path.usable_gnome_png = Path.minisip_gnome_png.file? ? Path.minisip_gnome_png : Path.minisip_gnome_png_fallback
45
+ Cmd.run "sudo cp #{Path.usable_gnome_png} #{Path.minisip_gnome_pixmap}", :announce_pwd => false
43
46
  Path.new_desktop_entry = Pathname.new File.join(Path.work, 'minisip.desktop')
44
47
  Cmd.touch_and_replace_content Path.new_desktop_entry, DESKTOP_ENTRY, :internal => true
45
48
  Cmd.run "sudo mv #{Path.new_desktop_entry} #{Path.minisip_desktop_entry}", :announce_pwd => false
@@ -2,7 +2,7 @@ self.this_user = false
2
2
  self.apt_get = true
3
3
  self.ffmpeg_first = false
4
4
  self.github_tar = false
5
- self.branch = nil
5
+ self.branch = 'edge'
6
6
  self.bootstrap = true
7
7
  self.configure = true
8
8
  self.make = true
@@ -5,7 +5,8 @@ module CSD
5
5
  module Application
6
6
  module Mslog
7
7
  class Base < CSD::Application::Base
8
-
8
+
9
+ # Necessary contents for MSLog .desktop file. It will be used in the method of create_desktop_entry.
9
10
  DESKTOP_ENTRY = %{
10
11
  [Desktop Entry]
11
12
  Encoding=UTF-8
@@ -23,6 +24,9 @@ Categories=Application;Internet;Network;Chat;AudioVideo}
23
24
  #
24
25
  DEBIAN_DEPENDENCIES = %w{ ant openjdk-6-jre openjdk-6-jdk libnotify-bin }
25
26
 
27
+ # The method is to notify users about following operation of AI, and initiate introduction method.
28
+ # The actual installation process is carried out by method install! for the purpose of keeping source code clean.
29
+ #
26
30
  def install
27
31
  UI.separator
28
32
  UI.info "This operation will install the logging server of MiniSIP.".green.bold
@@ -31,6 +35,10 @@ Categories=Application;Internet;Network;Chat;AudioVideo}
31
35
  install!
32
36
  end
33
37
 
38
+ # The method is to set up logging server by initiate corresponding method. Its major operation includes
39
+ # install library dependencies, download and install logging server, create a desktop entry for logging server.
40
+ # Thus users can start the logging server by simply clicking the MSLog button in the Applications menu.
41
+ #
34
42
  def install!
35
43
  create_working_directory
36
44
  define_relative_paths
@@ -42,6 +50,22 @@ Categories=Application;Internet;Network;Chat;AudioVideo}
42
50
  congratulations
43
51
  end
44
52
 
53
+ # This method is to provide general introductions to users, like current working directory.
54
+ #
55
+ # ====Options
56
+ # [debug] If debug option is set, users will be notified about system platform and current working module.
57
+ # [help] If help option is set, AI will provide all help information and cleanup.
58
+ # [reveal] If reveal option is set, AI will continue and process the next method.
59
+ # [yes] If yes option is set, AI will continue and process the next method.
60
+ #
61
+ # If users did not specify any option, AI will ask for their willingness to continue and process the next method
62
+ # after the users choose 'yes'. Or AI will terminate its operation.
63
+ #
64
+ # ====Notes
65
+ # In mslog module the options of temp and work_dir will be turned off by default. The reason of doing that is because
66
+ # the minisip-logging-server directory and its content is needed to run the logging server. Thus AI is not going to
67
+ # use temp directory to process the source code or clean up the working directory after installation procedure.
68
+ #
45
69
  def introduction
46
70
  UI.info " Working directory: ".green.bold + Path.work.to_s.yellow
47
71
  if Options.debug
@@ -57,6 +81,8 @@ Categories=Application;Internet;Network;Chat;AudioVideo}
57
81
  end
58
82
  end
59
83
 
84
+ #
85
+ #
60
86
  def apt_get
61
87
  UI.info "Updating the package index".green.bold
62
88
  Cmd.run "sudo apt-get update --yes --force-yes", :announce_pwd => false
@@ -155,16 +155,16 @@ module CSD
155
155
  opts.on("-e", "--verbose","Show more elaborate output") do |value|
156
156
  self.verbose = value
157
157
  end
158
- opts.on("-d", "--debug","Show more elaborate output and debugging information about the AI") do |value|
158
+ opts.on("-d", "--debug","Show debugging information about the AI") do |value|
159
159
  self.debug = value
160
160
  end
161
161
  opts.on("-s", "--silent","Don't show any output") do |value|
162
162
  self.silent = value
163
163
  end
164
- opts.on_tail("-a", "--developer", "Show information only relevant to AI and MiniSIP developers") do |value|
164
+ opts.on_tail("-a", "--developer", "Show information only relevant to software developers") do |value|
165
165
  self.developer = value
166
166
  end
167
- opts.on_tail("-h", "--help", "Show detailed help (regarding the given ACTION and APPLICATION)") do |value|
167
+ opts.on_tail("-h", "--help", "Show detailed help (regarding the given TASK and APPLICATION)") do |value|
168
168
  self.help = value
169
169
  end
170
170
  opts.on_tail("-v", "--version", "Show the version of this AI") do
@@ -82,6 +82,7 @@ class TestMinisip < Test::Unit::TestCase
82
82
  end
83
83
 
84
84
  should "know how to checkout the default branch of the source code" do
85
+ Options.branch = nil
85
86
  out, err = capture { Core.checkout }
86
87
  assert_match /git clone /, out
87
88
  assert_no_match /git pull/, out
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: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 0
10
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.1
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-09-07 00:00:00 +02:00
18
+ date: 2010-09-08 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21