csd 0.1.17 → 0.1.18

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.17
1
+ 0.1.18
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{csd}
8
- s.version = "0.1.17"
8
+ s.version = "0.1.18"
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-08-04}
12
+ s.date = %q{2010-08-10}
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}
@@ -24,6 +24,7 @@ module CSD
24
24
  download
25
25
  extract
26
26
  apply
27
+ add_boot_loader
27
28
  send_notification
28
29
  end
29
30
 
@@ -75,17 +76,28 @@ module CSD
75
76
  Cmd.run "sudo dpkg -i #{file.first || '[DRIVER FILE FOR THIS ARCHITECTURE]'}", :announce_pwd => false
76
77
  end
77
78
 
79
+ def add_boot_loader
80
+ content = Path.kernel_module.file? ? File.read(Path.kernel_module) : ''
81
+ if content !~ /\nblackmagic/m
82
+ UI.info "Adding Blackmagic drivers to the boot loader".green.bold
83
+ Cmd.touch_and_replace_content Path.new_kernel_module, "#{content}\nblackmagic"
84
+ Cmd.run "sudo cp #{Path.new_kernel_module} #{Path.kernel_module}", :announce_pwd => false
85
+ end
86
+ end
87
+
78
88
  def send_notification
79
89
  Cmd.run %{notify-send --icon=gdm-setup "DeckLink installation complete" "You are now ready to use your Blackmagic Design DeckLink device." }, :internal => true, :die_on_failure => false
80
90
  end
81
91
 
82
92
  def define_relative_paths
83
- blacklink_repository = 'http://www.blackmagic-design.com/downloads/software/'
84
- decklink_basename = 'DeckLink_Linux_7.7.3'
85
- decklink_extension = '.tar.gz'
86
- Path.decklink_url = blacklink_repository + decklink_basename + decklink_extension
87
- Path.tar = Pathname.new(File.join(Path.work, "#{decklink_basename + decklink_extension}"))
88
- Path.packages = Pathname.new(File.join(Path.work, decklink_basename))
93
+ blacklink_repository = 'http://www.blackmagic-design.com/downloads/software/'
94
+ decklink_basename = 'DeckLink_Linux_7.7.3'
95
+ decklink_extension = '.tar.gz'
96
+ Path.decklink_url = blacklink_repository + decklink_basename + decklink_extension
97
+ Path.tar = Pathname.new(File.join(Path.work, "#{decklink_basename + decklink_extension}"))
98
+ Path.packages = Pathname.new(File.join(Path.work, decklink_basename))
99
+ Path.new_kernel_module = Pathname.new(File.join(Path.work, 'modules'))
100
+ Path.kernel_module = Pathname.new(File.join('/', 'etc', 'modules'))
89
101
  end
90
102
 
91
103
  end
@@ -46,7 +46,7 @@ module CSD
46
46
  def cleanup_working_directory
47
47
  if !Options.work_dir and Options.temp and !Options.this_user and Path.work.directory?
48
48
  UI.info "Removing working directory".green.bold
49
- UI.debug "MILESTONE: deleting-work-dir"
49
+ UI.debug "MILESTONE: deleting_work_dir"
50
50
  # TODO: Make this Windows working
51
51
  Cmd.run "sudo rm -Rf #{Path.work}", :announce_pwd => false
52
52
  end
@@ -48,19 +48,29 @@ module CSD
48
48
 
49
49
  when 'linux'
50
50
  # Linux
51
- UI.debug "#{self}.instance supports Linux"
52
- UI.debug "#{self}.instance analyzes the Linux kernel release #{Gem::Platform.local.kernel_release.to_s.enquote}"
53
- case Gem::Platform.local.kernel_release
54
-
55
- when '2.6.32-21-generic', '2.6.32-22-generic'
56
- # Ubuntu 10.04
57
- UI.debug "#{self}.instance supports Ubuntu 10.04"
58
- Ubuntu10.new
51
+ case Gem::Platform.local.cpu
52
+
53
+ when 'x86'
54
+ # 32 bit
55
+ UI.debug "#{self}.instance supports Linux (32 bit)"
56
+ UI.debug "#{self}.instance analyzes the Linux kernel release #{Gem::Platform.local.kernel_release.to_s.enquote}"
57
+ case Gem::Platform.local.kernel_release
58
+
59
+ when '2.6.32-21-generic', '2.6.32-22-generic'
60
+ # Ubuntu 10.04
61
+ UI.debug "#{self}.instance supports Ubuntu 10.04"
62
+ Ubuntu10.new
63
+
64
+ else
65
+ # Any other Linux (currently only Debian is supported)
66
+ UI.debug "#{self}.instance supports Debian"
67
+ Debian.new
68
+ end
59
69
 
