csd 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/COPYING CHANGED
@@ -1,8 +1,8 @@
1
- Copyright (C) Technology Transfer Alliance
1
+ Copyright (C) Communication Systems Design
2
2
 
3
3
  "CSD gem" refers to every file in this software, except the
4
4
  file "lib/active_support.rb", and the directories
5
- "lib/active_support" and "lib/term" and all its contents.
5
+ "lib/active_support" and "lib/term" and their contents, respectively.
6
6
 
7
7
  The CSD gem is free software; you can redistribute it and/or
8
8
  modify it under the terms of the GNU General Public License
data/README.rdoc CHANGED
@@ -14,12 +14,11 @@ CSD stands for Communication Systems Design and is a project of the Telecommunic
14
14
 
15
15
  * Fork the project.
16
16
  * Make your feature addition or bug fix.
17
- * Add tests for it. This is important so I don't break it in a
18
- future version unintentionally.
17
+ * Add tests for it. This is important so we don't break it in a future version unintentionally.
19
18
  * Commit, do not mess with Rakefile, version, or history.
20
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
21
- * Send me a pull request. Bonus points for topic branches.
19
+ (if you want to have your own version, that is fine but bump version in a commit by itself we can ignore when I pull)
20
+ * Send us a pull request.
22
21
 
23
22
  == Copyright
24
23
 
25
- Copyright (c) 2010 TTA. See LICENSE for details.
24
+ Copyright (c) 2010 Communication Systems Design. See COPYING for details.
data/Rakefile CHANGED
@@ -17,7 +17,7 @@ begin
17
17
 
18
18
  Thank you for installing the Communication Systems and Design Automated Installer!
19
19
 
20
- You can run it by just typing `ai´ in your command line.
20
+ You can run it by typing `ai´ in your command line.
21
21
 
22
22
  Note: On Debian and Ubuntu the executable `ai´ is not in your PATH by default.
23
23
  You can fix this by adding it to your .bashrc file with this command:
@@ -58,9 +58,9 @@ task :default => :test
58
58
  require 'rake/rdoctask'
59
59
  Rake::RDocTask.new do |rdoc|
60
60
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
61
-
62
61
  rdoc.rdoc_dir = 'rdoc'
63
62
  rdoc.title = "csd #{version}"
64
63
  rdoc.rdoc_files.include('README*')
65
- rdoc.rdoc_files.include('lib/**/*.rb')
64
+ rdoc.rdoc_files.include('lib/csd.rb')
65
+ rdoc.rdoc_files.include('lib/csd/**/*.rb')
66
66
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
data/bin/ai CHANGED
@@ -1,19 +1,25 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- # NOTE: If you would like to run this file as a developer, you can use the following command
4
- # ruby -I path/to/csd/lib path/to/csd/bin/ai
3
+ # NOTE: If you would like to execute this file as a developer
4
+ # but not install the CSD gem, you can use this command:
5
+ # ruby -I path/to/csd/lib path/to/csd/bin/ai
5
6
 
6
- # First, load the Rubygems framework and the CSD gem.
7
- # Note: Rubygems is already included for Ruby >= 1.9, but we want to go sure here
7
+ # First, let's load the RubyGems framework and the CSD gem.
8
+ # Even though RubyGems is already loaded for Ruby >= 1.9,
9
+ # we want to go sure here and load it to provide robustness
8
10
  require 'rubygems'
9
11
  require 'csd'
10
12
 
11
13
  begin
14
+ # Running the CSD library and telling it who started it
12
15
  CSD.bootstrap :executable => 'ai'
13
16
  rescue CSD::Error::CSDError => e
14
- CSD.ui.error e.message unless e.status_code <= 49 # Everything under 50 shows help messages
17
+ # Here we catch CSD internal errors and exit with the propriate status code
18
+ # We output the error message for status codes 50+, because they are rather severe
19
+ CSD.ui.error e.message unless e.status_code <= 49
15
20
  exit e.status_code
16
21
  rescue Interrupt
17
- CSD.ui.error "\nQuitting AI..."
22
+ # Lastly, close the AI gracefully on abnormal termination
23
+ CSD.ui.info "Quitting the AI...".red
18
24
  abort
19
- end
25
+ end
data/csd.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{csd}
8
- s.version = "0.1.4"
8
+ s.version = "0.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Technology Transfer Alliance Team"]
12
- s.date = %q{2010-07-13}
12
+ s.date = %q{2010-07-14}
13
13
  s.default_executable = %q{ai}
14
14
  s.description = %q{CSD stands for Communication Systems Design and is a project of the Telecommunication Systems Laboratory (TSLab) of the Royal Institute of Technology in Stockholm, Sweden. Within CSD many software tools are used to build up various networks and services. This gem is supposed to automate processes to handle the compilation and installation of these software tools. Technology Transfer Alliance (TTA) is the project team, which maintains this code.}
15
15
  s.email = %q{mtoday11@gmail.com}
@@ -237,7 +237,11 @@ Gem::Specification.new do |s|
237
237
  "lib/csd/application/minisip/error.rb",
238
238
  "lib/csd/application/minisip/options/common.rb",
239
239
  "lib/csd/application/minisip/options/compile.rb",
240
- "lib/csd/application/minisip/unix/base.rb",
240
+ "lib/csd/application/minisip/options/package.rb",
241
+ "lib/csd/application/minisip/unix.rb",
242
+ "lib/csd/application/minisip/unix/linux.rb",
243
+ "lib/csd/application/minisip/unix/linux/debian.rb",
244
+ "lib/csd/application/minisip/unix/linux/debian/ubuntu10.rb",
241
245
  "lib/csd/application/opensips/about.yml",
242
246
  "lib/csd/applications.rb",
243
247
  "lib/csd/commands.rb",
@@ -275,7 +279,7 @@ Gem::Specification.new do |s|
275
279
 
276
280
  Thank you for installing the Communication Systems and Design Automated Installer!
277
281
 
278
- You can run it by just typing `ai´ in your command line.
282
+ You can run it by typing `ai´ in your command line.
279
283
 
280
284
  Note: On Debian and Ubuntu the executable `ai´ is not in your PATH by default.
