ffc 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.gitignore +1 -1
- data/.travis.yml +9 -0
- data/README.md +9 -0
- data/ffc.gemspec +2 -0
- data/lib/db.bin +0 -0
- data/lib/ffc.rb +41 -3
- data/lib/ffc/cli.rb +2 -1
- data/lib/ffc/version.rb +1 -1
- metadata +31 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: defe1a3fab20213b90eb9cfd222a90534a3eb3a1
|
4
|
+
data.tar.gz: c1c99152708b698445ce851972ee4520ff27e903
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 317405d557a0c30dd38fb972b12bcacab1001eb9182ec2e9ee83a4a7b36a6bdb8715556d14d51dd5dac015056dabde273fcf10dba567774e490847e43127259a
|
7
|
+
data.tar.gz: 76f0cf01ecfbaad2b29991f3dea7b7b1d4b8a4609a2a5900b57effdd06e88826ad444c9dcb1d2c76eb57a7bb0c15626dc2abfcaa9de07c402ce70cbb34f10f25
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
repo_token: XikFUXoviVzpmFkaeGTjReAR6hDeQfBIP
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
# FFC
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/ffc.svg)](https://badge.fury.io/rb/ffc)
|
3
|
+
[![Build Status](https://travis-ci.org/6br/ffc.svg?branch=master)](https://travis-ci.org/6br/ffc)
|
4
|
+
[![Stories in Ready](https://badge.waffle.io/6br/ffc.svg?label=ready&title=Ready)](http://waffle.io/6br/ffc)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/6br/ffc/badges/gpa.svg)](https://codeclimate.com/github/6br/ffc)
|
2
6
|
|
3
7
|
File Formats Conversion Tool
|
4
8
|
|
@@ -12,6 +16,11 @@ Install it yourself as:
|
|
12
16
|
|
13
17
|
## Examples
|
14
18
|
|
19
|
+
To compile programs:
|
20
|
+
|
21
|
+
$ ffc convert sample.c a.out
|
22
|
+
$ ffc c sample.c a.out
|
23
|
+
|
15
24
|
To convert markdown file to HTML file:
|
16
25
|
|
17
26
|
$ ffc convert a.md a.html
|
data/ffc.gemspec
CHANGED
@@ -32,6 +32,8 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_development_dependency "bundler", "~> 1.14"
|
33
33
|
spec.add_development_dependency "rake", "~> 10.0"
|
34
34
|
spec.add_development_dependency "rspec", "~> 3.0"
|
35
|
+
spec.add_development_dependency "coveralls"
|
36
|
+
spec.add_development_dependency "codeclimate-test-reporter"
|
35
37
|
spec.add_runtime_dependency "thor"
|
36
38
|
spec.add_runtime_dependency "tty-prompt"
|
37
39
|
spec.add_runtime_dependency "config"
|
data/lib/db.bin
CHANGED
Binary file
|
data/lib/ffc.rb
CHANGED
@@ -67,16 +67,21 @@ module Conv
|
|
67
67
|
items << ConvItem.new(input: ["sam"], output: ["bam"], command: "samtools view -bS {input} > {output}", substitute: "{}", package: "samtools", output_buffer: :stdout)
|
68
68
|
items << ConvItem.new(input: ["bam"], output: ["bai"], command: "samtools index {input}", substitute: "{}", package: "samtools")
|
69
69
|
items << ConvItem.new(input: ["fa"], output: ["fai"], command: "samtools faidx {input}", substitute: "{}", package: "samtools")
|
70
|
+
items << ConvItem.new(input: ["fasta"], output: ["fai"], command: "samtools faidx {input}", substitute: "{}", package: "samtools")
|
71
|
+
#items << ConvItem.new(input: ["fa", "vcf.gz"], output: ["fa"], command: "bcftools consensus {input} {input} > {output}", substitute: "{}", package: "bcftools")
|
72
|
+
#items << ConvItem.new(input: ["fasta", "vcf.gz"], output: ["fa"], command: "bcftools consensus {input} {input} > {output}", substitute: "{}", package: "bcftools")
|
70
73
|
items << ConvItem.new(input: ["bam"], output: ["fasta"], command: "samtools fasta {input} > {output}", substitute: "{}", package: "samtools")
|
71
74
|
items << ConvItem.new(input: ["bam"], output: ["fastq"], command: "samtools fastq {input} > {output}", substitute: "{}", package: "samtools")
|
72
75
|
items << ConvItem.new(input: ["sam"], output: ["gtf"], command: "cufflinks {input}", substitute: "{}", package: "cufflinks")
|
73
76
|
items << ConvItem.new(input: ["bam"], output: ["gtf"], command: "cufflinks {input}", substitute: "{}", package: "cufflinks")
|
74
77
|
items << ConvItem.new(input: ["vcf"], output: ["vcf.gz"], command: "bgzip -c {input} > {output}", substitute: "{}", package: "samtools")
|
75
78
|
items << ConvItem.new(input: ["mid"], output: ["wav"], command: "timidity {input} -Ow -o {output}", substitute: "{}", package: "tmidity")
|
79
|
+
items << ConvItem.new(input: ["midi"], output: ["wav"], command: "timidity {input} -Ow -o {output}", substitute: "{}", package: "tmidity")
|
76
80
|
items << ConvItem.new(input: ["sam", "gtf"], output: ["txt"], command: "htseq-count {input} {input} > {output}", substitute: "{}", package: "htseq", pacman: "pip install")
|
77
81
|
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|
|
82
|
+
["png", "pdf", "ps", "jpg", "svg"].each do |i|
|
79
83
|
items << ConvItem.new(input: ["dot"], output: [i], command: "dot -T#{i} {input} > {output}", substitute: "{}", package: "graphviz")
|
84
|
+
items << ConvItem.new(input: ["dot"], output: [i], command: "neato -T#{i} {input} > {output}", substitute: "{}", package: "graphviz")
|
80
85
|
end
|
81
86
|
["png", "jpg", "tif", "bmp", "gif"].permutation(2).each do |i, j|
|
82
87
|
items << ConvItem.new(input: [i], output: [j], command: "convert {input} {output}", substitute: "{}", package: "imagemagick")
|
@@ -84,16 +89,49 @@ module Conv
|
|
84
89
|
items << ConvItem.new(input: ["wav"], output: ["mp3"], command: "lame {input} {output}", substitute: "{}", package: "lame")
|
85
90
|
items << ConvItem.new(input: ["wav"], output: ["mp3"], command: "avconv -i {input} {output}", substitute: "{}", package: "libav")
|
86
91
|
items << ConvItem.new(input: ["md"], output: ["html"], command: "python -m markdown {input} > {output}", substitute: "{}", package: "markdown", pacman: "pip install")
|
92
|
+
items << ConvItem.new(input: ["markdown"], output: ["html"], command: "python -m markdown {input} > {output}", substitute: "{}", package: "markdown", pacman: "pip install")
|
87
93
|
items << ConvItem.new(input: ["md"], output: ["html"], command: "pandoc -f markdown_github {input} > {output}", substitute: "{}", package: "pandoc")
|
94
|
+
items << ConvItem.new(input: ["markdown"], output: ["html"], command: "pandoc -f markdown_github {input} > {output}", substitute: "{}", package: "pandoc")
|
95
|
+
|
96
|
+
# Compile without options.
|
97
|
+
items << ConvItem.new(input: ["c"], output: ["o"], command: "gcc -c -o {output} {input}", package: "gcc", lang: "c")
|
98
|
+
items << ConvItem.new(input: ["c"], output: ["out"], command: "gcc -o {output} {input}", package: "gcc", lang: "c")
|
99
|
+
items << ConvItem.new(input: ["c"], output: ["o"], command: "clang -c -o {output} {input}", package: "clang", lang:"c")
|
100
|
+
items << ConvItem.new(input: ["c"], output: ["out"], command: "clang -o {output} {input}", package: "clang", lang:"c")
|
101
|
+
items << ConvItem.new(input: ["cpp"], output: ["o"], command: "g++ -c -o {output} {input}", package: "g++", lang: "c++")
|
102
|
+
items << ConvItem.new(input: ["cpp"], output: ["out"], command: "g++ -o {output} {input}", package: "g++", lang: "c++")
|
103
|
+
items << ConvItem.new(input: ["cpp"], output: ["o"], command: "clang++ -c -o {output} {input}", package: "clang", lang: "c++")
|
104
|
+
items << ConvItem.new(input: ["cpp"], output: ["out"], command: "clang++ -o {output} {input}", package: "clang", lang: "c++")
|
105
|
+
items << ConvItem.new(input: ["cc"], output: ["o"], command: "g++ -c -o {output} {input}", package: "g++", lang: "c++")
|
106
|
+
items << ConvItem.new(input: ["cc"], output: ["out"], command: "g++ -o {output} {input}", package: "g++", lang: "c++")
|
107
|
+
items << ConvItem.new(input: ["cc"], output: ["o"], command: "clang++ -c -o {output} {input}", package: "clang", lang: "c++")
|
108
|
+
items << ConvItem.new(input: ["cc"], output: ["out"], command: "clang++ -o {output} {input}", package: "clang", lang: "c++")
|
109
|
+
|
110
|
+
items << ConvItem.new(input: ["rs"], output: ["out"], command: "rustc -o {output} {input}", package: "rust", lang: "rust", warning: "Use cargo")
|
111
|
+
items << ConvItem.new(input: ["hs"], output: ["out"], command: "ghc -o {output} {input}", package: "ghc", lang: "haskell", warning: "Use cabal / stack")
|
112
|
+
items << ConvItem.new(input: ["d"], output: ["out"], command: "gdc -o {output} {input}", package: "gdc", lang: "d")
|
113
|
+
items << ConvItem.new(input: ["cr"], output: ["out"], command: "crystal build -o {output} {input}", package: "crystal", lang: "crystal")
|
114
|
+
items << ConvItem.new(input: ["cr"], output: ["out"], command: "mlton -output {output} {input}", package: "mlton", lang: "standard ML")
|
115
|
+
items << ConvItem.new(input: ["swift"], output: ["out"], command: "swiftc -o {output} {input}", package: "swift", lang: "swift")
|
116
|
+
items << ConvItem.new(input: ["go"], output: ["out"], command: "go build -o {output} {input}", package: "go", lang: "golang")
|
117
|
+
|
118
|
+
# https://github.com/jashkenas/coffeescript/wiki/list-of-languages-that-compile-to-js
|
119
|
+
items << ConvItem.new(input: ["ts"], output: ["js"], command: "tsc {input}", package: "typescript", lang: "typescript", pacman: "npm install -g")
|
120
|
+
items << ConvItem.new(input: ["coffee"], output: ["js"], command: "coffee {input}", package: "coffee-script", lang: "coffee-script", pacman: "npm install -g")
|
121
|
+
items << ConvItem.new(input: ["rb"], output: ["js"], command: "opal -c {input} > {output}", lang: "opal", package: "opal", pacman: "gem install")
|
122
|
+
items << ConvItem.new(input: ["lua"], output: ["out"], command: "luac -o {output} {input}", package: "lua", lang: "lua")
|
123
|
+
items << ConvItem.new(input: ["lua"], output: ["out"], command: "luajit -b {input} {output}", package: "luajit", lang: "lua")
|
124
|
+
|
88
125
|
items
|
89
126
|
end
|
90
127
|
end
|
91
128
|
|
92
129
|
class ConvItem
|
93
|
-
attr_accessor :input, :output, :command, :package, :substitute, :last_access, :pacman, :output_buffer, :input_path, :output_path
|
130
|
+
attr_accessor :input, :output, :command, :package, :substitute, :last_access, :pacman, :output_buffer, :input_path, :output_path, :type, :lang, :warning
|
94
131
|
|
95
132
|
def initialize **params
|
96
133
|
Config.load_and_set_settings(Dir.home + ".conv")
|
134
|
+
@type |= :convert
|
97
135
|
@package_manager = Settings.package_manager
|
98
136
|
params.each{|k,v| self.send("#{k}=", v) if self.methods.include?(k)}
|
99
137
|
end
|
@@ -127,7 +165,7 @@ module Conv
|
|
127
165
|
return self.output.to_s + " " + self.cmd(@input_path, @output_path) + " (" + self.package + ")"
|
128
166
|
end
|
129
167
|
|
130
|
-
def run!(inputs, output)
|
168
|
+
def run!(inputs, output, arguments="")
|
131
169
|
raise "Error -- no input file" unless inputs.all?{ |t| Pathname(t).exist?}
|
132
170
|
status, stdout, stderr = systemu self.cmd(inputs, output)
|
133
171
|
|
data/lib/ffc/cli.rb
CHANGED
@@ -19,6 +19,7 @@ module Conv
|
|
19
19
|
option :quiet, type: :boolean, aliases: '-q', desc: "Run quietly."
|
20
20
|
option :dryrun, type: :boolean, aliases: '-d', desc: "Do not execute command."
|
21
21
|
option :package_manager, type: :array, aliases: '-p', desc: "Set Package manager prefix such as 'brew install'"
|
22
|
+
#option :arguments, type: :string, aliases: '-a', desc: "Set arguments to provide a certain command such as '-O2'"
|
22
23
|
def convert(*inputs, output) # Define commands as a method.
|
23
24
|
prompt = TTY::Prompt.new(interrupt: :exit)
|
24
25
|
items = Conv.new.find_item(inputs, output, input_format=input_format, output_format=output_format, package_manager: options[:package_manager])
|
@@ -33,7 +34,7 @@ module Conv
|
|
33
34
|
end
|
34
35
|
prompt.ok candidate.cmd(inputs, output) unless options[:quiet]
|
35
36
|
return if !options[:overwrite] && !ask_overwrite(output) || options[:dryrun]
|
36
|
-
status, stdout, stderr = candidate.run!(inputs, output)
|
37
|
+
status, stdout, stderr = candidate.run!(inputs, output, options[:arguments])
|
37
38
|
prompt.ok stdout
|
38
39
|
prompt.error stderr
|
39
40
|
if status != 0
|
data/lib/ffc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 6br
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,34 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
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: codeclimate-test-reporter
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: thor
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,6 +144,7 @@ executables:
|
|
116
144
|
extensions: []
|
117
145
|
extra_rdoc_files: []
|
118
146
|
files:
|
147
|
+
- ".coveralls.yml"
|
119
148
|
- ".gitignore"
|
120
149
|
- ".rspec"
|
121
150
|
- ".travis.yml"
|