fm 0.0.1.rc2 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79737935b4d50e7abb22c6bb7dfb5eb7763c71c0
4
- data.tar.gz: f46f80372be4fabd3d187954737f7fbcc9117e85
3
+ metadata.gz: 40f701f7d9cf760dfc9a76c431d47b8f1ddb031b
4
+ data.tar.gz: d9c4e22714f8d3b726ecb932e75889df445115db
5
5
  SHA512:
6
- metadata.gz: 544af8ebb7d73431aa7bbd8b70c8c14e2705ccb5bc2815afeacb5a774b3f7bbf5e0f1e4dba94ab20984364d0f8fa4a37ba418c124e8eb06c6fa522cdc83b4eba
7
- data.tar.gz: f10e15da4f1567374950598ad291c60d9f5a0c5dc78ed570ee9570fa037c81fa2195b64a50a90105af97a007c209d28d589973f6114321b99f5f78ea692d6b09
6
+ metadata.gz: 1c80d0e806f342edbce81a1e5d7ecc5390cfffdbc4940c4aabc17557862c677a18ecda6e6d790125615b7ac188edabd0e82cd7519acb8e2f97b8a48649734665
7
+ data.tar.gz: 17a293a95dc60e18303fb4c71adf32e3896b4307dbf163780af4bf697ac242d25cf31407676e37b2215aaad8be0c0a33f611ad738bfbfae2155a9243602731e5
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+
5
+ task :default => []
6
+
7
+
8
+ desc ''
9
+ task :test
10
+ Rake::TestTask.new do |t|
11
+ t.libs << 'lib'
12
+ t.test_files = Dir.glob('test/**/test_*.rb')
13
+ end
14
+
15
+
16
+ Rake::Task["release"].clear
data/lib/fm/index.rb CHANGED
@@ -76,26 +76,32 @@ module FM
76
76
  if h[fsize].is_a?(String)
77
77
  p = h[fsize]
78
78
  if p == fpath
79
- ndupfiles += 1
80
- puts "[DUP]: #{fpath}"
81
- puts " #{p}"
82
79
  next
83
80
  end
84
81
 
85
82
  d = Digest::MD5.hexdigest(File.read(p))
86
- h[fsize] = { d => FMFile.new(fsize, p, d) }
83
+ h[fsize] = { d => [ FMFile.new(fsize, p, d) ] }
87
84
  needupdate = true
88
85
  end
89
86
  digest = Digest::MD5.hexdigest(File.read(fpath))
90
87
  if h[fsize][digest].nil?
91
- h[fsize][digest] = FMFile.new(fsize, fpath, digest)
88
+ h[fsize][digest] = [ FMFile.new(fsize, fpath, digest) ]
92
89
  needupdate = true
93
90
  nnewfiles += 1
94
91
  puts "[NEW]: #{fpath} #{digest}"
92
+ elsif h[fsize][digest].size == 1 && h[fsize][digest].first.path == fpath
95
93
  else
96
94
  ndupfiles += 1
97
95
  puts "[DUP]: #{fpath}"
98
- puts " #{h[fsize][digest].path}"
96
+ h[fsize][digest].each do |f|
97
+ puts " #{f.path}" if f.path != fpath
98
+ end
99
+
100
+ unless h[fsize][digest].any? { |f| f.path == fpath }
101
+ fmfile = FMFile.new(fsize, fpath, digest)
102
+ h[fsize][digest].push(fmfile)
103
+ needupdate = true
104
+ end
99
105
  end
100
106
  end
101
107
  rescue StandardError => e
data/lib/fm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module FM
2
- VERSION = '0.0.1.rc2'
2
+ VERSION = '0.0.1'
3
3
  end
@@ -0,0 +1,20 @@
1
+ require 'test/unit'
2
+
3
+ require 'fm'
4
+
5
+
6
+ class TestCmdIndex < Test::Unit::TestCase
7
+
8
+ def setup
9
+ end
10
+
11
+
12
+ def teardown
13
+ end
14
+
15
+
16
+ def test_this_test
17
+ assert(true)
18
+ end
19
+
20
+ end
data/test/test_fm.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'test/unit'
2
+
3
+
4
+ class TestFM < Test::Unit::TestCase
5
+
6
+ def setup
7
+ end
8
+
9
+
10
+ def teardown
11
+ end
12
+
13
+
14
+ def test_this_test
15
+ assert(true)
16
+ end
17
+
18
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.rc2
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ShinYee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-28 00:00:00.000000000 Z
11
+ date: 2015-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -50,6 +50,7 @@ files:
50
50
  - ".gitignore"
51
51
  - COPYING
52
52
  - Gemfile
53
+ - Rakefile
53
54
  - bin/fm
54
55
  - fm.gemspec
55
56
  - lib/fm.rb
@@ -57,6 +58,8 @@ files:
57
58
  - lib/fm/index.rb
58
59
  - lib/fm/match.rb
59
60
  - lib/fm/version.rb
61
+ - test/index/test_cmd_index.rb
62
+ - test/test_fm.rb
60
63
  homepage: http://github.com/xman/ruby-fm
61
64
  licenses:
62
65
  - MIT
@@ -72,13 +75,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
72
75
  version: 2.0.0
73
76
  required_rubygems_version: !ruby/object:Gem::Requirement
74
77
  requirements:
75
- - - ">"
78
+ - - ">="
76
79
  - !ruby/object:Gem::Version
77
- version: 1.3.1
80
+ version: '0'
78
81
  requirements: []
79
82
  rubyforge_project:
80
83
  rubygems_version: 2.4.5
81
84
  signing_key:
82
85
  specification_version: 4
83
86
  summary: Managing files over multiple storage resources.
84
- test_files: []
87
+ test_files:
88
+ - test/index/test_cmd_index.rb
89
+ - test/test_fm.rb