281
285
  You can fix this by adding it to your .bashrc file with this command:
data/lib/csd.rb CHANGED
@@ -1,7 +1,13 @@
1
1
  # encoding: utf-8
2
- # Loading all files in CSD
3
- require 'csd/error'
4
- require 'csd/options'
2
+
3
+ # Loading vendor libraries
4
+ require 'active_support'
5
+ require 'term/ansicolor'
6
+
7
+ # Loading all files in the subdirectory `csd´
8
+ Dir[File.join(File.dirname(__FILE__), 'csd', '*.rb')].sort.each do |path|
9
+ require "csd/#{File.basename(path, '.rb')}"
10
+ end
5
11
 
6
12
  # The CSD namespace is given to the entire gem.
7
13
  #
@@ -17,7 +23,7 @@ module CSD
17
23
  @executable = options[:executable]
18
24
  Options.parse!
19
25
  respond_to_incomplete_arguments
20
- Applications.current.instance.send("#{Options.action}!".to_sym)
26
+ Applications.current.instance.send("#{Options.action}".to_sym)
21
27
  end
22
28
 
23
29
  # This method chooses and holds the user interface instance
@@ -1,4 +1,6 @@
1
1
  # encoding: utf-8
2
+ require File.join(File.dirname(__FILE__), 'default', 'base')
3
+
2
4
  module CSD
3
5
  # This namespace holds all individual application Modules
4
6
  #
@@ -1,8 +1,9 @@
1
1
  # encoding: utf-8
2
- require File.join(File.dirname(__FILE__), 'default')
3
- Dir.glob(File.join(File.dirname(__FILE__), 'minisip', '*.rb')) { |file| require file }
4
- Dir.glob(File.join(File.dirname(__FILE__), 'minisip', 'unix', '*.rb')) { |file| require file }
5
2
  require 'ostruct'
3
+ require File.join(File.dirname(__FILE__), 'default')
4
+ require File.join(File.dirname(__FILE__), 'minisip', 'error')
5
+ require File.join(File.dirname(__FILE__), 'minisip', 'base')
6
+ require File.join(File.dirname(__FILE__), 'minisip', 'unix', 'linux', 'debian', 'ubuntu10')
6
7
 
7
8
  module CSD
8
9
  module Application
@@ -14,8 +15,17 @@ module CSD
14
15
  def instance
15
16
  @instance ||= case Gem::Platform.local.os
16
17
  when 'linux'
17
- Unix::Base.new
18
+ UI.debug "Analyzing kernel version: #{Gem::Platform.local.kernel_version}"
19
+ case Gem::Platform.local.kernel_version
20
+ when /(36-Ubuntu)|(37-Ubuntu)/
21
+ UI.debug "Ubuntu 10.04 identified"
22
+ Ubuntu10.new
23
+ else
24
+ UI.debug "Debian identified"
25
+ Debian.new
26
+ end
18
27
  else
28
+ UI.debug "Nothing identified"
19
29
  Base.new
20
30
  end
21
31
  end
@@ -8,7 +8,7 @@ actions:
8
8
  #- check: Checks whether the environment dependencies for the application are satisfied
9
9
  :developer:
10
10
  - compile: Downloads and compiles MiniSIP from scratch
11
- #- package: Packages a compiled application
11
+ - package: Downloads, compiles and packages MiniSIP from scratch
12
12
  #- publish: Submits a compiled package to the CSD package repository
13
13
  scopes:
14
14
  --- {}
@@ -6,38 +6,16 @@ module CSD
6
6
  module Minisip
7
7
  class Base < CSD::Application::Base
8
8
 
