santa 0.1 → 0.2

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.
data/CHANGELOG CHANGED
@@ -1,2 +1,3 @@
1
+ v0.2. support ppa repos
1
2
  v0.1. proof of concept
2
3
 
data/Manifest CHANGED
@@ -1,7 +1,7 @@
1
1
  CHANGELOG
2
+ Manifest
2
3
  README.md
3
4
  Rakefile
4
5
  bin/santa
5
6
  lib/santa.rb
6
7
  test/test_all.rb
7
- Manifest
data/README.md CHANGED
@@ -8,7 +8,13 @@ You can with santa.
8
8
 
9
9
  $ gem install santa
10
10
 
11
- $ echo deb "ruby1.9.1-dev" > Debfile
11
+ $ cat <<EOF > Debfile
12
+ deb "ruby1.9.1-dev"
13
+ deb "nginx", repo: "ppa:nginx/stable"
14
+ EOF
12
15
 
13
16
  $ santa
14
-
17
+ --> sudo add-apt-repository -y ppa:nginx/stable
18
+ --> sudo apt-get update
19
+ --> sudo apt-get install -y ruby1.9.1-dev
20
+ --> sudo apt-get install -y nginx
data/bin/santa CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- raise "Where is the Debfile?" unless if File.readable? 'Debfile'
3
+ require 'santa'
4
4
 
5
- Santa.new(File.read('Debfile'))
5
+ raise "Where is the Debfile?" unless File.readable? 'Debfile'
6
+
7
+ Santa.new(File.read('Debfile')).go!
@@ -13,7 +13,10 @@ class Santa
13
13
  end
14
14
 
15
15
  def deb(debname, opts={})
16
- append_cmd 'apt-get', 'install', debname.to_s
16
+ if(r = opts.delete(:repo))
17
+ repo(*r)
18
+ end
19
+ append_cmd 'apt-get', 'install', '-y', debname.to_s
17
20
  end
18
21
 
19
22
  def cmd(*cmds)
@@ -40,7 +43,7 @@ class Santa
40
43
 
41
44
  def repo(*repos, &bl)
42
45
  repos.each {|r| prepend_cmd 'add-apt-repository', '-y', r.to_s }
43
- prepend_cmd 'apt-get', 'install', 'python-software-properties' unless executable? 'add-apt-repository'
46
+ prepend_cmd 'apt-get', 'install', '-y', 'python-software-properties' unless executable? 'add-apt-repository'
44
47
 
45
48
  instance_eval &bl if bl
46
49
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "santa"
5
- s.version = "0.1"
5
+ s.version = "0.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Andrew Snow"]
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.email = "andrew@modulus.org"
12
12
  s.executables = ["santa"]
13
13
  s.extra_rdoc_files = ["CHANGELOG", "README.md", "bin/santa", "lib/santa.rb"]
14
- s.files = ["CHANGELOG", "README.md", "Rakefile", "bin/santa", "lib/santa.rb", "test/test_all.rb", "Manifest", "santa.gemspec"]
14
+ s.files = ["CHANGELOG", "Manifest", "README.md", "Rakefile", "bin/santa", "lib/santa.rb", "test/test_all.rb", "santa.gemspec"]
15
15
  s.homepage = "https://github.com/andys/santa"
16
16
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Santa", "--main", "README.md"]
17
17
  s.require_paths = ["lib"]
@@ -9,7 +9,7 @@ class TestSanta < Test::Unit::TestCase
9
9
 
10
10
  def test_command
11
11
  @santa.deb 'xyz'
12
- assert_equal [["apt-get", "update"], ["apt-get", "install", "xyz"]], @santa.commands_to_run
12
+ assert_equal [["apt-get", "update"], ["apt-get", "install", "-y", "xyz"]], @santa.commands_to_run
13
13
  end
14
14
 
15
15
  def test_add_repo
@@ -18,9 +18,17 @@ class TestSanta < Test::Unit::TestCase
18
18
  deb 'xyz'
19
19
  end
20
20
  end
21
- assert_equal [["add-apt-repository", "-y", "rrr"],["apt-get", "update"], ["apt-get", "install", "xyz"]], @santa.commands_to_run
21
+ assert_equal [["add-apt-repository", "-y", "rrr"],["apt-get", "update"], ["apt-get", "install", "-y", "xyz"]], @santa.commands_to_run
22
22
  end
23
23
 
24
+ def test_add_repo
25
+ @santa.instance_eval do
26
+ deb 'xyz', repo: 'rrr'
27
+ end
28
+ assert_equal [["add-apt-repository", "-y", "rrr"],["apt-get", "update"], ["apt-get", "install", "-y", "xyz"]], @santa.commands_to_run
29
+ end
30
+
31
+
24
32
 
25
33
  end
26
34
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: santa
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: '0.1'
5
+ version: '0.2'
6
6
  platform: ruby
7
7
  authors:
8
8
  - Andrew Snow
@@ -23,12 +23,12 @@ extra_rdoc_files:
23
23
  - lib/santa.rb
24
24
  files:
25
25
  - CHANGELOG
26
+ - Manifest
26
27
  - README.md
27
28
  - Rakefile
28
29
  - bin/santa
29
30
  - lib/santa.rb
30
31
  - test/test_all.rb
31
- - Manifest
32
32
  - santa.gemspec
33
33
  homepage: https://github.com/andys/santa
34
34
  licenses: []