60
70
  else
61
- # Any other Linux (currently only Debian is supported)
62
- UI.debug "#{self}.instance supports Debian"
63
- Debian.new
71
+ # 64 bit
72
+ UI.debug "#{self}.instance found the architecture to be other than 'x86', but 64 bit is not supported"
73
+ raise Error::Minisip::Amd64NotSupported, "Sorry, 64-bit systems are currently not supported by MiniSIP."
64
74
  end
65
75
 
66
76
  else
@@ -24,7 +24,7 @@ module CSD
24
24
  #
25
25
  def compile
26
26
  UI.debug "#{self}.compile was called"
27
- UI.debug "The current Options are: #{CSD.options.inspect}"
27
+ UI.debug "The current Options are: #{::CSD.options.inspect_for_debug}"
28
28
  remove_ffmpeg
29
29
  if Path.repository.directory? and !Options.reveal
30
30
  UI.warn "The MiniSIP source code will not be downloaded, because the directory #{Path.repository.enquote} already exists."
@@ -86,7 +86,7 @@ module CSD
86
86
  Cmd.git_clone 'MiniSIP repository', 'http://github.com/csd/minisip.git', Path.repository
87
87
  if Options.branch
88
88
  Cmd.cd Path.repository, :internal => true
89
- Cmd.run "git pull origin #{Options.branch}"
89
+ Cmd.run "git checkout -b #{Options.branch} origin/#{Options.branch}"
90
90
  end
91
91
  end
92
92
 
@@ -112,8 +112,8 @@ module CSD
112
112
  # +dirlist+ in <tt>/usr/share/aclocal</tt> which contains the path to the other directory.
113
113
  #
114
114
  def modify_dirlist
115
- Path.dirlist = Pathname.new File.join('/', 'usr', 'share', 'aclocal', 'dirlist')
116
- if !Path.dirlist.file? and Gem::Platform.local.debian?
115
+ Path.dirlist = Pathname.new File.join('/', 'usr', 'share', 'aclocal', 'dirlist')
116
+ if !Path.dirlist.file? and Gem::Platform.local.debian? or Options.reveal
117
117
  UI.info "Fixing broken Debian aclocal path".green.bold
118
118
  Path.new_dirlist = Pathname.new File.join(Path.work, 'dirlist')
119
119
  Cmd.touch_and_replace_content Path.new_dirlist, '/usr/local/share/aclocal'
@@ -122,6 +122,7 @@ module CSD
122
122
  end
123
123
 
124
124
  def link_libraries
125
+ return if Options.this_user
125
126
  UI.info "Linking shared MiniSIP libraries".green.bold
126
127
  Cmd.run "sudo ldconfig #{Path.build_lib_libminisip_so}", :announce_pwd => false
127
128
  end
@@ -29,6 +29,7 @@ Categories=Application;Internet;Network;Chat;AudioVideo}
29
29
  Cmd.run "nautilus #{Path.build_bin}"
30
30
  else
31
31
  create_desktop_entry
32
+ update_gnome_menu_cache
32
33
  end
33
34
  send_notification
34
35
  end
@@ -44,6 +45,16 @@ Categories=Application;Internet;Network;Chat;AudioVideo}
44
45
  Cmd.run "sudo mv #{Path.new_desktop_entry} #{Path.minisip_desktop_entry}", :announce_pwd => false
45
46
  end
46
47
 
48
+ # Every desktop entry file not created via dpkg will not update the gnome menus cache. We need to
49
+ # do this manually here. See https://bugs.launchpad.net/ubuntu/+source/gnome-menus/+bug/581838
50
+ # If this step would not be done, the MiniSIP menu item would disappear after restarting Ubuntu.
51
+ #
52
+ def update_gnome_menu_cache
53
+ 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
54
+ end
55
+
56
+ # Sends an OSD notification.
57
+ #
47
58
  def send_notification
48
59
  Cmd.run %{notify-send --icon=minisip_gnome "MiniSIP installation complete" "Please have a look in your Applications menu -> Internet." }, :internal => true, :die_on_failure => false
49
60
  end
@@ -8,6 +8,7 @@ module CSD
8
8
  # See 'csd/error' to find out which status code range has been assigned to MiniSIP
9
9
 
10
10
  class BuildDirNotFound < CSDError; status_code(200); end
11
+ class Amd64NotSupported < CSDError; status_code(201); end
11
12
 
12
13
  module Core
13
14
  class FFmpegInstalled < CSDError; status_code(210); end
@@ -17,7 +17,7 @@ opts.on("--github-tar","Instead of fetching git repositories from Github, use ta
17
17
  self.github_tar = value
18
18
  end
19
19
 
20
- opts.on('--branch BRANCH', 'Choose another branch than `master´ when downloading the source code') do |lib|
20
+ opts.on('--branch BRANCH', 'Choose another branch than `master´ when downloading the source code') do |value|
21
21
  self.branch = value
22
22
  end
23
23
 
@@ -16,6 +16,14 @@ module CSD
16
16
  self.testmode = testmode
17
17
  end
18
18
 
19
+ # A nicer version of inspect (it only removes the helptext attribute)
20
+ #
21
+ def inspect_for_debug
22
+ result = self.dup
23
+ result.helptext = nil
24
+ result.inspect
25
+ end
26
+
19
27
  end
20
28
  end
21
29
  end
@@ -53,6 +53,7 @@ class TestMinisip < Test::Unit::TestCase
53
53
  out, err = capture { Core.checkout }
54
54
  assert_match /git clone /, out
55
55
  assert_no_match /git pull/, out
56
+ assert_no_match /git checkout/, out
56
57
  assert err.empty?
57
58
  end
58
59
 
@@ -60,7 +61,7 @@ class TestMinisip < Test::Unit::TestCase
60
61
  Options.branch = 'cuttingedge'
61
62
  out, err = capture { Core.checkout }
62
63
  assert_match /git clone /, out
63
- assert_match /git pull .+ cuttingedge/, out
64
+ assert_match /git checkout .+ cuttingedge/, out
64
65
  assert err.empty?
65
66
  end
66
67
 
@@ -82,6 +83,14 @@ class TestMinisip < Test::Unit::TestCase
82
83
  assert_match /MILESTONE: removing_ffmpeg.+MILESTONE: processing_libminisip/m, out
83
84
  assert_no_match /MILESTONE: processing_libminisip.+MILESTONE: removing_ffmpeg/m, out
84
85
  end
86
+
87
+ should "not link the library in this-user-mode" do
88
+ out, err = capture { Core.compile }
89
+ assert_match /ldconfig/, out
90
+ Options.this_user=true
91
+ out, err = capture { Core.compile }
92
+ assert_no_match /ldconfig/, out
93
+ end
85
94
 
86
95
  end # context "in theory when compiling"
87
96
 
@@ -9,11 +9,8 @@ class TestApplicationBase < Test::Unit::TestCase
9
9
  context "An application instance" do
10
10
 
11
11
  setup do
12
- ARGV.clear
13
12
  Options.clear
14
- @name = 'minisip'
15
- ARGV.push(@name)
16
- assert @app = Applications.find(@name).instance
13
+ @app = Application::Base.new
17
14
  end
18
15
 
19
16
  should "use a temporary directory as working directory when the --temp options is given" do
@@ -48,7 +45,7 @@ class TestApplicationBase < Test::Unit::TestCase
48
45
  should "take the current pwd with a subdirectory in the name of the application as working directory by default" do
49
46
  @app.define_working_directory
50
47
  assert_kind_of Pathname, Path.work
51
- assert_equal File.join(Dir.pwd, "#{@name}.ai"), Path.work.to_s
48
+ assert_equal File.join(Dir.pwd, "application.ai"), Path.work.to_s
52
49
  end
53
50
 
54
51
  end # context "An application instance"
@@ -17,6 +17,14 @@ class TestOpenStruct < Test::Unit::TestCase
17
17
  assert_nil @os.steve
18
18
  end
19
19
 
20
+ should "give a nice debugging output" do
21
+ @os.myoption = 'I am cool'
22
+ @os.helptext = 'I am helpful'
23
+ assert_match /helptext/, @os.inspect
24
+ assert_no_match /helptext=nil/, @os.inspect
25
+ assert_match /helptext=nil/, @os.inspect_for_debug
26
+ end
27
+
20
28
  end
21
29
 
22
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: 57
4
+ hash: 63
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 17
10
- version: 0.1.17
9
+ - 18
10
+ version: 0.1.18
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-08-04 00:00:00 +02:00
18
+ date: 2010-08-10 00:00:00 +02:00
19
19
  default_executable: ai
20
20
  dependencies: []
21
21