9
- def compile!
10
- define_root_path
11
- define_paths
12
- fix_ubuntu_10_04 and return if Options.only_fix_giomm
13
- UI.separator
14
- UI.info "This operation will download and compile MiniSIP.".green.bold
15
- UI.separator
16
- UI.info " Working directory: ".green + Path.work.to_s.yellow
17
- UI.info " Your Platform: ".green + Gem::Platform.local.humanize.to_s.yellow
18
- UI.info(" Application module: ".green + self.class.name.to_s.yellow) if Options.developer
19
- UI.separator
20
- if Options.help
21
- UI.info Options.helptext
22
- else
23
- unless Options.yes
24
- exit unless UI.ask_yes_no("Continue?".red.bold, true)
25
- end
26
- compile_process
27
- end
28
- UI.separator
29
- end
9
+ LIBRARIES = %w{ libmutil libmnetutil libmcrypto libmikey libmsip libmstun libminisip minisip } unless defined?(LIBRARIES)
30
10
 
31
- def compile_process
32
- before_compile
33
- Cmd.mkdir Path.work
34
- make_hdviper if checkout_hdviper or Options.dry
35
- checkout_minisip
36
- fix_ubuntu_10_04 if Gem::Platform.local.kernel_version == '#36-Ubuntu SMP Thu Jun 3 22:02:19 UTC 2010'
37
- make_minisip
38
- after_compile
11
+ def package
12
+ UI.error 'Currently not supported for this platform. Sorry.'
13
+ end
14
+
15
+ def compile
16
+ UI.error 'Currently not supported for this platform. Sorry.'
39
17
  end
40
-
18
+
41
19
  def define_root_path
42
20
  if Options.path
43
21
  if File.directory?(Options.path)
@@ -49,10 +27,12 @@ module CSD
49
27
  Path.root = Options.temp ? Dir.mktmpdir : Dir.pwd
50
28
  end
51
29
  end
52
-
30
+
53
31
  def define_paths
54
32
  Path.work = Pathname.new(File.join(Path.root, 'minisip'))
55
33
  Path.repository = Pathname.new(File.join(Path.work, 'repository'))
34
+ Path.plugins = Pathname.new(File.join(Path.work, 'plugins'))
35
+ Path.packaging = Pathname.new(File.join(Path.work, 'packaging'))
56
36
  Path.open_gl_display = Pathname.new(File.join(Path.repository, 'libminisip', 'source', 'subsystem_media', 'video', 'display', 'OpenGLDisplay.cxx'))
57
37
  Path.hdviper = Pathname.new(File.join(Path.work, 'hdviper'))
58
38
  Path.hdviper_x264 = Pathname.new(File.join(Path.hdviper, 'x264'))
@@ -68,97 +48,55 @@ module CSD
68
48
  Path.giomm_header = Pathname.new(File.join('/', 'usr', 'include', 'giomm-2.4', 'giomm.h'))
69
49
  end
70
50
 
71
- def checkout_hdviper
72
- if Path.hdviper.directory?
73
- UI.warn "Skipping hdviper, because the directory already exists: #{Path.hdviper}"
74
- else
75
- if Path.hdviper.parent.writable? or Options.dry
76
- UI.info "Downloading hdviper to: #{Path.hdviper}".green.bold
77
- Cmd.run("git clone http://github.com/csd/libraries.git #{Path.hdviper}", :die_on_failure => true)
78
- #Cmd.run("svn co --quiet svn://hdviper.org/hdviper/wp3/src #{Path.hdviper}")
79
- return true
80
- else
81
- UI.error "Could not download hdviper (no permission): #{Path.hdviper}"
82
- end
83
- end
84
- end
85
-
86
- def make_hdviper
87
- Cmd.cd Path.hdviper_x264
88
- Cmd.run('./configure')
89
- Cmd.run('make')
90
- Cmd.cd Path.hdviper_x264_test_x264api
91
- Cmd.run('make')
92
- end
93
-
94
51
  def checkout_minisip # TODO: Refactor because redudancy with checkout_hdviper
95
52
  if Path.repository.directory?
96
53
  UI.warn "Skipping repository download, because the directory already exists: #{Path.repository}"
97
54
  else
98
55
  if Path.repository.parent.writable? or Options.dry
99
56
  UI.info "Downloading minisip repository to: #{Path.repository}".green.bold
100
- Cmd.run("git clone http://github.com/csd/minisip.git #{Path.repository}", :die_on_failure => true)
57
+ Cmd.run("git clone http://github.com/csd/minisip.git #{Path.repository}")
101
58
  # Fixing hard-coded stuff
102
59
  Cmd.replace(Path.open_gl_display, '/home/erik', Path.build)
103
60
  else
104
- UI.error "Could not download minisip repository (no permission): #{Path.hdviper}"
61
+ UI.error "Could not download minisip repository (no permission): #{Path.repository}"
105
62
  end
106
63
  end
107
64
  end
108
65
 
109
- def fix_ubuntu_10_04
110
- # TODO put backup file in Path.xxx
111
- if File.exist?("#{Path.giomm_header}.ai-backup")
112
- UI.warn "giomm-2.4 seems to be fixed already, I won't touch it. Delete `#{"#{Path.giomm_header}.ai-backup"}´ to enforce it."
66
+ def checkout_plugins # TODO: Refactor because redudancy with checkout_hdviper
67
+ if Path.plugins.directory?
68
+ UI.warn "Skipping plugins download, because the directory already exists: #{Path.plugins}"
113
69
  else
