escoffier 0.0.0 → 0.1.0

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 (5) hide show
  1. data/VERSION +1 -1
  2. data/bin/mise +11 -21
  3. data/bin/mise~ +71 -0
  4. data/escoffier.gemspec +3 -3
  5. metadata +4 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.1.0
data/bin/mise CHANGED
@@ -11,12 +11,12 @@ require 'escoffier'
11
11
  def parse_options
12
12
  options = Hash.new
13
13
  parser = OptionParser.new do |opts|
14
- opts.banner = "Usage: #{__FILE__} [options] paths"
14
+ opts.banner = "Usage: #{__FILE__} [options] source_paths destination"
15
15
 
16
- opts.on('-o', '--output OUTPUT_DIRECTORY', "Output Destination Directory") do |dir|
17
- options[:output] = dir
18
- abort "Cannot find directory #{dir}." unless File.directory?(File.dirname(dir))
19
- end
16
+ # opts.on('-o', '--output OUTPUT_DIRECTORY', "Output Destination Directory") do |dir|
17
+ # options[:output] = dir
18
+ # abort "Cannot find directory #{dir}." unless File.directory?(File.dirname(dir))
19
+ # end
20
20
 
21
21
  opts.on('-t', '--temp', "Make a temporary directory for output") do |dir|
22
22
  options[:mktmpdir] = true
@@ -32,16 +32,16 @@ def parse_options
32
32
  end
33
33
 
34
34
  opts.on_tail('-h', '--help', "Show this message") { puts(parser); exit }
35
+ opts.on_tail("Example Usage - Use like cp or mv: #{__FILE__} /Data/vtrak1/raw/gallagher.pd/mri/pd005b/009 /tmp")
35
36
  end
36
37
 
37
38
  parser.parse!(ARGV)
39
+ puts parser unless ARGV.size >= 2
38
40
  return options
39
41
  end
40
42
 
41
43
  def prep_mise(directories, options)
42
- if options[:output]
43
- destination = options[:output]
44
- elsif options[:mktmpdir]
44
+ if options[:mktmpdir]
45
45
  begin
46
46
  destination = Dir.mktmpdir
47
47
  rescue
@@ -52,23 +52,13 @@ def prep_mise(directories, options)
52
52
  end
53
53
  end
54
54
  else
55
- destination = Dir.pwd
55
+ destination = directories.pop
56
56
  end
57
57
 
58
- directories.each do |directory|
59
- # if options[:force]
60
- # sandbox_dir = File.join(destination, File.basename(directory))
61
- # if File.exist?(sandbox_dir)
62
- # $LOG.info "Freshening up #{sandbox_dir}"
63
- # FileUtils.rm_r(sandbox_dir)
64
- # end
65
- # end
66
-
58
+ directories.each do |directory|
67
59
  directory.prep_mise_to(destination)
68
60
  end
69
-
70
- Dir.chdir(destination)
71
-
61
+
72
62
  end
73
63
 
74
64
  if File.basename(__FILE__) == File.basename($PROGRAM_NAME)
data/bin/mise~ ADDED
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift File.join(File.dirname(__FILE__),'..','lib')
3
+
4
+ require 'optparse'
5
+ require 'etc'
6
+ require 'pathname'
7
+ require 'logger'
8
+ require 'tmpdir'
9
+ require 'escoffier'
10
+
11
+ def parse_options
12
+ options = Hash.new
13
+ parser = OptionParser.new do |opts|
14
+ opts.banner = "Usage: #{__FILE__} [options] source_paths destination"
15
+
16
+ # opts.on('-o', '--output OUTPUT_DIRECTORY', "Output Destination Directory") do |dir|
17
+ # options[:output] = dir
18
+ # abort "Cannot find directory #{dir}." unless File.directory?(File.dirname(dir))
19
+ # end
20
+
21
+ opts.on('-t', '--temp', "Make a temporary directory for output") do |dir|
22
+ options[:mktmpdir] = true
23
+ abort "Output directory already specified - not creating a temporary directory." if options[:dir]
24
+ end
25
+
26
+ # opts.on('-f', '--[no-]force', "Force Overwrite of the sandbox") do |f|
27
+ # options[:force] = f
28
+ # end
29
+
30
+ opts.on('-v', '--[no-]verbose', "Get detailed output") do |v|
31
+ options[:verbose] = v
32
+ end
33
+
34
+ opts.on_tail('-h', '--help', "Show this message") { puts(parser); exit }
35
+ opts.on_tail("Example: #{__FILE__} /Data/vtrak1/raw/gallagher.pd/mri/pd005b/009 /tmp")
36
+ end
37
+
38
+ parser.parse!(ARGV)
39
+ puts parser unless ARGV.size >= 2
40
+ return options
41
+ end
42
+
43
+ def prep_mise(directories, options)
44
+ if options[:mktmpdir]
45
+ begin
46
+ destination = Dir.mktmpdir
47
+ rescue
48
+ begin
49
+ destination = Dir.tmpdir
50
+ rescue
51
+ destination = '/tmp/'
52
+ end
53
+ end
54
+ else
55
+ destination = directories.pop
56
+ end
57
+
58
+ directories.each do |directory|
59
+ directory.prep_mise_to(destination)
60
+ end
61
+
62
+ end
63
+
64
+ if File.basename(__FILE__) == File.basename($PROGRAM_NAME)
65
+ $LOG = Logger.new(STDOUT)
66
+ $LOG.level = Logger::INFO
67
+
68
+ options = parse_options
69
+ directories = ARGV.collect { |dir| Pathname.new(dir) }
70
+ prep_mise(directories, options)
71
+ end
data/escoffier.gemspec CHANGED
@@ -5,14 +5,14 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{escoffier}
8
- s.version = "0.0.0"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Erik Kastman"]
12
- s.date = %q{2010-04-26}
12
+ s.date = %q{2010-05-11}
13
13
  s.description = %q{Administrative prep tasks, from mother sauces to hotel pans.}
14
14
  s.email = %q{ekk@medicine.wisc.edu}
15
- s.executables = ["normalize_directory.rb", "mise"]
15
+ s.executables = ["normalize_directory.rb", "mise~", "mise"]
16
16
  s.extra_rdoc_files = [
17
17
  "README.rdoc"
18
18
  ]
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
+ - 1
7
8
  - 0
8
- - 0
9
- version: 0.0.0
9
+ version: 0.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Erik Kastman
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-26 00:00:00 -05:00
17
+ date: 2010-05-11 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -45,6 +45,7 @@ description: Administrative prep tasks, from mother sauces to hotel pans.
45
45
  email: ekk@medicine.wisc.edu
46
46
  executables:
47
47
  - normalize_directory.rb
48
+ - mise~
48
49
  - mise
49
50
  extensions: []
50
51