dircat 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/dircat.gemspec +5 -5
- data/lib/dircat/cat.rb +38 -29
- data/lib/dircat.rb +1 -1
- metadata +6 -6
data/VERSION.yml
CHANGED
data/dircat.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dircat}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tokiro"]
|
12
|
-
s.date = %q{2011-01
|
12
|
+
s.date = %q{2011-02-01}
|
13
13
|
s.default_executable = %q{dircat}
|
14
14
|
s.description = %q{
|
15
15
|
command line utilites to manage catalogs of directory
|
@@ -70,7 +70,7 @@ Gem::Specification.new do |s|
|
|
70
70
|
s.specification_version = 3
|
71
71
|
|
72
72
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
73
|
-
s.add_runtime_dependency(%q<treevisitor>, ["= 0.
|
73
|
+
s.add_runtime_dependency(%q<treevisitor>, ["= 0.2.0"])
|
74
74
|
s.add_runtime_dependency(%q<optparse-command>, ["= 0.1.1"])
|
75
75
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
76
76
|
s.add_development_dependency(%q<rake>, [">= 0"])
|
@@ -78,7 +78,7 @@ Gem::Specification.new do |s|
|
|
78
78
|
s.add_development_dependency(%q<bundler>, [">= 0"])
|
79
79
|
s.add_development_dependency(%q<rspec>, [">= 0"])
|
80
80
|
else
|
81
|
-
s.add_dependency(%q<treevisitor>, ["= 0.
|
81
|
+
s.add_dependency(%q<treevisitor>, ["= 0.2.0"])
|
82
82
|
s.add_dependency(%q<optparse-command>, ["= 0.1.1"])
|
83
83
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
84
84
|
s.add_dependency(%q<rake>, [">= 0"])
|
@@ -87,7 +87,7 @@ Gem::Specification.new do |s|
|
|
87
87
|
s.add_dependency(%q<rspec>, [">= 0"])
|
88
88
|
end
|
89
89
|
else
|
90
|
-
s.add_dependency(%q<treevisitor>, ["= 0.
|
90
|
+
s.add_dependency(%q<treevisitor>, ["= 0.2.0"])
|
91
91
|
s.add_dependency(%q<optparse-command>, ["= 0.1.1"])
|
92
92
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
93
93
|
s.add_dependency(%q<rake>, [">= 0"])
|
data/lib/dircat/cat.rb
CHANGED
@@ -3,11 +3,19 @@ module DirCat
|
|
3
3
|
|
4
4
|
class Cat
|
5
5
|
|
6
|
+
#
|
7
|
+
# Directory name
|
8
|
+
#
|
6
9
|
attr_reader :dirname
|
7
10
|
|
11
|
+
#
|
8
12
|
# creation date
|
13
|
+
#
|
9
14
|
attr_accessor :ctime
|
10
15
|
|
16
|
+
|
17
|
+
attr_reader :verbose_level
|
18
|
+
|
11
19
|
def initialize(options = {})
|
12
20
|
@verbose_level = options.delete(:verbose) || 0
|
13
21
|
@dirname = ""
|
@@ -73,36 +81,37 @@ module DirCat
|
|
73
81
|
dircat_ser
|
74
82
|
end
|
75
83
|
|
76
|
-
def _load_from_dir
|
77
|
-
old_dirname = Dir.pwd
|
78
|
-
Dir.chdir(@dirname)
|
79
|
-
Dir["**/*"].each { |f|
|
80
|
-
next if File.directory?(f)
|
81
|
-
|
82
|
-
if @verbose_level > 0
|
83
|
-
cr = "\r"
|
84
|
-
clear = "\e[K"
|
85
|
-
print "#{cr}#{filename}#{clear}"
|
86
|
-
end
|
87
|
-
|
88
|
-
add_entry(Entry.new.from_filename(f))
|
89
|
-
}
|
90
|
-
if @verbose_level > 0
|
91
|
-
print "\n"
|
92
|
-
end
|
93
|
-
Dir.chdir(old_dirname)
|
94
|
-
self
|
95
|
-
end
|
84
|
+
# def _load_from_dir
|
85
|
+
# old_dirname = Dir.pwd
|
86
|
+
# Dir.chdir(@dirname)
|
87
|
+
# Dir["**/*"].each { |f|
|
88
|
+
# next if File.directory?(f)
|
89
|
+
#
|
90
|
+
# if @verbose_level > 0
|
91
|
+
# cr = "\r"
|
92
|
+
# clear = "\e[K"
|
93
|
+
# print "#{cr}#{filename}#{clear}"
|
94
|
+
# end
|
95
|
+
#
|
96
|
+
# add_entry(Entry.new.from_filename(f))
|
97
|
+
# }
|
98
|
+
# if @verbose_level > 0
|
99
|
+
# print "\n"
|
100
|
+
# end
|
101
|
+
# Dir.chdir(old_dirname)
|
102
|
+
# self
|
103
|
+
# end
|
104
|
+
|
105
|
+
CR = "\r"
|
106
|
+
CLEAR = "\e[K"
|
96
107
|
|
97
|
-
def
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
add_entry(Entry.new.from_filename(
|
102
|
-
if
|
103
|
-
|
104
|
-
clear = "\e[K"
|
105
|
-
print "#{cr}#{filename}#{clear}"
|
108
|
+
def _load_from_dir
|
109
|
+
me = self
|
110
|
+
TreeVisitor::DirTreeWalker.new.run @dirname do
|
111
|
+
on_leaf do |filename|
|
112
|
+
me.add_entry(Entry.new.from_filename(filename))
|
113
|
+
if me.verbose_level > 0
|
114
|
+
print "#{CR}#{filename}#{CLEAR}"
|
106
115
|
end
|
107
116
|
end
|
108
117
|
end
|
data/lib/dircat.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 7
|
9
|
+
version: 0.1.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Tokiro
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-01
|
17
|
+
date: 2011-02-01 00:00:00 +01:00
|
18
18
|
default_executable: dircat
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -26,9 +26,9 @@ dependencies:
|
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
segments:
|
28
28
|
- 0
|
29
|
-
-
|
30
|
-
-
|
31
|
-
version: 0.
|
29
|
+
- 2
|
30
|
+
- 0
|
31
|
+
version: 0.2.0
|
32
32
|
type: :runtime
|
33
33
|
prerelease: false
|
34
34
|
version_requirements: *id001
|