114
- Path.new_giomm_header = File.join(Dir.mktmpdir, 'giomm.h')
115
- Cmd.copy(Path.giomm_header, Path.new_giomm_header)
116
- Cmd.replace(Path.new_giomm_header, '#include <giomm/socket.h>', "/* ----- AI COMMENTING OUT START ----- \n#include <giomm/socket.h>")
117
- Cmd.replace(Path.new_giomm_header, '#include <giomm/srvtarget.h>', "#include <giomm/srvtarget.h>\n ----- AI COMMENTING OUT END ----- */")
118
- Cmd.replace(Path.new_giomm_header, '# include <giomm/unixconnection.h>', "// #include <giomm/unixconnection.h> // COMMENTED OUT BY AI")
119
- Cmd.run("sudo cp #{Path.giomm_header} #{Path.giomm_header}.ai-backup")
120
- Cmd.run("sudo cp #{Path.new_giomm_header} #{Path.giomm_header}")
70
+ if Path.plugins.parent.writable? or Options.dry
71
+ UI.info "Downloading minisip plugins to: #{Path.plugins}".green.bold
72
+ Cmd.run("git clone http://github.com/csd/minisip-plugins.git #{Path.plugins}")
73
+ else
74
+ UI.error "Could not download minisip plugins (no permission): #{Path.plugins}"
75
+ end
121
76
  end
122
77
  end
123
78
 
124
- def make_minisip
125
- [Path.build, Path.build_include, Path.build_lib, Path.build_share, Path.build_share_aclocal].each { |target| Cmd.mkdir target }
126
- ['libmutil', 'libmnetutil', 'libmcrypto', 'libmikey', 'libmsip', 'libmstun', 'libminisip', 'minisip'].each do |library|
127
- directory = Pathname.new(File.join(Path.repository, library))
128
- next if Options.only and !Options.only.include?(library)
129
- if Cmd.cd(directory) or Options.dry
130
- if Options.bootstrap
131
- UI.info "Bootstrapping #{library}".green.bold
132
- Cmd.run("./bootstrap -I #{Path.build_share_aclocal.enquote}", :die_on_failure => true)
133
- end
134
- if Options.configure
135
- UI.info "Configuring #{library}".green.bold
136
- individual_options = case library
137
- when 'libminisip'
138
- %Q{--enable-debug --enable-video --disable-mil --enable-decklink --enable-opengl --disable-sdl CPPFLAGS="-I#{Path.hdviper_x264_test_x264api} -I#{Path.hdviper_x264}" LDFLAGS="#{File.join(Path.hdviper_x264_test_x264api, 'libx264api.a')} #{File.join(Path.hdviper_x264, 'libtidx264.a')} -lpthread -lrt"}
139
- #%Q{--enable-debug --enable-video --disable-mil --disable-decklink --enable-opengl --disable-sdl CPPFLAGS="-I#{Path.hdviper_x264}" LDFLAGS="#{File.join(Path.hdviper_x264, 'libx264.a')} -lpthread -lrt"}
140
- when 'minisip'
141
- %Q{--enable-debug --enable-video --enable-textui --enable-opengl}
142
- else
143
- ''
144
- end
145
- 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} --silent}, :die_on_failure => true)
146
- end
147
- if Options.make
148
- UI.info "Make #{library}".green.bold
149
- Cmd.run("make", :die_on_failure => true)
150
- end
151
- if Options.make_install
152
- maker_command = Options.make_dist ? 'dist' : 'install'
153
- UI.info "Make #{maker_command} #{library}".green.bold
154
- Cmd.run("make #{maker_command}", :die_on_failure => true)
155
- end
79
+ def checkout_hdviper
80
+ if Path.hdviper.directory?
81
+ UI.warn "Skipping hdviper, because the directory already exists: #{Path.hdviper}"
82
+ else
83
+ if Path.hdviper.parent.writable? or Options.dry
84
+ UI.info "Downloading hdviper to: #{Path.hdviper}".green.bold
85
+ Cmd.run("git clone http://github.com/csd/libraries.git #{Path.hdviper}")
86
+ #Cmd.run("svn co --quiet svn://hdviper.org/hdviper/wp3/src #{Path.hdviper}")
87
+ return true
156
88
  else
157
- UI.warn "Skipping minisip library #{library} because it not be found: #{directory}".green.bold
89
+ UI.error "Could not download hdviper (no permission): #{Path.hdviper}"
158
90
  end
159
91
  end
160
92
  end
161
93
 
94
+ def before_compile
95
+ end
96
+
97
+ def after_compile
98
+ end
99
+
162
100
  end
163
101
  end
164
102
  end
