bincache 0.0.8 → 0.1.0

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 +10 -10
  4. metadata +4 -4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.1.0
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.0.8"
8
+ s.version = "0.1.0"
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{2010-10-18}
12
+ s.date = %q{2010-11-14}
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
@@ -29,20 +29,19 @@ class BinCache
29
29
  @right_s3_interface = RightAws::S3Interface.new(ENV['BINCACHE_S3_ACCESS_KEY'],ENV['BINCACHE_S3_SECRET_KEY'])
30
30
  end
31
31
 
32
- def run_series(directory, scripts, cwd=nil, script_hash=nil)
32
+ def run_series_once(directory=nil, scripts=nil, cwd=nil)
33
+ hash = Digest::MD5.hexdigest("#{directory.inspect}#{scripts.inspect}")
34
+ run_series(directory,scripts,cwd,) unless File.exist?(File.join(directory,".#{hash}"))
35
+ end
36
+
37
+ def run_series(directory, scripts, cwd=nil)
33
38
  ## exit if given bogus input
34
39
  print_and_exit "bogus input in run_series" if directory.nil? || scripts.nil?
35
40
 
36
41
  ## clear out directory if we are starting a new sequence
37
42
  `rm -rf #{directory} && mkdir -p #{directory}` && return if scripts.empty?
38
43
 
39
- ## hash the scripts together with the output of the script_hash
40
- script_hash_output = ""
41
- script_hash_output = `#{script_hash}` unless script_hash == nil
42
-
43
- STDERR.puts "script_hash_output = #{script_hash_output}"
44
-
45
- hash = Digest::MD5.hexdigest("#{directory.inspect}#{scripts.inspect}#{script_hash_output}")
44
+ hash = Digest::MD5.hexdigest("#{directory.inspect}#{scripts.inspect}")
46
45
 
47
46
  ## pop the last script
48
47
  pop = scripts.pop
@@ -65,13 +64,14 @@ STDERR.puts "script_hash_output = #{script_hash_output}"
65
64
  def step(script,directory,hash,cwd=nil)
66
65
  if download_hash? hash
67
66
  `rm -rf #{directory}`
68
- `cd #{File.dirname directory} && tar -xzvf #{File.join(@cache_dir,hash)} `
67
+ `cd #{File.dirname directory} && tar -xzf #{File.join(@cache_dir,hash)} `
69
68
  else
70
69
  `mkdir -p #{directory} #{@cache_dir}`
71
70
  Dir.chdir cwd unless cwd == nil
72
71
  puts "pwd = #{`pwd`}"
73
72
  res = `#{script}`
74
- `cd #{File.dirname directory} && tar -czvf #{@cache_dir}/#{hash} #{File.basename directory} `
73
+ `touch #{File.join directory, ".#{hash}"}`
74
+ `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
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: 15
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 8
10
- version: 0.0.8
10
+ version: 0.1.0
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: 2010-10-18 00:00:00 -07:00
18
+ date: 2010-11-14 00:00:00 -08:00
19
19
  default_executable: bincache
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency