sequencer 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.2.0
2
+
3
+ * Adds Sequencer.recursive_entries() for recursive sequence scans
4
+
1
5
  === 1.1.1
2
6
 
3
7
  * Fix comparison bugs
data/lib/sequencer.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Sequencer
2
- VERSION = '1.1.2'
2
+ VERSION = '1.2.0'
3
3
  NUMBERS_AT_END = /(\d+)([^\d]+)?$/
4
4
 
5
5
  extend self
@@ -7,7 +7,14 @@ module Sequencer
7
7
  # Detects sequences in the passed directory (same as Dir.entries but returns Sequence objects).
8
8
  # Single files will be upgraded to single-frame Sequences
9
9
  def entries(of_dir)
10
- actual_files = Dir.entries(of_dir).reject{|e| %w(.. .).include?(e)}
10
+ actual_files = Dir.entries(of_dir)
11
+
12
+ # Remove all dotfiles
13
+ actual_files.reject!{|f| f =~ /^\./}
14
+
15
+ # Ensure files are presorted
16
+ actual_files.sort!
17
+
11
18
  groups = {}
12
19
 
13
20
  actual_files.each do | e |
@@ -28,6 +35,21 @@ module Sequencer
28
35
  end
29
36
  end
30
37
 
38
+ # Detects sequences in the passed directory and all of it's subdirectories
39
+ # It will skip all the entries starting with a dot
40
+ # TODO: fix symlink handling
41
+ def recursive_entries(of_dir)
42
+ detected_sequences = entries(of_dir)
43
+ possible_subdirs = Dir.entries(of_dir)
44
+ possible_subdirs.each do | possible_subdir |
45
+ next if possible_subdir =~ /^\./
46
+
47
+ dirpath = File.join(of_dir, possible_subdir)
48
+ detected_sequences += recursive_entries(dirpath) if File.directory?(dirpath)
49
+ end
50
+ detected_sequences.sort
51
+ end
52
+
31
53
  # Detect a Sequence from a single file and return a handle to it
32
54
  def from_single_file(path_to_single_file)
33
55
  #File.stat(path_to_single_file)
data/sequencer.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "sequencer"
8
- s.version = "1.1.2"
8
+ s.version = "1.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Julik Tarkhanov"]
12
- s.date = "2012-05-30"
12
+ s.date = "2012-08-27"
13
13
  s.email = "me@julik.nl"
14
14
  s.executables = ["rseqls", "rseqpad", "rseqrename"]
15
15
  s.extra_rdoc_files = [
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
31
31
  s.homepage = "http://guerilla-di.org/sequencer"
32
32
  s.licenses = ["MIT"]
33
33
  s.require_paths = ["lib"]
34
- s.rubygems_version = "1.8.15"
34
+ s.rubygems_version = "1.8.24"
35
35
  s.summary = "Image sequence sorting, scanning and manipulation"
36
36
 
37
37
  if s.respond_to? :specification_version then
@@ -82,9 +82,10 @@ class Sequencer_entries_should < Test::Unit::TestCase
82
82
  def setup; emit_test_dirs; end
83
83
  def teardown; teardown_test_dirs; end
84
84
 
85
- def test_returns_entries_for_every_sequence_in_a_directory
86
- entries = Sequencer.entries(TEST_DIR + "/many_seqs")
87
- flunk "this test is not finished"
85
+ def test_returns_entries_recursive_for_every_sequence_in_a_directory
86
+ entries = Sequencer.recursive_entries(TEST_DIR + "/many_seqs")
87
+ names = entries.map{|e| e.to_s }
88
+ assert_equal ["anotherS [228..312].tif", "seq1.[458..512].tif", "single.tif", "in_subdir [445..471].tif"], names
88
89
  end
89
90
  end
90
91
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequencer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-30 00:00:00.000000000 Z
12
+ date: 2012-08-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jeweler
16
- requirement: &9134000 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *9134000
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rake
27
- requirement: &9132990 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,7 +37,12 @@ dependencies:
32
37
  version: '0'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *9132990
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  description:
37
47
  email: me@julik.nl
38
48
  executables:
@@ -69,7 +79,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
69
79
  version: '0'
70
80
  segments:
71
81
  - 0
72
- hash: -408673631
82
+ hash: -3510175113673425325
73
83
  required_rubygems_version: !ruby/object:Gem::Requirement
74
84
  none: false
75
85
  requirements:
@@ -78,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
88
  version: '0'
79
89
  requirements: []
80
90
  rubyforge_project:
81
- rubygems_version: 1.8.15
91
+ rubygems_version: 1.8.24
82
92
  signing_key:
83
93
  specification_version: 3
84
94
  summary: Image sequence sorting, scanning and manipulation