@@ -0,0 +1,13 @@
1
+ # encoding: utf-8
2
+ # This file gets eval'ed by the global options parser in lib/csd/rb
3
+ # TODO: There must be a nicer solution for this.
4
+
5
+ self.path = nil
6
+ opts.on("--path [PATH]",
7
+ "Defines the working directory manually.") do |value|
8
+ self.path = value
9
+ end
10
+
11
+ opts.on("--only libmcrypto,libmnetuli,etc.", Array, "Process only these libraries") do |list|
12
+ self.only = list
13
+ end
@@ -0,0 +1,134 @@
1
+ # encoding: utf-8
2
+ require File.join(File.dirname(__FILE__), 'base')
3
+
4
+ module CSD
5
+ module Application
6
+ module Minisip
7
+ class Unix < Base
8
+
9
+ def introduction
10
+ define_root_path
11
+ define_paths
12
+ UI.separator
13
+ UI.info " Working directory: ".green + Path.work.to_s.yellow
14
+ UI.info " Your Platform: ".green + Gem::Platform.local.humanize.to_s.yellow
15
+ UI.info(" Application module: ".green + self.class.name.to_s.yellow) if Options.developer
16
+ UI.separator
17
+ if Options.help
18
+ UI.info Options.helptext
19
+ exit
20
+ else
21
+ exit unless (Options.yes or UI.ask_yes_no("Continue?".red.bold, true))
22
+ end
23
+ end
24
+
25
+ def package
26
+ UI.separator
27
+ UI.info("This operation will package ".green.bold + "an already compiled".red.bold + " MiniSIP.".green.bold)
28
+ introduction
29
+ package!
30
+ end
31
+
32
+ def compile
33
+ UI.separator
34
+ UI.info "This operation will download and compile MiniSIP.".green.bold
35
+ introduction
36
+ compile!
37
+ end
38
+
39
+ def make_hdviper
40
+ Cmd.cd Path.hdviper_x264
41
+ Cmd.run('./configure')
42
+ Cmd.run('make')
43
+ Cmd.cd Path.hdviper_x264_test_x264api
44
+ Cmd.run('make')
45
+ end
46
+
47
+ def make_minisip
48
+ [Path.build, Path.build_include, Path.build_lib, Path.build_share, Path.build_share_aclocal].each { |target| Cmd.mkdir target }
49
+ LIBRARIES.each do |library|
50
+ directory = Pathname.new(File.join(Path.repository, library))
51
+ next if Options.only and !Options.only.include?(library)
52
+ if Cmd.cd(directory) or Options.dry or Options.reveal
53
+ if Options.bootstrap
54
+ UI.info "Bootstrapping #{library}".green.bold
55
+ Cmd.run("./bootstrap -I #{Path.build_share_aclocal.enquote}")
56
+ end
57
+ if Options.configure
58
+ UI.info "Configuring #{library}".green.bold
59
+ individual_options = case library
60
+ when 'libminisip'
61
+ %Q{--enable-debug --enable-video --disable-mil --enable-decklink --enable-opengl --disable-sdl CPPFLAGS="-I#{Path.hdviper_x264_test_x264api} -I#{Path.hdviper_x264}" LDFLAGS="#{File.join(Path.hdviper_x264_test_x264api, 'libx264api.a')} #{File.join(Path.hdviper_x264, 'libtidx264.a')} -lpthread -lrt"}
62
+ #%Q{--enable-debug --enable-video --disable-mil --disable-decklink --enable-opengl --disable-sdl CPPFLAGS="-I#{Path.hdviper_x264}" LDFLAGS="#{File.join(Path.hdviper_x264, 'libx264.a')} -lpthread -lrt"}
63
+ when 'minisip'
64
+ %Q{--enable-debug --enable-video --enable-textui --enable-opengl}
65
+ else
66
+ ''
67
+ end
68
+ 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} --silent})
69
+ end
70
+ if Options.make
71
+ UI.info "Make #{library}".green.bold
72
+ Cmd.run("make")
73
+ end
74
+ if Options.make_install
75
+ maker_command = Options.make_dist ? 'dist' : 'install'
76
+ UI.info "Make #{maker_command} #{library}".green.bold
77
+ Cmd.run("make #{maker_command}")
78
+ end
79
+ else
80
+ UI.warn "Skipping minisip library #{library} because it not be found: #{directory}".green.bold
81
+ end
82
+ end
83
+ end
84
+
85
+ def package!
86
+ Cmd.mkdir(Path.packaging)
87
+ LIBRARIES.each do |library|
88
+ directory = Pathname.new(File.join(Path.repository, library))
89
+ next if Options.only and !Options.only.include?(library)
90
+ UI.info "Making #{library} with target dist".green.bold
91
+ if Cmd.cd(directory) or Options.dry or Options.reveal
92
+ Cmd.run("make dist")
93
+
94
+ tar_filename = File.basename(Dir[File.join(directory, '*.tar.gz')].first)
95
+ Cmd.move(File.join(directory, tar_filename.to_s), Path.packaging) if tar_filename or Options.reveal
96
+
97
+ if Cmd.cd(Path.packaging) or Options.dry or Options.reveal
98
+ Cmd.run("tar -xzf #{tar_filename}")
99
+ tar_dirname = File.basename(tar_filename.to_s, '.tar.gz')
100
+ if Cmd.cd(File.join(Path.packaging, tar_dirname))
101
+ Cmd.run("dpkg-buildpackage -rfakeroot")
102
+ if library == 'minisip'
103
+ if Cmd.cd(Path.packaging)
104
+ package = File.basename(Dir[File.join(Path.packaging, "#{library}*.deb")].first)
105
+ Cmd.run("sudo dpkg -i #{package}") if package or Options.reveal
106
+ end
107
+ else
108
+ if Cmd.cd(Path.packaging)
109
+ package = File.basename(Dir[File.join(Path.packaging, "#{library}0*.deb")].first)
110
+ Cmd.run("sudo dpkg -i #{package}") if package or Options.reveal
111
+ dev_package = File.basename(Dir[File.join(Path.packaging, "#{library}-dev*.deb")].first)
112
+ Cmd.run("sudo dpkg -i #{dev_package}") if dev_package or Options.reveal
113
+ end
114
+ end
115
+ else
116
+ UI.error "Could not enter #{File.join(Path.packaging, tar_dirname)}."
117
+ end
118
+
119
+ else
120
+ UI.error "Could not enter #{Path.packaging}."
121
+ end
122
+
123
+ else
124
+ UI.error "Could not enter #{directory}."
125
+ end
126
+ end
127
+ Cmd.cd Path.root
128
+ Cmd.run 'minisip_gtkgui'
129
+ end
130
+
131
+ end
132
+ end
133
+ end
134
+ end
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+ require File.join(File.dirname(__FILE__), '..', 'unix')
3
+
4
+ module CSD
5
+ module Application
6
+ module Minisip
7
+ class Linux < Unix
8
+
9
+ def compile!
10
+ before_compile
11
+ Cmd.mkdir Path.work
12
+ make_hdviper if checkout_hdviper or Options.dry
13
+ checkout_minisip
14
+ checkout_plugins
15
+ make_minisip
16
+ after_compile
17
+ end
18
+
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+ require File.join(File.dirname(__FILE__), '..', 'linux')
3
+
4
+ module CSD
5
+ module Application
6
+ module Minisip
7
+ class Debian < Linux
8
+
9
+ # A list of apt-get packages that are required by this application.
10
+ #
11
+ DEBIAN_DEPENDENCIES = %w{ libssl-dev libgtkmm-2.4-dev libglademm-2.4-dev libsdl-dev git-core subversion automake libtool libltdl3-dev build-essential libavcodec-dev libswscale-dev libasound2-dev libsdl-ttf2.0-dev nasm yasm ffmpeg }
12
+
13
+ def before_compile
14
+ #fix_aclocal_dirlist
15
+ install_aptitude_dependencies if Options.apt_get
16
+ end
17
+
18
+ def after_compile
19
+ ldconfig_and_gtkgui
20
+ end
21
+
22
+ def install_aptitude_dependencies
23
+ Cmd.run("sudo apt-get update")
24
+ DEBIAN_DEPENDENCIES.each do |apt|
25
+ Cmd.run("sudo apt-get install #{apt} --yes --fix-missing")
26
+ end
27
+ end
28
+
29
+ def fix_aclocal_dirlist
30
+ return
31
+ content = '/usr/local/share/aclocal'
32
+ target = Pathname.new('/usr/share/aclocal/dirlist')
33
+ unless target.exist? and File.new(target).read == content # TODO: replace with File.read
34
+ begin
35
+ File.new(target, 'w').write(content).close
36
+ rescue Errno::EACCES => e
37
+ say "Please run the following commands with the right permissions.".red.bold
38
+ say " sudo rm /usr/share/aclocal/dirlist".green.bold
39
+ say " sudo touch /usr/share/aclocal/dirlist".green.bold
40
+ say " sudo echo /usr/local/share/aclocal >> /usr/share/aclocal/dirlist".green.bold
41
+ exit
42
+ end
43
+ end
44
+ end
45
+
46
+ def ldconfig_and_gtkgui
47
+ Cmd.run(Path.build_gtkgui)
48
+ end
49
+
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,34 @@
1
+ # encoding: utf-8
2
+ require File.join(File.dirname(__FILE__), '..', 'debian')
3
+
4
+ module CSD
5
+ module Application
6
+ module Minisip
7
+ class Ubuntu10 < Debian
8
+
9
+ def before_compile
10
+ super
11
+ fix_ubuntu_10_04
12
+ exit if Options.only_fix_giomm
13
+ end
14
+
15
+ def fix_ubuntu_10_04
16
+ # TODO put backup file in Path.xxx
17
+ if File.exist?("#{Path.giomm_header}.ai-backup")
18
+ UI.warn "giomm-2.4 seems to be fixed already, I won't touch it. Delete `#{"#{Path.giomm_header}.ai-backup"}´ to enforce it."
19
+ else
20
+ Path.new_giomm_header = File.join(Dir.mktmpdir, 'giomm.h')
21
+ Cmd.copy(Path.giomm_header, Path.new_giomm_header)
22
+ Cmd.replace(Path.new_giomm_header, '#include <giomm/socket.h>', "/* ----- AI COMMENTING OUT START ----- \n#include <giomm/socket.h>")
23
+ Cmd.replace(Path.new_giomm_header, '#include <giomm/tcpconnection.h>', "#include <giomm/tcpconnection.h>\n ----- AI COMMENTING OUT END ----- */")
24
+ Cmd.replace(Path.new_giomm_header, '# include <giomm/unixconnection.h>', "// #include <giomm/unixconnection.h> // COMMENTED OUT BY AI")
25
+ Cmd.run("sudo cp #{Path.giomm_header} #{Path.giomm_header}.ai-backup")
26
+ Cmd.run("sudo cp #{Path.new_giomm_header} #{Path.giomm_header}")
27
+ end
28
+ end
29
+
30
+
31
+ end
32
+ end
33
+ end
34
+ end
@@ -13,10 +13,13 @@ module CSD
13
13
  #
14
14
  def self.find(app_name)
15
15
  begin
16
+ UI.debug "Applications.find: Attempting to require `#{File.join(Path.applications, app_name.to_s)}´."
16
17
  require File.join(Path.applications, app_name.to_s)
18
+ UI.debug "Applications.find: Attempting to load `#{app_name}´."
17
19
  ActiveSupport::Inflector.constantize "CSD::Application::#{app_name.camelize}"
18
- rescue LoadError
19
- UI.debug "The Application `#{app_name}´ could not be loaded properly."
20
+ rescue LoadError => e
21
+ UI.debug "Applications.find: The Application `#{app_name}´ could not be loaded properly."
22
+ UI.debug " Reason: #{e}"
20
23
  nil
21
24
  end
22
25
  end
@@ -25,7 +28,9 @@ module CSD
25
28
  result = []
26
29
  Dir.directories(Path.applications) do |dir|
27
30
  next if dir == 'default'
31
+ UI.debug "Applications.all: Identified application directory `#{dir}´."
28
32
  if app = find(dir)
33
+ UI.debug "Applications.all: The application `#{dir}´ is valid."
29
34
  block_given? ? yield(app) : result << app
30
35
  end
31
36
  end
data/lib/csd/commands.rb CHANGED
@@ -100,9 +100,17 @@ module CSD
100
100
  # Copies one or several files to the destination
