ffc 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/README.md +52 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/ffc +4 -0
- data/bin/setup +8 -0
- data/exe/ffc +4 -0
- data/ffc.gemspec +39 -0
- data/lib/.#cvt.rb +1 -0
- data/lib/db.bin +0 -0
- data/lib/ffc.rb +156 -0
- data/lib/ffc/cli.rb +131 -0
- data/lib/ffc/version.rb +3 -0
- metadata +158 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 35c8b3d8fb277ab78a5be75866307c6f2e25305e
|
4
|
+
data.tar.gz: 578acf312a8d7768ce31d831b4d28db67b784a3f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5268f2197e7880929760fba4d546f0d1014b62cd9d3cde03699c3cdf92c82a220be5466a4086bb81411a2f05a3f1a9546a3af23a1bc99f6292ced69595a3e3d7
|
7
|
+
data.tar.gz: fcc18b031f5b8b73ff400fcfd6670dab4dfa73cb08d319ccc019fe903f74f24619e909ec3bbc87672fe5575091c4e1e26d271950004a8892c9848144768b53de
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# FFC
|
2
|
+
|
3
|
+
File Formats Conversion Tool
|
4
|
+
|
5
|
+
Especially, this tool may be useful for bioinformatics.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Install it yourself as:
|
10
|
+
|
11
|
+
$ gem install ffc
|
12
|
+
|
13
|
+
## Examples
|
14
|
+
|
15
|
+
To convert markdown file to HTML file:
|
16
|
+
|
17
|
+
$ ffc convert a.md a.html
|
18
|
+
$ ffc c a.md a.html
|
19
|
+
|
20
|
+
To convert "sam" format file to "bam" format file (It converts automatically if you do not know appreciate commands and parameters.):
|
21
|
+
|
22
|
+
$ ffc convert a.sam a.bam
|
23
|
+
$ ffc c a.sam a.bam
|
24
|
+
|
25
|
+
To show the whole list of available convert commands:
|
26
|
+
|
27
|
+
$ ffc list a.png
|
28
|
+
$ ffc l a.png
|
29
|
+
|
30
|
+
To show help:
|
31
|
+
|
32
|
+
$ ffc help [COMMAND]
|
33
|
+
$ ffc h [COMMAND]
|
34
|
+
|
35
|
+
When there are alternative tools, you can select one of them.
|
36
|
+
|
37
|
+
## Development
|
38
|
+
|
39
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
40
|
+
|
41
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
42
|
+
|
43
|
+
## Notice
|
44
|
+
|
45
|
+
If there are no package to run a suggested command, this tool will install the package with `brew install` in default.
|
46
|
+
|
47
|
+
If you use another package manager such as `apt`, `yum` or `conda`, you can configure the default command. But there is no interface or guide yet.
|
48
|
+
|
49
|
+
## Contributing
|
50
|
+
|
51
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/6br/ffc.
|
52
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "ffc"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/ffc
ADDED
data/bin/setup
ADDED
data/exe/ffc
ADDED
data/ffc.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ffc/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "ffc"
|
8
|
+
spec.version = Conv::VERSION
|
9
|
+
spec.authors = ["6br"]
|
10
|
+
spec.email = ["git_hub-ruby@yahoo.co.jp"]
|
11
|
+
|
12
|
+
spec.summary = %q{Support to convert file formats by preset UNIX commands}
|
13
|
+
spec.description = %q{Support to convert file formats choosing from a preset UNIX command list}
|
14
|
+
spec.homepage = "https://github.com/6br/ffc"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
#spec.metadata['allowed_push_host'] = "http://mygemserver.com"
|
20
|
+
else
|
21
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
22
|
+
"public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
f.match(%r{^(test|spec|features)/})
|
27
|
+
end
|
28
|
+
spec.bindir = "exe"
|
29
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
|
32
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
33
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
34
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
35
|
+
spec.add_runtime_dependency "thor"
|
36
|
+
spec.add_runtime_dependency "tty-prompt"
|
37
|
+
spec.add_runtime_dependency "config"
|
38
|
+
spec.add_runtime_dependency "systemu"
|
39
|
+
end
|
data/lib/.#cvt.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
lib/tate@Toshiyuki-no-MacBook-Pro.local.96971
|
data/lib/db.bin
ADDED
Binary file
|
data/lib/ffc.rb
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "ffc/version"
|
3
|
+
require "ffc/cli"
|
4
|
+
|
5
|
+
require 'mkmf'
|
6
|
+
require 'systemu'
|
7
|
+
require "open3"
|
8
|
+
require "config"
|
9
|
+
|
10
|
+
module Conv
|
11
|
+
|
12
|
+
class Conv
|
13
|
+
attr_accessor :conv_items, :package_manager
|
14
|
+
|
15
|
+
def initialize
|
16
|
+
path_name = Pathname.new( File.expand_path(File.join(File.dirname(__FILE__), 'db.bin')))
|
17
|
+
if !path_name.exist?
|
18
|
+
self.save!
|
19
|
+
end
|
20
|
+
path_name.open('rb') do |f|
|
21
|
+
@conv_items = Marshal.load(f)
|
22
|
+
@conv_items.default_proc = ->(h, k) { h[k] = [] }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.save!
|
27
|
+
@conv_items = Hash.new{ |h,k| h[k] = [] }
|
28
|
+
#items.each{ |item| item.input.each { |t| @conv_items[t] << item }}
|
29
|
+
self.rehash.each{ |item| @conv_items[item.input] << item }
|
30
|
+
@conv_items.default_proc = nil
|
31
|
+
File.open(File.expand_path(File.join(File.dirname(__FILE__), 'db.bin')), 'w') {|f| f.write(Marshal.dump(@conv_items)) }
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.update!(new_item)
|
35
|
+
#TODO(NOT IMPLEMENTED)
|
36
|
+
#new_item.last_access = Time.now
|
37
|
+
#p new_item
|
38
|
+
#p @conv_items.select{ |item| item.command == new_item.command }#[0] = new_item
|
39
|
+
#@conv_items.default_proc = nil
|
40
|
+
#File.open(File.expand_path(File.join(File.dirname(__FILE__), 'db.bin')), 'w') {|f| f.write(Marshal.dump(@conv_items)) }
|
41
|
+
end
|
42
|
+
|
43
|
+
def find_item(inputs, output, input_format=nil, output_format=nil, package_manager=nil)
|
44
|
+
inputs = inputs.map{ |input| Pathname(input) }
|
45
|
+
output = Pathname(output)
|
46
|
+
inputs_ext = inputs.map{ |input| input.extname.slice(1..-1) }
|
47
|
+
output_ext = output.extname.slice(1..-1)
|
48
|
+
inputs_ext = input_format if input_format
|
49
|
+
output_ext = output_format if output_format
|
50
|
+
return @conv_items[inputs_ext].select{ |t| t.output == [output_ext] }.sort_by{ |item| item.last_access }.map{ |t| t.input_path=inputs;t.output_path=output;t }
|
51
|
+
#@prompt.select
|
52
|
+
end
|
53
|
+
|
54
|
+
def list(inputs, input_format=nil, package_manager=nil)
|
55
|
+
inputs_path = inputs.map{ |input| Pathname(input) }
|
56
|
+
inputs_ext = inputs_path.map{ |input| input.extname.slice(1..-1) }
|
57
|
+
inputs_ext = input_format if input_format
|
58
|
+
#input = Pathname(input)
|
59
|
+
#input_ext = input.extname
|
60
|
+
return @conv_items[inputs_ext].sort_by{ |item| item.last_access }.sort_by{ |item| item.last_access }.map{ |t| t.input_path=inputs;t.output_path=t.generate_output_filename(inputs[0]);t }
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
def self.rehash
|
65
|
+
items = []
|
66
|
+
items << ConvItem.new(input: ["bam"], output: ["sam"], command: "samtools view -h {input} > {output}", substitute: "{}", package: "samtools", output_buffer: :stdout)
|
67
|
+
items << ConvItem.new(input: ["sam"], output: ["bam"], command: "samtools view -bS {input} > {output}", substitute: "{}", package: "samtools", output_buffer: :stdout)
|
68
|
+
items << ConvItem.new(input: ["bam"], output: ["bai"], command: "samtools index {input}", substitute: "{}", package: "samtools")
|
69
|
+
items << ConvItem.new(input: ["fa"], output: ["fai"], command: "samtools faidx {input}", substitute: "{}", package: "samtools")
|
70
|
+
items << ConvItem.new(input: ["bam"], output: ["fasta"], command: "samtools fasta {input} > {output}", substitute: "{}", package: "samtools")
|
71
|
+
items << ConvItem.new(input: ["bam"], output: ["fastq"], command: "samtools fastq {input} > {output}", substitute: "{}", package: "samtools")
|
72
|
+
items << ConvItem.new(input: ["sam"], output: ["gtf"], command: "cufflinks {input}", substitute: "{}", package: "cufflinks")
|
73
|
+
items << ConvItem.new(input: ["bam"], output: ["gtf"], command: "cufflinks {input}", substitute: "{}", package: "cufflinks")
|
74
|
+
items << ConvItem.new(input: ["vcf"], output: ["vcf.gz"], command: "bgzip -c {input} > {output}", substitute: "{}", package: "samtools")
|
75
|
+
items << ConvItem.new(input: ["mid"], output: ["wav"], command: "timidity {input} -Ow -o {output}", substitute: "{}", package: "tmidity")
|
76
|
+
items << ConvItem.new(input: ["sam", "gtf"], output: ["txt"], command: "htseq-count {input} {input} > {output}", substitute: "{}", package: "htseq", pacman: "pip install")
|
77
|
+
items << ConvItem.new(input: ["bam", "gtf"], output: ["txt"], command: "htseq-count -f bam {input} {input} > {output}", substitute: "{}", package: "htseq", pacman: "pip install")
|
78
|
+
["png", "pdf", "ps", "jpg"].each do |i|
|
79
|
+
items << ConvItem.new(input: ["dot"], output: [i], command: "dot -T#{i} {input} > {output}", substitute: "{}", package: "graphviz")
|
80
|
+
end
|
81
|
+
["png", "jpg", "tif", "bmp", "gif"].permutation(2).each do |i, j|
|
82
|
+
items << ConvItem.new(input: [i], output: [j], command: "convert {input} {output}", substitute: "{}", package: "imagemagick")
|
83
|
+
end
|
84
|
+
items << ConvItem.new(input: ["wav"], output: ["mp3"], command: "lame {input} {output}", substitute: "{}", package: "lame")
|
85
|
+
items << ConvItem.new(input: ["wav"], output: ["mp3"], command: "avconv -i {input} {output}", substitute: "{}", package: "libav")
|
86
|
+
items << ConvItem.new(input: ["md"], output: ["html"], command: "python -m markdown {input} > {output}", substitute: "{}", package: "markdown", pacman: "pip install")
|
87
|
+
items << ConvItem.new(input: ["md"], output: ["html"], command: "pandoc -f markdown_github {input} > {output}", substitute: "{}", package: "pandoc")
|
88
|
+
items
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
class ConvItem
|
93
|
+
attr_accessor :input, :output, :command, :package, :substitute, :last_access, :pacman, :output_buffer, :input_path, :output_path
|
94
|
+
|
95
|
+
def initialize **params
|
96
|
+
Config.load_and_set_settings(Dir.home + ".conv")
|
97
|
+
@package_manager = Settings.package_manager
|
98
|
+
params.each{|k,v| self.send("#{k}=", v) if self.methods.include?(k)}
|
99
|
+
end
|
100
|
+
|
101
|
+
def generate_command(options, input, output)
|
102
|
+
return [self.cmd, self.brew]
|
103
|
+
end
|
104
|
+
|
105
|
+
def generate_output_filename(input, option=:exchange)
|
106
|
+
extensions = self.output
|
107
|
+
case option
|
108
|
+
when :exchange
|
109
|
+
extensions = extensions.map{ |ext| Pathname(input).sub_ext("."+ext).to_s }
|
110
|
+
when :prefix
|
111
|
+
extensions = extensions.map{ |ext| input + "." + ext }
|
112
|
+
#when :withtime
|
113
|
+
# extensions = extensions.map{ |ext| Pathname(input + "." + ext) }
|
114
|
+
end
|
115
|
+
extensions[0]
|
116
|
+
end
|
117
|
+
|
118
|
+
def cmd(inputs, output)
|
119
|
+
cmd = self.command
|
120
|
+
|
121
|
+
inputs.each{ |input| cmd.sub!("{input}", input)}
|
122
|
+
cmd.sub!("{output}", output)
|
123
|
+
return cmd
|
124
|
+
end
|
125
|
+
|
126
|
+
def to_s
|
127
|
+
return self.output.to_s + " " + self.cmd(@input_path, @output_path) + " (" + self.package + ")"
|
128
|
+
end
|
129
|
+
|
130
|
+
def run!(inputs, output)
|
131
|
+
raise "Error -- no input file" unless inputs.all?{ |t| Pathname(t).exist?}
|
132
|
+
status, stdout, stderr = systemu self.cmd(inputs, output)
|
133
|
+
|
134
|
+
return status, stdout, stderr
|
135
|
+
end
|
136
|
+
|
137
|
+
def brew!
|
138
|
+
status, stdout, stderr= systemu self.brew_command
|
139
|
+
#status, stdout = Open3.capture2(self.brew_command)
|
140
|
+
return status, stdout, stderr
|
141
|
+
end
|
142
|
+
|
143
|
+
def brew_command
|
144
|
+
if self.pacman
|
145
|
+
return pacman + " " + package
|
146
|
+
else
|
147
|
+
if !@package_manager
|
148
|
+
return "brew install " + package
|
149
|
+
else
|
150
|
+
return @package_manager + package
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
data/lib/ffc/cli.rb
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'ffc'
|
3
|
+
require 'thor'
|
4
|
+
require 'tty-prompt'
|
5
|
+
|
6
|
+
module Conv
|
7
|
+
class CLI < Thor
|
8
|
+
package_name "ffc"
|
9
|
+
#default_command :convert
|
10
|
+
|
11
|
+
desc "convert INPUTS OUTPUT", "convert file formats from input to output."
|
12
|
+
option :confirm, type: :boolean, aliases: '-c', desc: "Confirm or choice from alternative tools."
|
13
|
+
#option :onetime, type: :boolean, aliases: '-1', desc: "Do not save in the internal command history."
|
14
|
+
option :overwrite, type: :boolean, aliases: '-w', desc: "Overwrite output file without confirm."
|
15
|
+
option :autobrew, type: :boolean, aliases: '-b', desc: "Install without confirmation if there is no candidate binary."
|
16
|
+
option :input_format, type: :array, aliases: '-i', desc: "Specify input file formats regardless of extensions."
|
17
|
+
option :output_format, type: :string, aliases: '-o', desc: "Specify the output file format regardless of the extension."
|
18
|
+
option :hidelist, type: :boolean, aliases: '-h', desc: "Do not show lists related to inputs when no candidates"
|
19
|
+
option :quiet, type: :boolean, aliases: '-q', desc: "Run quietly."
|
20
|
+
option :dryrun, type: :boolean, aliases: '-d', desc: "Do not execute command."
|
21
|
+
option :package_manager, type: :array, aliases: '-p', desc: "Set Package manager prefix such as 'brew install'"
|
22
|
+
def convert(*inputs, output) # Define commands as a method.
|
23
|
+
prompt = TTY::Prompt.new(interrupt: :exit)
|
24
|
+
items = Conv.new.find_item(inputs, output, input_format=input_format, output_format=output_format, package_manager: options[:package_manager])
|
25
|
+
candidate = items[0]
|
26
|
+
if items.empty?
|
27
|
+
prompt.error "No candidates."
|
28
|
+
inputs << output
|
29
|
+
list(*inputs) if !options[:hidelist]
|
30
|
+
else
|
31
|
+
if options[:confirm]#interactive]
|
32
|
+
candidate = prompt.select("Choose commands (To cancel, press CTRL+C)", items) #do |item|
|
33
|
+
end
|
34
|
+
prompt.ok candidate.cmd(inputs, output) unless options[:quiet]
|
35
|
+
return if !options[:overwrite] && !ask_overwrite(output) || options[:dryrun]
|
36
|
+
status, stdout, stderr = candidate.run!(inputs, output)
|
37
|
+
prompt.ok stdout
|
38
|
+
prompt.error stderr
|
39
|
+
if status != 0
|
40
|
+
if options[:autobrew] || !prompt.no?("Install " + candidate.package + " with package manager? (" + candidate.brew_command + ")")
|
41
|
+
status, stdout, stderr = candidate.brew!
|
42
|
+
prompt.say stdout
|
43
|
+
prompt.error stderr
|
44
|
+
if status == 0
|
45
|
+
status, stdout, stderr = candidate.run!(inputs, output)
|
46
|
+
prompt.ok stdout
|
47
|
+
prompt.error stderr
|
48
|
+
end
|
49
|
+
end
|
50
|
+
else
|
51
|
+
Conv.update!(candidate) unless options[:onetime]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
desc "list INPUTS", "show aveilable convert formats."
|
57
|
+
#option :interactive, type: :boolean, aliases: '-i', desc: "Only show lists"
|
58
|
+
option :showonly, type: :boolean, aliases: '-s', desc: "Only show lists"
|
59
|
+
option :add_prefix, type: :boolean, aliases: '-p', desc: "Add prefix to input's filename"
|
60
|
+
option :overwrite, type: :boolean, aliases: '-w', desc: "Overwrite output without confirm"
|
61
|
+
option :autobrew, type: :boolean, aliases: '-b', desc: "Install without confirmation if there is no candidate binary."
|
62
|
+
option :input_format, type: :array, aliases: '-i', desc: "Specify input file formats regardless of extensions."
|
63
|
+
option :quiet, type: :boolean, aliases: '-q', desc: "Run quietly."
|
64
|
+
option :dryrun, type: :boolean, aliases: '-d', desc: "Do not execute command."
|
65
|
+
option :package_manager, type: :array, aliases: '-p', desc: "Set Package manager prefix such as 'brew install'"
|
66
|
+
def list(*inputs)
|
67
|
+
prompt = TTY::Prompt.new(interrupt: :exit)
|
68
|
+
items = Conv.new.list(inputs, input_format=input_format, package_manager: options[:package_manager])
|
69
|
+
#p inputs,items
|
70
|
+
if items.empty?
|
71
|
+
prompt.error "No candidates."
|
72
|
+
return
|
73
|
+
end
|
74
|
+
if !options[:showonly]
|
75
|
+
candidate = prompt.select("Choose commands (To cancel: CTRL+C)", items) #do |item|
|
76
|
+
option = options[:add_prefix] ? :prefix : :exchange
|
77
|
+
output = candidate.generate_output_filename(inputs[0], option)
|
78
|
+
|
79
|
+
return if !options[:overwrite] && !ask_overwrite(output) || options[:dryrun]
|
80
|
+
prompt.ok candidate.cmd(inputs, output) unless options[:quiet]
|
81
|
+
status, stdout, stderr = candidate.run!(inputs, output)#(options[:autobrew])
|
82
|
+
prompt.say stdout
|
83
|
+
prompt.error stderr
|
84
|
+
if status != 0
|
85
|
+
if options[:autobrew] || !prompt.no?("Install " + candidate.package + " with package manager? (" + candidate.brew_command + ")")
|
86
|
+
status, stdout, stderr = candidate.brew!
|
87
|
+
prompt.say stdout
|
88
|
+
prompt.error stderr
|
89
|
+
if status == 0
|
90
|
+
status, stdout, stderr = candidate.run!(inputs, output)
|
91
|
+
prompt.say stdout
|
92
|
+
prompt.error stderr
|
93
|
+
end
|
94
|
+
end
|
95
|
+
else
|
96
|
+
Conv.update!(candidate) unless options[:onetime]
|
97
|
+
end
|
98
|
+
else
|
99
|
+
prompt.say items.join("")
|
100
|
+
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
desc "sort INPUT", "Sort the file. (Not Implemented)"
|
105
|
+
option :overwrite, type: :boolean, aliases: '-w', desc: "Overwrite existing file"
|
106
|
+
def sort(input)
|
107
|
+
#
|
108
|
+
end
|
109
|
+
|
110
|
+
desc "index INPUT", "Index the file. (Not Implemented)"
|
111
|
+
option :overwrite, type: :boolean, aliases: '-w', desc: "Overwrite existing file"
|
112
|
+
def index(input)
|
113
|
+
#
|
114
|
+
end
|
115
|
+
|
116
|
+
desc "rehash", "Rehash index and clean command history. (For debugging)"
|
117
|
+
def rehash
|
118
|
+
Conv.save!
|
119
|
+
end
|
120
|
+
|
121
|
+
private
|
122
|
+
def ask_overwrite(output)
|
123
|
+
if Pathname(output).exist?
|
124
|
+
return TTY::Prompt.new.yes?("Overwrite existing file " + output + "?")
|
125
|
+
end
|
126
|
+
true
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
data/lib/ffc/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ffc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- 6br
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-03-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.14'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.14'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: thor
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: tty-prompt
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: config
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: systemu
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Support to convert file formats choosing from a preset UNIX command list
|
112
|
+
email:
|
113
|
+
- git_hub-ruby@yahoo.co.jp
|
114
|
+
executables:
|
115
|
+
- ffc
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- ".gitignore"
|
120
|
+
- ".rspec"
|
121
|
+
- ".travis.yml"
|
122
|
+
- Gemfile
|
123
|
+
- README.md
|
124
|
+
- Rakefile
|
125
|
+
- bin/console
|
126
|
+
- bin/ffc
|
127
|
+
- bin/setup
|
128
|
+
- exe/ffc
|
129
|
+
- ffc.gemspec
|
130
|
+
- lib/.#cvt.rb
|
131
|
+
- lib/db.bin
|
132
|
+
- lib/ffc.rb
|
133
|
+
- lib/ffc/cli.rb
|
134
|
+
- lib/ffc/version.rb
|
135
|
+
homepage: https://github.com/6br/ffc
|
136
|
+
licenses: []
|
137
|
+
metadata: {}
|
138
|
+
post_install_message:
|
139
|
+
rdoc_options: []
|
140
|
+
require_paths:
|
141
|
+
- lib
|
142
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
requirements: []
|
153
|
+
rubyforge_project:
|
154
|
+
rubygems_version: 2.6.8
|
155
|
+
signing_key:
|
156
|
+
specification_version: 4
|
157
|
+
summary: Support to convert file formats by preset UNIX commands
|
158
|
+
test_files: []
|