public
Description: A bleeding-edge package manager.
Homepage: http://roastbeef.rubyforge.org
Clone URL: git://github.com/technomancy/roast-beef.git
mostly just better comments
technomancy (author)
Fri Mar 14 23:05:00 -0700 2008
commit  8af922917aa2428c40a58ccc30e4c5df1228f645
tree    8ca6f69ae56ac0b016a531850430b4d9d407ce99
parent  e037b8ab227b99a687a87941288c2df97efa163c
...
11
12
13
14
 
...
11
12
13
 
14
0
@@ -11,4 +11,4 @@ lib/roastbeef/scms/bzr_package.rb
0
 lib/roastbeef/scms/cvs_package.rb
0
 lib/roastbeef/scms/git_package.rb
0
 lib/roastbeef/scms/svn_package.rb
0
-spec/roastbeef_spec.rb
0
+test/test_roastbeef.rb
...
1
2
3
4
 
5
6
7
...
1
2
 
 
3
4
5
6
0
@@ -1,7 +1,6 @@
0
 #!/usr/bin/env ruby
0
 
0
-# TODO: set $LOAD_PATH?
0
-require 'roastbeef'
0
+require File.dirname(__FILE__) + '/../lib/roastbeef'
0
 
0
 puts(RoastBeef::USAGE) || exit(1) if ARGV.empty? or ARGV.include?('--help') or ARGV.include?('-h') or ARGV.include?('-?')
0
 
...
7
8
9
10
 
11
12
13
...
22
23
24
 
25
26
27
...
61
62
63
64
 
 
 
65
66
67
 
68
 
69
70
 
71
72
...
7
8
9
 
10
11
12
13
...
22
23
24
25
26
27
28
...
62
63
64
 
65
66
67
68
69
70
71
72
73
74
75
76
77
78
0
@@ -7,7 +7,7 @@ require 'package_manager'
0
 require 'package'
0
 
0
 module RoastBeef
0
- VERSION = '0.0.2'
0
+ VERSION = '0.0.3'
0
   USAGE = "roastbeef #{VERSION}
0
 
0
 uh ok so roast beef is some kind of package manager that uses upstream
0
@@ -22,6 +22,7 @@ of course you can find out more things at http://roastbeef.rubyforge.org"
0
   LISTING_FILENAME = File.expand_path('~/.roastbeef/sources.yml')
0
 
0
   # URLs to check for sources. only one is used
0
+ # TODO: allow users to add their own
0
   UPDATE_SOURCES = ['http://github.com/technomancy/roast-beef/tree/master/sources.yml?raw=true',
0
                     'http://roastbeef.rubyforge.org/sources.yml']
0
 
0
@@ -61,12 +62,17 @@ of course you can find out more things at http://roastbeef.rubyforge.org"
0
   end
0
 
0
   def listing
0
- update unless File.exist?(LISTING_FILENAME)
0
+ update if !File.exist?(LISTING_FILENAME) or
0
+ # source list is older than a week
0
+ File.mtime(LISTING_FILENAME) < Time.now - 604800
0
     @listing ||= YAML.load(File.read(LISTING_FILENAME))
0
   end
0
 
0
+ # when we first run we need to do some setup
0
   def setup
0
+ puts "ok we are performing some initial setup here..."
0
     system "mkdir -p #{File.dirname(LISTING_FILENAME)} #{SRC_DIR}"
0
     PackageManager.setup
0
+ puts "... and now we are done."
0
   end
0
 end
...
12
13
14
15
 
16
17
18
19
20
21
22
23
24
 
25
26
27
28
29
30
31
32
33
 
34
35
 
36
37
38
39
40
 
41
42
43
44
 
45
46
47
48
49
 
50
51
52
53
 
54
55
56
57
 
58
59
60
...
12
13
14
 
15
16
17
 
18
19
20
21
22
 
23
24
25
26
27
28
 
29
30
 
31
32
 
33
34
35
36
37
 
38
39
40
41
 
42
43
44
 
45
 
46
47
48
49
 
50
51
52
53
 