101
101
  #
102
102
  def copy(src, dest)
103
+ UI.info "Copying `#{src}´ to `#{dest}´".cyan
103
104
  FileUtils.cp(src, dest) unless (Options.dry or Options.reveal)
104
105
  end
105
106
 
107
+ # Moves one or several files to the destination
108
+ #
109
+ def move(src, dest)
110
+ UI.info "Moving `#{src}´ to `#{dest}´".cyan
111
+ FileUtils.mv(src, dest) unless (Options.dry or Options.reveal)
112
+ end
113
+
106
114
  # This returns the current pwd. However, it will return a fake result if we are in reveal-commands-mode.
107
115
  #
108
116
  def pwd
@@ -163,12 +171,12 @@ module CSD
163
171
  ret << line
164
172
  end
165
173
  end
166
- die_if_last_command_had_errors if params[:exit_on_failure]
174
+ die_if_last_command_had_errors if params[:die_on_failure]
167
175
  ret
168
176
  end
169
177
 
170
178
  def die_if_last_command_had_errors
171
- UI.die "The last command was unsuccessful." unless $?.try(:success?)
179
+ UI.die "The last command was unsuccessful." unless $?.success?
172
180
  end
173
181
 
174
182
  end
@@ -182,7 +190,7 @@ module CSD
182
190
  # Wrapping the CommandsInstance class
183
191
  #
184
192
  class Cmd
185
- COMMANDS = %w{ mkdir cd run replace copy }
193
+ COMMANDS = %w{ mkdir cd run replace copy move } unless defined?(COMMANDS)
186
194
 
187
195
  def self.instance
188
196
  @@instance ||= CommandsInstance.new
data/lib/csd/ui/ui.rb CHANGED
@@ -6,7 +6,7 @@ module CSD
6
6
 
7
7
  # These are all possible user interactions provided by the UI
8
8
  #
9
- INTERACTIONS = %w{ separator debug info warn error ask ask_yes_no }
9
+ INTERACTIONS = %w{ separator debug info warn error ask ask_yes_no die }
10
10
 
11
11
  def separator
12
12
  say
@@ -21,18 +21,16 @@ module CSD
21
21
  end
22
22
 
23
23
  def warn(message)
24
- say message.red if !Options.silent
24
+ say 'NOTE: '.red + message.red if !Options.silent
25
25
  end
26
26
 
27
27
  def error(message)
28
- if !Options.silent
29
- say 'ERROR: '.red.blink + message.red
30
- end
28
+ say('ERROR: '.red.blink + message.red) if !Options.silent
31
29
  end
32
30
 
33
31
  def die(message)
34
- say message.red.blink if !Options.silent
35
- exit
32
+ say('ERROR: '.red.blink + message.red) if !Options.silent
33
+ abort
36
34
  end
