bincache 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/bincache.gemspec +2 -2
  3. data/lib/bincache.rb +22 -4
  4. metadata +4 -4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.3
data/bincache.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{bincache}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Martin Rhoads"]
12
- s.date = %q{2011-03-11}
12
+ s.date = %q{2011-04-19}
13
13
  s.default_executable = %q{bincache}
14
14
  s.description = %q{
15
15
  BinCache is a system designed to cache compiled binaries. It has support for bash, ruby , and chef.
data/lib/bincache.rb CHANGED
@@ -66,12 +66,12 @@ class BinCache
66
66
  `rm -rf #{directory}`
67
67
  `cd #{File.dirname directory} && tar -xzf #{File.join(@cache_dir,hash)} `
68
68
  else
69
- `mkdir -p #{directory} #{@cache_dir}`
69
+ run_or_exit "mkdir -p #{directory} #{@cache_dir}"
70
70
  Dir.chdir cwd unless cwd == nil
71
71
  puts "pwd = #{`pwd`}"
72
- res = `#{script}`
73
- `touch #{File.join directory, ".#{hash}"}`
74
- `cd #{File.dirname directory} && tar -czf #{@cache_dir}/#{hash} #{File.basename directory} `
72
+ run_or_exit(script, cwd)
73
+ run_or_exit "touch #{File.join directory, '.' + hash }"
74
+ run_or_exit "cd #{File.dirname directory} && tar -czf #{@cache_dir}/#{hash} #{File.basename directory} "
75
75
  upload_file("#{@cache_dir}/#{hash}")
76
76
  end
77
77
  end
@@ -122,6 +122,24 @@ class BinCache
122
122
 
123
123
  end
124
124
 
125
+
126
+ def run_or_exit(command,dir=nil)
127
+ Dir.chdir dir unless dir == nil
128
+ script_path = '/tmp/bincache_script'
129
+ File.open(script_path, 'w+') {|f| f.write(command) }
130
+ File.chmod(0544,script_path)
131
+ STDERR.puts "about to execute "
132
+ STDERR.puts "#{command}"
133
+ output = `bash #{script_path}`
134
+ STDERR.puts "output is '#{output}'"
135
+ unless $?.success?
136
+ STDERR.puts "command did not return success '#{command}'"
137
+ STDERR.puts "exiting..."
138
+ Kernel.exit 1
139
+ end
140
+ end
141
+
142
+
125
143
  def print_and_exit(message)
126
144
  STDERR.puts "caught an error in bincache"
127
145
  STDERR.puts message
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bincache
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Martin Rhoads
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-11 00:00:00 -08:00
18
+ date: 2011-04-19 00:00:00 -07:00
19
19
  default_executable: bincache
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency