right_data 0.5.11 → 0.5.12

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.
Files changed (2) hide show
  1. data/lib/FileSystemItem.rb +19 -6
  2. metadata +17 -3
@@ -1,3 +1,4 @@
1
+ require 'escape'
1
2
  module RightData
2
3
  class FileSystemItem
3
4
 
@@ -118,6 +119,14 @@ module RightData
118
119
  "<Tree :path => #{self.path}, :files => #{self.files}>"
119
120
  end
120
121
 
122
+ def put_for_shell(pre,path,comment)
123
+ if(pre.empty?)
124
+ puts Escape.shell_escape([path, "# #{comment}"])
125
+ else
126
+ puts Escape.shell_escape(pre.split(" ").append(path).append("# #{comment}"))
127
+ end
128
+ end
129
+
121
130
  # Inspect the nodes:
122
131
  def report(pre="")
123
132
  pre += " " if !pre.empty?
@@ -126,13 +135,15 @@ module RightData
126
135
  if n.leaf?
127
136
  if(File.directory?(n.path))
128
137
  # Prune empty dirs!
129
- puts "#{pre}'#{n.path.gsub(/'/,"\\\\'")}' # Empty dir" # Remove the dups/igns!
138
+ put_for_shell(pre,n.path,"Empty dir") # Remove the dups/igns!
139
+ #puts "#{pre}'#{n.path.gsub(/'/,"\\\\'")}' # Empty dir"
130
140
  else
131
141
  msg = nil
132
- msg = "# dup(#{n.duplicates.count})" if n.duplicate?
133
- msg = "# ign" if n.ignorable?
142
+ msg = " dup(#{n.duplicates.count})" if n.duplicate?
143
+ msg = " ign" if n.ignorable?
134
144
  if msg
135
- puts "#{pre}'#{n.path.gsub(/'/,"\\\\'")}' #{msg}" # Remove the dups/igns!
145
+ put_for_shell(pre,n.path,msg) # Remove the dups/igns!
146
+ # puts "#{pre}'#{n.path.gsub(/'/,"\\\\'")}' #{msg}" # Remove the dups/igns!
136
147
  else
137
148
  puts "# #{n.path} unique"
138
149
  end
@@ -140,10 +151,12 @@ module RightData
140
151
  false # Don't traverse deeper!
141
152
  else
142
153
  if n.duplicate_children + n.ignore_children == n.children.size
143
- puts "#{pre}'#{n.path.gsub(/'/,"\\\\'")}' # #{n.duplicate_children} dups / #{n.ignore_children} ignores"
154
+ put_for_shell(pre,n.path,"#{n.duplicate_children} dups / #{n.ignore_children} ignores")
155
+ # puts "#{pre}'#{n.path.gsub(/'/,"\\\\'")}' # #{n.duplicate_children} dups / #{n.ignore_children} ignores"
144
156
  false # Don't traverse deeper!
145
157
  elsif n.children.size == 0
146
- puts "#{pre}'#{n.path.gsub(/'/,"\\\\'")}' # Empty... "
158
+ put_for_shell(pre,n.path," Empty")
159
+ # puts "#{pre}'#{n.path.gsub(/'/,"\\\\'")}' # Empty... "
147
160
  false
148
161
  else
149
162
  puts "# #{n.path} # Not #{n.duplicate_children} dup/ #{n.ignore_children} ign / #{n.other_children} other "
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: 29
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 11
10
- version: 0.5.11
9
+ - 12
10
+ version: 0.5.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jonathan Siegel
@@ -32,6 +32,20 @@ dependencies:
32
32
  version: "0"
33
33
  type: :development
34
34
  version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: escape
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :development
48
+ version_requirements: *id002
35
49
  description: RightData helpers
36
50
  email: usiegj00@gmail.com
37
51
  executables: []