54
55
56
57
0
@@ -12,49 +12,46 @@ module RoastBeef
0
     end
0
 
0
     def install
0
- PackageManager.install_dependencies(@prereqs) if @prereqs
0
+ PackageManager.install_dependencies(@prereqs) if prereqs
0
       checked_out? ? update : checkout
0
 
0
- # TODO: broken?
0
       puts("whoa hang on this package can not be automatically removed once it
0
 is installed. if you are all right with that press enter but otherwise you
0
 should do control-c to cancel.") || STDIN.gets if unremovable?
0
 
0
       # TODO: support custom configure flags
0
- system((["cd #{path}"] + @build).join(' && '))
0
+ system((["cd #{path}"] + build).join(' && '))
0
     end
0
     
0
     # TODO: some packages have simpler upgrade steps than install
0
     alias_method :upgrade, :install
0
 
0
- # TODO: test
0
     def remove
0
       if unremovable?
0
- puts "man i can not remove this package for you. have to do that yourself."
0
+ puts "man i can not remove this package for you. have to do that yourself. to be fair I did warn you."
0
       else
0
- system((["cd #{path}"] + @remove + ['cd', "rm -rf #{path}"]).join(' && '))
0
+ system((["cd #{path}"] + remove + ['cd', "rm -rf #{path}"]).join(' && '))
0
       end
0
     end
0
 
0
     def to_s
0
- "#{@name} - #{truncated_description}"
0
+ "#{name} - #{truncated_description}"
0
     end
0
 
0
     def truncated_description
0
- @description.length > 72 ? @description[0 .. 72].split(' ')[0 .. -2].join(' ') + '...' : @description
0
+ description.length > 72 ? description[0 .. 72].split(' ')[0 .. -2].join(' ') + '...' : description
0
     end
0
 
0
- # TODO: include additional metadata
0
     def inspect
0
- "#{@name}: #{@repository}\n\n#{@description}"
0
+ "#{name}: #{url}\n\n#{description}"
0
     end
0
         
0
     def path
0
- "#{SRC_DIR}/#{@name}"
0
+ "#{SRC_DIR}/#{name}"
0
     end
0
 
0
     def unremovable?
0
- @remove.to_s == 'false'
0
+ remove.to_s == 'false'
0
     end
0
     
0
     def checked_out?
...
1
2
3
4
 
 
 
5
6
 
7
8
9
10
11
 
12
13
14
15
 
16
17
 
18
19
20
...
1
2
 
 
3
4
5
6
7
8
9
10
11
12
 
13
14
15
16
17
18
19
 
20
21
22
23
0
@@ -1,20 +1,23 @@
0
 module RoastBeef
0
   class PackageManager
0
- { "which apt-get" => 'apt-get',
0
- "which port" => 'macports'
0
+ # lets see here which package manager should we use
0
+ { "which apt-get > /dev/null" => 'apt-get',
0
+ "which port > /dev/null" => 'macports'
0
     }.detect { |test, manager| @manager = manager if system(test) }
0
 
0
+ # get the depedencies for whatever package manager we are using
0
     def self.install_dependencies(prereqs)
0
       if @manager.nil? and prereqs['manual'].nil?
0
         puts "Warning: no package manager found; dependencies may not be met."
0
       else
0
- system prereqs[@manager || 'manual']
0
+ system prereqs[@manager || 'manual'].to_s
0
         system prereqs['all'] if prereqs['all']
0
       end
0
     end
0
 
0
+ # dry-run setup to install compiler, scms, etc
0
     def self.setup
0
- system({ 'apt-get' => "sudo apt-get install cvs subversion git-core bzr build-essential autoconf",
0
+ system({ 'apt-get' => "sudo apt-get install cvs subversion git-core bzr build-essential autoconf ruby1.8-dev",
0
                'macports' => "echo 'Hey, try installing the dev tools or something. Also CVS, SVN, Git, Bazaar, and stuff.'"
0
              }[@manager] || "echo 'No package manager detected.
0
 Dependency resolution must be done manually.'")

Comments

    No one has commented yet.