right_data 0.5.0 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/main.rb +7 -7
  2. data/lib/right_data.rb +6 -0
  3. metadata +3 -3
data/lib/main.rb CHANGED
@@ -127,7 +127,7 @@ module RightData
127
127
  def self.cache_serializing_on_write(master)
128
128
  master_cache = File.join(master,".rightPruneCache")
129
129
  if File.exist?(master_cache)
130
- puts "Master cache FOUND at #{master_cache}."
130
+ puts "# Master cache FOUND at #{master_cache}."
131
131
  master_index = File.open(master_cache) do |f|
132
132
  rval = {}
133
133
  f.each_line do |l|
@@ -137,16 +137,16 @@ module RightData
137
137
  rval
138
138
  end
139
139
  else
140
- puts "Master cache not found at #{master_cache}."
140
+ puts "# Master cache not found at #{master_cache}."
141
141
  master_index = index_by_size(master)
142
- puts "Writing #{master_cache}."
142
+ puts "# Writing #{master_cache}."
143
143
  File.open(master_cache, "w") do |f|
144
144
  master_index.each_pair do |k,v|
145
145
  Marshal.dump([k,v], f)
146
146
  end
147
147
  # f.write(master_index.inspect)
148
148
  end
149
- puts "Wrote #{master_cache}."
149
+ puts "# Wrote #{master_cache}."
150
150
  end
151
151
  end
152
152
 
@@ -185,11 +185,11 @@ module RightData
185
185
 
186
186
  # tree = scan_for_prunable(master,prune) { |a,b| puts "#{b.size} : #{a}" }; nil
187
187
  def self.scan_for_prunable(master,prune, &block)
188
- puts "Ignoring: #{IGNORE_FILES.inspect}"
188
+ puts "# Ignoring: #{IGNORE_FILES.inspect}"
189
189
 
190
190
  master_index = cache_not_working_on_write(master)
191
191
  # master_index = index_by_size(master)
192
- puts "Found #{master_index.size} unique sizes."
192
+ puts "# Found #{master_index.size} unique sizes."
193
193
 
194
194
  # dups = check_file_in_index(master_index, "/Users/jonathan/Dropbox/2261093437_fac9fa9008_b.jpg")
195
195
 
@@ -220,7 +220,7 @@ module RightData
220
220
  end
221
221
  true
222
222
  end
223
- puts "We counted #{count} files. Tree thinks it has #{tree.files}."
223
+ puts "# We counted #{count} files. Tree thinks it has #{tree.files}."
224
224
  return tree
225
225
 
226
226
  if nil
data/lib/right_data.rb CHANGED
@@ -2,4 +2,10 @@ require 'main'
2
2
 
3
3
  module RightData
4
4
  def self.hello; "Hi!"; end
5
+ def prune_report(master,prunable)
6
+ tree = RightData::scan_for_prunable(master,prunable)
7
+ tree.report('rm -rf'); nil
8
+ end
5
9
  end
10
+ # Usage:
11
+ # echo "gem 'right_data'; require 'right_data'; prune_report(master,prunable)" | ruby -rrubygems
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right_data
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 0
10
- version: 0.5.0
9
+ - 2
10
+ version: 0.5.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jonathan Siegel