genecon 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +59 -0
- data/Rakefile +1 -0
- data/bin/genecon +33 -0
- data/example/config.yaml +5 -0
- data/example/template.md +7 -0
- data/genecon.gemspec +18 -0
- data/lib/genecon.rb +5 -0
- data/lib/genecon/version.rb +3 -0
- metadata +58 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Akira Maeda
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# Genecon
|
2
|
+
|
3
|
+
genecon is text converter.
|
4
|
+
genecon convert erb file to your favorite format.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
gem 'genecon'
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install genecon
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
genecon require `template(erb)` and `config(yaml)`.
|
23
|
+
|
24
|
+
### template(erb)
|
25
|
+
|
26
|
+
```
|
27
|
+
# <%= @config['title'] %>
|
28
|
+
|
29
|
+
## <%= @config['sub_title'] %>
|
30
|
+
|
31
|
+
* <%= @config['date'] %>
|
32
|
+
* <%= @config['url'] %>
|
33
|
+
* <%= @config['email'] %>
|
34
|
+
```
|
35
|
+
|
36
|
+
### config(yaml)
|
37
|
+
|
38
|
+
```
|
39
|
+
title : this is title
|
40
|
+
sub_title : here is sub_title
|
41
|
+
date: 2012-12-21
|
42
|
+
url: http://www.google.co.jp
|
43
|
+
email: foo@foovar.com
|
44
|
+
```
|
45
|
+
|
46
|
+
### Command
|
47
|
+
|
48
|
+
``` shell
|
49
|
+
genecon -t FILE -c CONFIG
|
50
|
+
genecon --template FILE --config CONFIG
|
51
|
+
```
|
52
|
+
|
53
|
+
## Contributing
|
54
|
+
|
55
|
+
1. Fork it
|
56
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
57
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
58
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
59
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/genecon
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
require 'yaml'
|
5
|
+
require 'erb'
|
6
|
+
require 'optparse'
|
7
|
+
|
8
|
+
options = {}
|
9
|
+
|
10
|
+
if ARGV.size == 0
|
11
|
+
puts "usage: genecon -t FILE(erb) -c CONFIG(YAML)"
|
12
|
+
exit
|
13
|
+
end
|
14
|
+
|
15
|
+
op = OptionParser.new do |opts|
|
16
|
+
opts.on('-t', '--template template(markdown)') do |file|
|
17
|
+
options[:template] = file
|
18
|
+
end
|
19
|
+
opts.on('-c', '--config config(yaml)') do |conf|
|
20
|
+
options[:conf] = conf
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
op.parse!
|
25
|
+
|
26
|
+
t = IO.read(options[:template])
|
27
|
+
c = open(options[:conf])
|
28
|
+
@config = YAML.load(c)
|
29
|
+
|
30
|
+
erb = ERB.new(t, nil, '-')
|
31
|
+
print erb.result
|
32
|
+
|
33
|
+
c.close
|
data/example/config.yaml
ADDED
data/example/template.md
ADDED
data/genecon.gemspec
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'genecon/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "genecon"
|
8
|
+
gem.version = Genecon::VERSION
|
9
|
+
gem.authors = ["Akira Maeda"]
|
10
|
+
gem.email = ["glidenote@gmail.com"]
|
11
|
+
gem.summary = %q{convert template file(erb) to your favorit format.}
|
12
|
+
gem.homepage = "https://github.com/glidenote/genecon"
|
13
|
+
|
14
|
+
gem.files = `git ls-files`.split($/)
|
15
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
16
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
|
+
gem.require_paths = ["lib"]
|
18
|
+
end
|
data/lib/genecon.rb
ADDED
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: genecon
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Akira Maeda
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-12-24 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description:
|
15
|
+
email:
|
16
|
+
- glidenote@gmail.com
|
17
|
+
executables:
|
18
|
+
- genecon
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- .gitignore
|
23
|
+
- Gemfile
|
24
|
+
- LICENSE.txt
|
25
|
+
- README.md
|
26
|
+
- Rakefile
|
27
|
+
- bin/genecon
|
28
|
+
- example/config.yaml
|
29
|
+
- example/template.md
|
30
|
+
- genecon.gemspec
|
31
|
+
- lib/genecon.rb
|
32
|
+
- lib/genecon/version.rb
|
33
|
+
homepage: https://github.com/glidenote/genecon
|
34
|
+
licenses: []
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - ! '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
requirements: []
|
52
|
+
rubyforge_project:
|
53
|
+
rubygems_version: 1.8.23
|
54
|
+
signing_key:
|
55
|
+
specification_version: 3
|
56
|
+
summary: convert template file(erb) to your favorit format.
|
57
|
+
test_files: []
|
58
|
+
has_rdoc:
|