37
35
 
38
36
  protected
data/lib/csd/version.rb CHANGED
@@ -5,6 +5,6 @@ module CSD
5
5
 
6
6
  # This global variable holds the version number of this gem by reading the VERSION file.
7
7
  #
8
- Version = VERSION = File.read(File.join(Path.gem, 'VERSION'))
8
+ Version = VERSION = File.read(File.join(Path.gem, 'VERSION')) unless defined?(Version)
9
9
 
10
10
  end
data/test/helper.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'test/unit'
3
- require 'shoulda'
4
3
  require 'tmpdir'
4
+ require 'shoulda'
5
5
  require 'redgreen'
6
6
 
7
7
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
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
  - 1
9
- - 4
10
- version: 0.1.4
9
+ - 5
10
+ version: 0.1.5
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-13 00:00:00 +02:00
18
+ date: 2010-07-14 00:00:00 +02:00
19
19
  default_executable: ai
20
20
  dependencies: []
21
21
 
@@ -247,7 +247,11 @@ files:
247
247
  - lib/csd/application/minisip/error.rb
248
248
  - lib/csd/application/minisip/options/common.rb
249
249
  - lib/csd/application/minisip/options/compile.rb
250
- - lib/csd/application/minisip/unix/base.rb
250
+ - lib/csd/application/minisip/options/package.rb
251
+ - lib/csd/application/minisip/unix.rb
252
+ - lib/csd/application/minisip/unix/linux.rb
253
+ - lib/csd/application/minisip/unix/linux/debian.rb
254
+ - lib/csd/application/minisip/unix/linux/debian/ubuntu10.rb
251
255
  - lib/csd/application/opensips/about.yml
252
256
  - lib/csd/applications.rb
253
257
  - lib/csd/commands.rb
@@ -283,7 +287,7 @@ homepage: http://github.com/csd/csd
283
287
  licenses: []
284
288
 
285
289
  post_install_message: "\n\
286
- ================================================================================================\n\n Thank you for installing the Communication Systems and Design Automated Installer!\n\n You can run it by just typing `ai\xC2\xB4 in your command line.\n\n Note: On Debian and Ubuntu the executable `ai\xC2\xB4 is not in your PATH by default.\n You can fix this by adding it to your .bashrc file with this command:\n \n echo \"export PATH=\\$PATH:$(gem env | grep \"E D\" | sed \"s/[^\\w]* //\")\" >> ~/.bashrc;. ~/.bashrc\n \n\
290
+ ================================================================================================\n\n Thank you for installing the Communication Systems and Design 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 not in your PATH by default.\n You can fix this by adding it to your .bashrc file with this command:\n \n echo \"export PATH=\\$PATH:$(gem env | grep \"E D\" | sed \"s/[^\\w]* //\")\" >> ~/.bashrc;. ~/.bashrc\n \n\
287
291
  ================================================================================================\n "
288
292
  rdoc_options:
289
293
  - --charset=UTF-8
@@ -1,54 +0,0 @@
1
- # encoding: utf-8
2
- require File.join(File.dirname(__FILE__), '..', 'base')
3
-
4
- module CSD
5
- module Application
6
- module Minisip
7
- module Unix
8
- class Base < CSD::Application::Minisip::Base
9
-
10
- # A list of apt-get packages that are required by this application.
11
- #
12
- DEBIAN_DEPENDENCIES = %w{ libssl-dev libglademm-2.4-dev libsdl-dev git-core subversion automake libtool libltdl3-dev build-essential libavcodec-dev libswscale-dev libasound2-dev libsdl-ttf2.0-dev nasm yasm ffmpeg }
13
-
14
- def before_compile
15
- #fix_aclocal_dirlist
16
- install_aptitude_dependencies if Options.apt_get
17
- end
18
-
19
- def after_compile
20
- ldconfig_and_gtkgui
21
- end
22
-
23
- def install_aptitude_dependencies
24
- DEBIAN_DEPENDENCIES.each do |apt|
25
- Cmd.run("sudo apt-get install #{apt} --yes --fix-missing", :die_on_failure => true)
26
- end
27
- end
28
-
29
- def fix_aclocal_dirlist
30
- return
31
- content = '/usr/local/share/aclocal'
32
- target = Pathname.new('/usr/share/aclocal/dirlist')
33
- unless target.exist? and File.new(target).read == content # TODO: replace with File.read
34
- begin
35
- File.new(target, 'w').write(content).close
36
- rescue Errno::EACCES => e
37
- say "Please run the following commands with the right permissions.".red.bold
38
- say " sudo rm /usr/share/aclocal/dirlist".green.bold
39
- say " sudo touch /usr/share/aclocal/dirlist".green.bold
40
- say " sudo echo /usr/local/share/aclocal >> /usr/share/aclocal/dirlist".green.bold
41
- exit
42
- end
43
- end
44
- end
45
-
46
- def ldconfig_and_gtkgui
47
- Cmd.run(Path.build_gtkgui)
48
- end
49
-
50
- end
51
- end
52
- end
53
- end
54
- end