filecount 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -2,15 +2,9 @@
2
2
 
3
3
  Counts files in directory recursively
4
4
 
5
- == Note on Patches/Pull Requests
6
-
7
- * Fork the project.
8
- * Make your feature addition or bug fix.
9
- * Add tests for it. This is important so I don't break it in a
10
- future version unintentionally.
11
- * Commit, do not mess with rakefile, version, or history.
12
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
- * Send me a pull request. Bonus points for topic branches.
5
+ == Install
6
+
7
+ gem install filecount
14
8
 
15
9
  == Copyright
16
10
 
@@ -1,9 +1,10 @@
1
1
  module Filecount
2
2
  class Counter
3
3
 
4
+ attr_accessor :file_count, :start_dir
4
5
  def initialize(options)
5
6
  @options = options
6
- @count = 0
7
+ @file_count = 0
7
8
  @start_dir
8
9
  end
9
10
 
@@ -13,14 +14,16 @@ module Filecount
13
14
 
14
15
  def execute()
15
16
  if ARGV[0] != nil and File.directory?(ARGV[0])
17
+ @start_dir = File.expand_path(ARGV[0])
16
18
  count(ARGV[0])
17
19
  elsif ARGV[0] != nil
18
20
  puts "Directory '#{ARGV[0]}' not found"
19
21
  exit
20
22
  else
23
+ @start_dir = File.expand_path(".")
21
24
  count(".")
22
25
  end
23
- @count
26
+ @file_count
24
27
  end
25
28
 
26
29
  def count (directory)
@@ -40,7 +43,7 @@ module Filecount
40
43
  if @options[:verbose]
41
44
  puts f
42
45
  end
43
- @count += 1
46
+ @file_count += 1
44
47
  end
45
48
  end
46
49
  end
@@ -11,8 +11,9 @@ module Filecount
11
11
  end
12
12
 
13
13
  def execute
14
- count = Counter.execute(@options)
15
- puts "-- #{count} files found"
14
+ count = Counter.new(@options)
15
+ count.execute()
16
+ puts "-- #{count.file_count} files found in #{count.start_dir}"
16
17
  end
17
18
 
18
19
  def parse_options
data/lib/run.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  require 'filecount'
2
2
 
3
- Filecount::Runner.execute
3
+ Filecount::Runner.execute
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filecount
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Markus Nilsson
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-30 00:00:00 +02:00
18
+ date: 2010-08-04 00:00:00 +02:00
19
19
  default_executable: filecount
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency