hiki2yard 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e843fab99886dd5358967973bf3c2da4a1e0aad0
4
+ data.tar.gz: 1f287c2fec651dfc94253f19a1f6f9674b2f25e2
5
+ SHA512:
6
+ metadata.gz: 1776fb74e4e97a1ebb1696cea6dfa84a7c06982dc65ba8c5757af4486685c0be30d7d8bfa82e1660e4cf3be7287640f38d6cd39a342cc32a8edf931a5315d9fe
7
+ data.tar.gz: 34185b677f59eb634e44d225cf808f13ac3bd97b8b7a5e36519768cdce9b9287c0bdfdb8232bc4abecf92619f2f2480d547e27e3aea6b9a85a110df4a71d9668
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ before_install: gem install bundler -v 1.11.2
data/.yardopts ADDED
@@ -0,0 +1,2 @@
1
+ -
2
+ **/*.md
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at shigeto_nishitani@me.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in hiki2yard.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Shigeto R. Nishitani
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # Hiki2yard
2
+
3
+ bundle gemで作られるdirectoryに,hikiからyard, wiki文書を作る環境を自動構築する.
4
+
5
+ ## 動機
6
+
7
+ | link | wiki | doc|
8
+ |:----|:----|:----|
9
+ | 動機 |[why?](Why_hiki2yard)|[why?](file.Why_hiki2yard.html)|
10
+
11
+
12
+ ## インストール
13
+
14
+ 以下のコマンドでgemとしてinstall:
15
+
16
+ ```
17
+ $ gem install hiki2yard
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ gemのdirectoryで
23
+
24
+ ```
25
+ $ hiki2yard --init
26
+ ```
27
+
28
+ と打ち込めば,自動的に環境を整備.
29
+
30
+ ### 動作内容
31
+
32
+ 1. Rakefileをcopy
33
+ 1. .yardoptsファイルを作成
34
+ 1. hikisディレクトリーを作成
35
+ 1. wikiディレクトリーを作成
36
+ 1. Githubでwikiを作成してからgit clone ***.wiki.gitのほうが確実.
37
+
38
+ ## その後
39
+
40
+ 1. hikisに適当にファイルを作成,編集
41
+ 1. rake yardでdocumentsが自動生成される.
42
+
43
+ ## やり残し
44
+
45
+ 1. mathjax用のひな形との切り替え.
46
+ 1. gemspecは手動で残した.
47
+ 1. リンク作成をwikiとdocで自動生成したいな...
48
+ 1. hiki2latexによるtex文書の自動生成.
49
+
50
+ ## Contributing
51
+
52
+ Bug reports and pull requests are welcome on GitHub at https://github.com/daddygongon/hiki2yard. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
53
+
54
+ ## License
55
+
56
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,34 @@
1
+ require "bundler/gem_tasks"
2
+ require 'yard'
3
+ require "rake/testtask"
4
+
5
+ p base_path = File.expand_path('..', __FILE__)
6
+ p basename = File.basename(base_path)
7
+
8
+ desc "make documents by yard"
9
+ task :yard => [:hiki2md] do
10
+ YARD::Rake::YardocTask.new
11
+ end
12
+
13
+ desc "transfer hikis/*.hiki to wiki"
14
+ task :hiki2md do
15
+ files = Dir.entries('hikis')
16
+ files.each{|file|
17
+ name=file.split('.')
18
+ case name[1]
19
+ when 'hiki'
20
+ p command="hiki2md hikis/#{name[0]}.hiki > #{basename}.wiki/#{name[0]}.md"
21
+ system command
22
+ when 'gif','png','pdf'
23
+ p command="cp hikis/#{file} #{basename}.wiki/#{file}"
24
+ system command
25
+ end
26
+ }
27
+ system "cp #{basename}.wiki/README_ja.md README.md"
28
+ system "cp #{basename}.wiki/README_ja.md #{basename}.wiki/Home.md"
29
+ system "cp docs/*.gif #{basename}.wiki"
30
+ system "cp docs/*.gif doc"
31
+ system "cp docs/*.png #{basename}.wiki"
32
+ system "cp docs/*.png doc"
33
+ end
34
+
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "hiki2yard"
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
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/hiki2yard ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "hiki2yard"
4
+
5
+ Hiki2yard::Command.run(ARGV)
data/hiki2yard.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'hiki2yard/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "hiki2yard"
8
+ spec.version = Hiki2yard::VERSION
9
+ spec.authors = ["Shigeto R. Nishitani"]
10
+ spec.email = ["shigeto_nishitani@me.com"]
11
+
12
+ spec.summary = %q{Support making docs from hiki to yard, wiki, on gem development directory.}
13
+ spec.description = %q{Support making docs from hiki to yard, wiki, on gem development directory.}
14
+ spec.homepage = "https://github.com/daddygongon/hiki2yard/wiki"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.11"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec", "~> 3.0"
25
+ spec.add_development_dependency "yard"
26
+ spec.add_development_dependency "hiki2md"
27
+ spec.add_development_dependency "mathjax-yard"
28
+ end
@@ -0,0 +1,56 @@
1
+ # Hiki2yard
2
+
3
+ bundle gemで作られるdirectoryに,hikiからyard, wiki文書を作る環境を自動構築する.
4
+
5
+ ## 動機
6
+
7
+ | link | wiki | doc|
8
+ |:----|:----|:----|
9
+ | 動機 |[why?](Why_hiki2yard)|[why?](file.Why_hiki2yard.html)|
10
+
11
+
12
+ ## インストール
13
+
14
+ 以下のコマンドでgemとしてinstall:
15
+
16
+ ```
17
+ $ gem install hiki2yard
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ gemのdirectoryで
23
+
24
+ ```
25
+ $ hiki2yard --init
26
+ ```
27
+
28
+ と打ち込めば,自動的に環境を整備.
29
+
30
+ ### 動作内容
31
+
32
+ 1. Rakefileをcopy
33
+ 1. .yardoptsファイルを作成
34
+ 1. hikisディレクトリーを作成
35
+ 1. wikiディレクトリーを作成
36
+ 1. Githubでwikiを作成してからgit clone ***.wiki.gitのほうが確実.
37
+
38
+ ## その後
39
+
40
+ 1. hikisに適当にファイルを作成,編集
41
+ 1. rake yardでdocumentsが自動生成される.
42
+
43
+ ## やり残し
44
+
45
+ 1. mathjax用のひな形との切り替え.
46
+ 1. gemspecは手動で残した.
47
+ 1. リンク作成をwikiとdocで自動生成したいな...
48
+ 1. hiki2latexによるtex文書の自動生成.
49
+
50
+ ## Contributing
51
+
52
+ Bug reports and pull requests are welcome on GitHub at https://github.com/daddygongon/hiki2yard. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
53
+
54
+ ## License
55
+
56
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,37 @@
1
+ # Hiki2yard
2
+
3
+ On gem development directory, support making docs from hiki to yard, wiki.
4
+
5
+ ## motivation
6
+
7
+ | link | wiki | doc|
8
+ |:----|:----|:----|
9
+ | motivation |[why?](Why_hiki2yard)|[why?](file.Why_hiki2yard.html)|
10
+
11
+
12
+ ## Installation
13
+
14
+ Install it yourself as:
15
+
16
+ ```
17
+ $ gem install hiki2yard
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ At gem directory,
23
+
24
+ ```
25
+ $ hiki2yard --init
26
+ ```
27
+
28
+ then all the necessary procedures done automatically, hopefully...
29
+
30
+ ## Contributing
31
+
32
+ Bug reports and pull requests are welcome on GitHub at https://github.com/daddygongon/hiki2yard. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
33
+
34
+
35
+ ## License
36
+
37
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,56 @@
1
+ # Hiki2yard
2
+
3
+ bundle gemで作られるdirectoryに,hikiからyard, wiki文書を作る環境を自動構築する.
4
+
5
+ ## 動機
6
+
7
+ | link | wiki | doc|
8
+ |:----|:----|:----|
9
+ | 動機 |[why?](Why_hiki2yard)|[why?](file.Why_hiki2yard.html)|
10
+
11
+
12
+ ## インストール
13
+
14
+ 以下のコマンドでgemとしてinstall:
15
+
16
+ ```
17
+ $ gem install hiki2yard
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ gemのdirectoryで
23
+
24
+ ```
25
+ $ hiki2yard --init
26
+ ```
27
+
28
+ と打ち込めば,自動的に環境を整備.
29
+
30
+ ### 動作内容
31
+
32
+ 1. Rakefileをcopy
33
+ 1. .yardoptsファイルを作成
34
+ 1. hikisディレクトリーを作成
35
+ 1. wikiディレクトリーを作成
36
+ 1. Githubでwikiを作成してからgit clone ***.wiki.gitのほうが確実.
37
+
38
+ ## その後
39
+
40
+ 1. hikisに適当にファイルを作成,編集
41
+ 1. rake yardでdocumentsが自動生成される.
42
+
43
+ ## やり残し
44
+
45
+ 1. mathjax用のひな形との切り替え.
46
+ 1. gemspecは手動で残した.
47
+ 1. リンク作成をwikiとdocで自動生成したいな...
48
+ 1. hiki2latexによるtex文書の自動生成.
49
+
50
+ ## Contributing
51
+
52
+ Bug reports and pull requests are welcome on GitHub at https://github.com/daddygongon/hiki2yard. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
53
+
54
+ ## License
55
+
56
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,34 @@
1
+ # 概要
2
+
3
+ なぜ,hiki2yardを開発する必要が生じたかを概説.
4
+
5
+ ## 状況
6
+
7
+ ### 文書の強結合tight binding理論
8
+ 文書はソースに近いところにおいておくべし.そうすれば,source codeをいじった時に,ちょっとしたコメントを残す気になる.
9
+
10
+ ### 文書の対象者
11
+ rubyでprogramを開発する際には,gemとして配布することが最終目標となる.
12
+ したがって,そのための雛形が,
13
+
14
+ ```
15
+ bundle gem [-b] gem_name
16
+ ```
17
+
18
+ で自動再生される.そこで用意されている文書作成は開発者向けのyardがある.
19
+
20
+ 他の多くの対象者むけに,一斉に作成したい.以下がその対象者の一覧.
21
+
22
+
23
+ |directory|format| for |対象者|
24
+ |:----|:----|:----|:----|
25
+ | hikis | hiki |hiki |自分|
26
+ | converter | hiki2md|
27
+ | gem_name.wiki | md | github|ユーザ(使用法)|
28
+ | converter |yard|
29
+ | doc | html | gem |開発者,あるいは改良者|
30
+ | converter |hiki2latex|
31
+ | docs | latex | 卒論,修論pdf | 学生,教授|
32
+
33
+
34
+ hiki2yardではこれらの文書作成を容易にするcommandを提供することを目的としている.
@@ -0,0 +1,31 @@
1
+ ! Hiki2yard
2
+
3
+ On gem development directory, support making docs from hiki to yard, wiki.
4
+
5
+ !! motivation
6
+ || link || wiki || doc
7
+ || motivation ||[[why?|Why_hiki2yard]]||[[why?|file.Why_hiki2yard.html]]
8
+
9
+ !! Installation
10
+
11
+ Install it yourself as:
12
+
13
+ $ gem install hiki2yard
14
+
15
+ !! Usage
16
+
17
+ At gem directory,
18
+
19
+ $ hiki2yard --init
20
+
21
+ then all the necessary procedures done automatically, hopefully...
22
+
23
+ !! Contributing
24
+
25
+ Bug reports and pull requests are welcome on GitHub at https://github.com/daddygongon/hiki2yard. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [[Contributor Covenant|http://contributor-covenant.org]] code of conduct.
26
+
27
+
28
+ !! License
29
+
30
+ The gem is available as open source under the terms of the [[MIT License|http://opensource.org/licenses/MIT]].
31
+
@@ -0,0 +1,50 @@
1
+ ! Hiki2yard
2
+
3
+ bundle gemで作られるdirectoryに,hikiからyard, wiki文書を作る環境を自動構築する.
4
+
5
+ !! 動機
6
+ || link || wiki || doc
7
+ || 動機 ||[[why?|Why_hiki2yard]]||[[why?|file.Why_hiki2yard.html]]
8
+
9
+ !! インストール
10
+
11
+ 以下のコマンドでgemとしてinstall:
12
+
13
+ $ gem install hiki2yard
14
+
15
+ !! Usage
16
+
17
+ gemのdirectoryで
18
+
19
+ $ hiki2yard --init
20
+
21
+ と打ち込めば,自動的に環境を整備.
22
+
23
+ !!! 動作内容
24
+
25
+ # Rakefileをcopy
26
+ # .yardoptsファイルを作成
27
+ # hikisディレクトリーを作成
28
+ # wikiディレクトリーを作成
29
+ ## Githubでwikiを作成してからgit clone ***.wiki.gitのほうが確実.
30
+
31
+ !! その後
32
+
33
+ # hikisに適当にファイルを作成,編集
34
+ # rake yardでdocumentsが自動生成される.
35
+
36
+ !! やり残し
37
+
38
+ # mathjax用のひな形との切り替え.
39
+ # gemspecは手動で残した.
40
+ # リンク作成をwikiとdocで自動生成したいな...
41
+ # hiki2latexによるtex文書の自動生成.
42
+
43
+ !! Contributing
44
+
45
+ Bug reports and pull requests are welcome on GitHub at https://github.com/daddygongon/hiki2yard. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [[Contributor Covenant|http://contributor-covenant.org]] code of conduct.
46
+
47
+ !! License
48
+
49
+ The gem is available as open source under the terms of the [[MIT License|http://opensource.org/licenses/MIT]].
50
+
@@ -0,0 +1,29 @@
1
+ !概要
2
+
3
+ なぜ,hiki2yardを開発する必要が生じたかを概説.
4
+
5
+ !!状況
6
+
7
+ !!!文書の強結合tight binding理論
8
+ 文書はソースに近いところにおいておくべし.そうすれば,source codeをいじった時に,ちょっとしたコメントを残す気になる.
9
+
10
+ !!!文書の対象者
11
+ rubyでprogramを開発する際には,gemとして配布することが最終目標となる.
12
+ したがって,そのための雛形が,
13
+
14
+ bundle gem [-b] gem_name
15
+
16
+ で自動再生される.そこで用意されている文書作成は開発者向けのyardがある.
17
+
18
+ 他の多くの対象者むけに,一斉に作成したい.以下がその対象者の一覧.
19
+
20
+ ||directory||format|| for ||対象者
21
+ || hikis || hiki ||hiki ||自分
22
+ || converter || hiki2md
23
+ || gem_name.wiki || md || github||ユーザ(使用法)
24
+ || converter ||yard
25
+ || doc || html || gem ||開発者,あるいは改良者
26
+ || converter ||hiki2latex
27
+ || docs || latex || 卒論,修論pdf || 学生,教授
28
+
29
+ hiki2yardではこれらの文書作成を容易にするcommandを提供することを目的としている.
@@ -0,0 +1,34 @@
1
+ require "bundler/gem_tasks"
2
+ require 'yard'
3
+ require "rake/testtask"
4
+
5
+ p base_path = File.expand_path('..', __FILE__)
6
+ p basename = File.basename(base_path)
7
+
8
+ desc "make documents by yard"
9
+ task :yard => [:hiki2md] do
10
+ YARD::Rake::YardocTask.new
11
+ end
12
+
13
+ desc "transfer hikis/*.hiki to wiki"
14
+ task :hiki2md do
15
+ files = Dir.entries('hikis')
16
+ files.each{|file|
17
+ name=file.split('.')
18
+ case name[1]
19
+ when 'hiki'
20
+ p command="hiki2md hikis/#{name[0]}.hiki > #{basename}.wiki/#{name[0]}.md"
21
+ system command
22
+ when 'gif','png','pdf'
23
+ p command="cp hikis/#{file} #{basename}.wiki/#{file}"
24
+ system command
25
+ end
26
+ }
27
+ system "cp #{basename}.wiki/README_ja.md README.md"
28
+ system "cp #{basename}.wiki/README_ja.md #{basename}.wiki/Home.md"
29
+ system "cp docs/*.gif #{basename}.wiki"
30
+ system "cp docs/*.gif doc"
31
+ system "cp docs/*.png #{basename}.wiki"
32
+ system "cp docs/*.png doc"
33
+ end
34
+
@@ -0,0 +1,3 @@
1
+ module Hiki2yard
2
+ VERSION = "0.1.0"
3
+ end
data/lib/hiki2yard.rb ADDED
@@ -0,0 +1,92 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'optparse'
3
+ require "hiki2yard/version"
4
+
5
+ module Hiki2yard
6
+ class Command
7
+ def self.run(argv=[])
8
+ new(argv).execute
9
+ end
10
+
11
+ def initialize(argv=[])
12
+ @argv = argv
13
+ @source_path = File.expand_path('..', __FILE__)
14
+ @target_path = Dir.pwd
15
+ p @base_name=File.basename(@target_path)
16
+ p @source_path,@target_path
17
+ @opts={}
18
+ end
19
+
20
+ def execute
21
+ @argv << '--help' if @argv.size==0
22
+ command_parser = OptionParser.new do |opt|
23
+ opt.on('-v', 'show program Version.') { |v|
24
+ opt.version = Hiki2yard::VERSION
25
+ puts opt.ver
26
+ }
27
+ opt.on('-f','--force','force copy new Rakefile.') {
28
+ @opts[:force]=true
29
+ }
30
+ opt.on('-i','--init','initialize hiki2yard directory.') { |v|
31
+ init
32
+ exit
33
+ }
34
+ end
35
+ command_parser.banner = "Usage: hiki2yard [options] FILE"
36
+ command_parser.parse!(@argv)
37
+ exit
38
+ end
39
+
40
+ def init
41
+ rev_rakefile
42
+ mk_yardopts
43
+ create_dir_if_not_exists(File.join(@target_path,'hikis'))
44
+ create_dir_if_not_exists(File.join(@target_path,"#{@base_name}.wiki"))
45
+
46
+ rev_gemspec
47
+ end
48
+
49
+ def rev_rakefile
50
+ source=File.join(@source_path,'hiki2yard','new_rakefile')
51
+ target=File.join(@target_path,'Rakefile')
52
+ if @opts[:force] then
53
+ copy_file_even_if_exists(source, target)
54
+ else
55
+ copy_file_if_not_exists(source, target)
56
+ end
57
+ end
58
+
59
+ def mk_yardopts
60
+ cont = "-\n**/*.md\n"
61
+ File.write(File.join(@target_path,'.yardopts'),cont)
62
+ end
63
+
64
+ def create_dir_if_not_exists(data_path)
65
+ return if File::exists?(data_path)
66
+ FileUtils.mkdir(data_path,:verbose=>true) # :noop=>true)
67
+ end
68
+
69
+ def copy_file_if_not_exists(source, target)
70
+ return if File::exists?(target)
71
+ FileUtils.cp(source,target,:verbose=>true) # :noop=>true)
72
+ end
73
+
74
+ def copy_file_even_if_exists(source, target)
75
+ FileUtils.cp(source,target,:verbose=>true) # :noop=>true)
76
+ end
77
+
78
+ def rev_gemspec
79
+ cont=<<"EOS"
80
+ spec.add_development_dependency "yard"
81
+ spec.add_development_dependency "hiki2md"
82
+ spec.add_development_dependency "mathjax-yard"
83
+ EOS
84
+ print "add follows at the tail of #{@target_path}/#{@base_name}.gemspec\n"
85
+ print cont
86
+ end
87
+ end
88
+ end
89
+
90
+
91
+
92
+
metadata ADDED
@@ -0,0 +1,153 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hiki2yard
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Shigeto R. Nishitani
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-07-12 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.11'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.11'
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: yard
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: hiki2md
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'
83
+ - !ruby/object:Gem::Dependency
84
+ name: mathjax-yard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Support making docs from hiki to yard, wiki, on gem development directory.
98
+ email:
99
+ - shigeto_nishitani@me.com
100
+ executables:
101
+ - hiki2yard
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".gitignore"
106
+ - ".rspec"
107
+ - ".travis.yml"
108
+ - ".yardopts"
109
+ - CODE_OF_CONDUCT.md
110
+ - Gemfile
111
+ - LICENSE.txt
112
+ - README.md
113
+ - Rakefile
114
+ - bin/console
115
+ - bin/setup
116
+ - exe/hiki2yard
117
+ - hiki2yard.gemspec
118
+ - hiki2yard.wiki/Home.md
119
+ - hiki2yard.wiki/README_en.md
120
+ - hiki2yard.wiki/README_ja.md
121
+ - hiki2yard.wiki/Why_hiki2yard.md
122
+ - hikis/README_en.hiki
123
+ - hikis/README_ja.hiki
124
+ - hikis/Why_hiki2yard.hiki
125
+ - lib/hiki2yard.rb
126
+ - lib/hiki2yard/new_rakefile
127
+ - lib/hiki2yard/version.rb
128
+ homepage: https://github.com/daddygongon/hiki2yard/wiki
129
+ licenses:
130
+ - MIT
131
+ metadata: {}
132
+ post_install_message:
133
+ rdoc_options: []
134
+ require_paths:
135
+ - lib
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ required_rubygems_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ requirements: []
147
+ rubyforge_project:
148
+ rubygems_version: 2.5.1
149
+ signing_key:
150
+ specification_version: 4
151
+ summary: Support making docs from hiki to yard, wiki, on gem development directory.
152
+ test_files: []
153
+ has_rdoc: