csd 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -11,6 +11,7 @@ begin
11
11
  gemspec.homepage = "http://github.com/csd/csd"
12
12
  gemspec.authors = ["Technology Transfer Alliance Team"]
13
13
  gemspec.add_dependency "term-ansicolor", ">= 0"
14
+ gemspec.executables = ["csd"]
14
15
  end
15
16
  rescue LoadError
16
17
  puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/bin/csd CHANGED
@@ -3,4 +3,6 @@
3
3
  require 'rubygems' # As a side note: Rubygems is already included for Ruby >= 1.9
4
4
  require 'csd'
5
5
 
6
- CSD::Loader.new
6
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'csd') # For local development
7
+
8
+ CSD::Loader.new
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{csd}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
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"]
@@ -27,9 +27,11 @@ Gem::Specification.new do |s|
27
27
  "VERSION",
28
28
  "bin/csd",
29
29
  "csd.gemspec",
30
+ "lib/apps/minisip.rb",
30
31
  "lib/csd.rb",
31
32
  "lib/csd/installer.rb",
32
33
  "lib/csd/loader.rb",
34
+ "lib/csd/shared.rb",
33
35
  "test/helper.rb",
34
36
  "test/test_csd.rb"
35
37
  ]
@@ -0,0 +1,47 @@
1
+ module CSD
2
+ class Minisip
3
+
4
+ include Shared
5
+
6
+ def initialize(options={})
7
+ @options = options[:options]
8
+
9
+ unless Gem::Platform.local.os == 'linux'
10
+ puts "Sorry, Linux only at the moment"
11
+ exit 1
12
+ end
13
+
14
+ unless File.directory?('minisip')
15
+ log "Creating directory minisip"
16
+ Dir.mkdir('minisip')
17
+ end
18
+
19
+ Dir.chdir('minisip')
20
+ root_dir = Dir.pwd
21
+
22
+ ['git-core', 'automake', 'libssl-dev', 'libtool', 'libglademm-2.4-dev'].each do |apt|
23
+ run_command("sudo apt-get install #{apt}")
24
+ end
25
+
26
+ unless File.directory?('trunk')
27
+ log "Checking out minisip trunk"
28
+ checkout_trunk
29
+ end
30
+
31
+ run_command "sudo echo /usr/local/share/aclocal >> /usr/share/aclocal/dirlist"
32
+
33
+ ['libmutil', 'libmnetutil', 'libmcrypto', 'libmikey', 'libmsip', 'libmstun', 'libminisip'].each do |lib|
34
+ Dir.chdir File.join(root_dir, 'trunk', lib)
35
+ log "Going through #{Dir.pwd}"
36
+ end
37
+
38
+ end
39
+
40
+ def checkout_trunk
41
+ run_command("git clone http://github.com/csd/minisip")
42
+ end
43
+
44
+ end
45
+
46
+
47
+ end
@@ -1,8 +1,19 @@
1
1
  module CSD
2
2
  class Installer
3
3
 
4
- def initialize(*args)
4
+ def initialize(options={})
5
+ @options = options[:options]
6
+ @actions = options[:actions]
5
7
 
8
+ case @actions.first
9
+ when 'minisip'
10
+ Minisip.new :options => @options
11
+ else
12
+ p "Unknown application: #{@actions.first}"
13
+ end
14
+
15
+
16
+ self
6
17
  end
7
18
 
8
19
 
@@ -1,11 +1,18 @@
1
+ require File.join(File.dirname(__FILE__), 'shared')
1
2
  require File.join(File.dirname(__FILE__), 'installer')
3
+ require File.join(File.dirname(__FILE__), '..', 'apps', 'minisip')
4
+
2
5
  require 'optparse'
6
+ require 'term/ansicolor'
3
7
 
4
8
  module CSD
5
9
  class Loader
6
10
 
11
+ include Gem::UserInteraction
12
+
7
13
  def initialize
8
14
  @options = {}
15
+ @actions = ARGV
9
16
  OptionParser.new do |opts|
10
17
  opts.banner = "Usage: csd [options]"
11
18
  opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
@@ -13,17 +20,28 @@ module CSD
13
20
  end
14
21
  end.parse!
15
22
 
16
- case ARGV.first
23
+ introduction
24
+
25
+ case @actions.shift
17
26
  when 'install'
18
- installer = Installer.new
27
+ Installer.new :options => @options, :actions => @actions
19
28
  else
20
29
  puts 'Run csd -h to get help.'
21
30
  end
22
31
  self
23
32
  end
24
33
 
25
-
26
-
34
+ def introduction
35
+ puts
36
+ puts "The current working directory is:"
37
+ puts Dir.pwd
38
+ puts
39
+ exit unless ask_yes_no("Continue?", true)
40
+ end
27
41
 
28
42
  end
43
+ end
44
+
45
+ class String
46
+ include Term::ANSIColor
29
47
  end
@@ -0,0 +1,26 @@
1
+ require 'term/ansicolor'
2
+ require 'rbconfig'
3
+
4
+ module CSD
5
+ module Shared
6
+
7
+ include Term::ANSIColor
8
+
9
+ def run_command(cmd)
10
+ log "Running command: #{cmd}".green.bold
11
+ ret = ''
12
+ IO.popen(cmd) do |stdout|
13
+ stdout.each do |line|
14
+ log line
15
+ ret << line
16
+ end
17
+ end
18
+ ret
19
+ end
20
+
21
+ def log(msg)
22
+ puts msg if @options[:verbose]
23
+ end
24
+
25
+ end
26
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Technology Transfer Alliance Team
@@ -47,9 +47,11 @@ files:
47
47
  - VERSION
48
48
  - bin/csd
49
49
  - csd.gemspec
50
+ - lib/apps/minisip.rb
50
51
  - lib/csd.rb
51
52
  - lib/csd/installer.rb
52
53
  - lib/csd/loader.rb
54
+ - lib/csd/shared.rb
53
55
  - test/helper.rb
54
56
  - test/test_csd.rb
55
57
  has_rdoc: true