review-retrovert 0.1.0 → 0.3.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 935ec51160017f46b8ceed226f0c1faa871f931b99b40bde3fb7d4a0b6967b65
4
- data.tar.gz: 5c0aeca7c1228c2a04266b07d6386d54dd1fcb6f6672977d09a9d05002cca78a
3
+ metadata.gz: c9727e90e617a35a08cdbae8916f5e4cb388950fd654bb82c4c2363764850c82
4
+ data.tar.gz: 964388bf53220b9f6731bf60d00a1d0a27398e774f2f010c7ae2a2d008cdefa9
5
5
  SHA512:
6
- metadata.gz: b1931ae7c86bd07cd1deb1f3ede33d35e4a661cdbdfaa4dea943e2bc962f2a02ee2705bca0506e593184708203db7c687b430c34b13eb34e2f64ac018d471eb8
7
- data.tar.gz: 420dfc1580231b004a5de8059b495097486f051985b8fcc4130fd9acaea9c93d1682585ebcdbcadffe557c6d64cf7952bc4f8e5479d1046e62ec8dd2fe03b645
6
+ metadata.gz: 370fcb244a1037f52506ae4707288957553270acc96b005f02d97d8c6dd188753e3297244794b732cffd16406536879111f5787a0aa9ad199890979880c40112
7
+ data.tar.gz: 3dbc8982c6c904ff2e5deda893e3daa41cb6f9873c05dacb112339b4b3fca80732d122a8dd0978e05347d11dbefa9f825dc3f7add8a57e6ff0076911b9837601
@@ -0,0 +1,5 @@
1
+ FROM vvakame/review:3.2
2
+
3
+ RUN gem install review-retrovert
4
+
5
+ ENTRYPOINT [ "review-retrovert" ]
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- review-retrovert (0.1.0)
4
+ review-retrovert (0.3.1)
5
5
  review (>= 3.2.0, < 4.0)
6
6
  thor
7
7
 
@@ -15,7 +15,7 @@ GEM
15
15
  image_size
16
16
  rouge
17
17
  rubyzip
18
- rouge (3.18.0)
18
+ rouge (3.20.0)
19
19
  rspec (3.9.0)
20
20
  rspec-core (~> 3.9.0)
21
21
  rspec-expectations (~> 3.9.0)
data/README.md CHANGED
@@ -1,4 +1,8 @@
1
- # Review::Retrovert
1
+ [![Gem Version](https://badge.fury.io/rb/review-retrovert.svg)](https://badge.fury.io/rb/review-retrovert)
2
+ [![Build Status](https://travis-ci.com/srz-zumix/review-retrovert.svg?token=ArNHjRjvfZfyqQUCbXSt&branch=master)](https://travis-ci.com/srz-zumix/review-retrovert)
3
+ [![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/srzzumix/review-retrovert.svg)](https://hub.docker.com/r/srzzumix/review-retrovert/)
4
+
5
+ # ReVIEW::Retrovert
2
6
 
3
7
  ## Installation
4
8
 
@@ -0,0 +1,8 @@
1
+ #!/bin/bash
2
+ set -eu
3
+
4
+ if [ "${DOCKER_TAG}" = "latest" ]; then
5
+ VERSION=$(docker run --rm ${IMAGE_NAME} version)
6
+ docker tag ${IMAGE_NAME} ${DOCKER_REPO}:${VERSION}
7
+ docker push ${DOCKER_REPO}:${VERSION}
8
+ fi
@@ -5,19 +5,17 @@ module ReVIEW
5
5
  module Retrovert
6
6
  class CLI < Thor
7
7
  desc "convert {review_starter_configfile} {outdir}", "convert Re:VIEW Starter project to Re:VIEW project"
8
- method_option "force", aliases: "f", desc: 'force output', type: :boolean
8
+ method_option "force", aliases: "f", desc: 'Force output', type: :boolean
9
+ method_option "strict", desc: 'Only process files registered in the catalog', type: :boolean
9
10
  def convert(review_starter_configfile, outdir)
10
11
  Converter.execute(review_starter_configfile, outdir, options)
11
12
  end
12
13
 
13
- desc "snake {CamelCaseString}", "convert {CamelCaseString} to {snake_case_string}"
14
- def snake(str)
15
- puts str
16
- .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
17
- .gsub(/([a-z\d])([A-Z])/, '\1_\2')
18
- .tr("-", "_")
19
- .downcase
14
+ desc "version", "show version"
15
+ def version()
16
+ puts VERSION
20
17
  end
18
+
21
19
  end
22
20
  end
23
- end
21
+ end
@@ -9,6 +9,7 @@ module ReVIEW
9
9
 
10
10
  def initialize
11
11
  @basedir = nil
12
+ @srccontentsdir = nil
12
13
  @outimagedir = nil
13
14
  @logger = ReVIEW.logger
14
15
  @configs = YamlConfig.new
@@ -37,10 +38,9 @@ module ReVIEW
37
38
  end
38
39
 
39
40
  def copy_contents(outdir)
40
- contentdir = @config['contentdir']
41
- path = File.join(@basedir, contentdir)
42
- outpath = File.join(outdir, contentdir)
43
- FileUtils.mkdir_p(outpath)
41
+ path = File.join(@basedir, @srccontentsdir)
42
+ # outpath = File.join(outdir, srccontentsdir)
43
+ # FileUtils.mkdir_p(outpath)
44
44
  # FileUtils.cp_r(Dir.glob(File.join(path, '*.re')), outpath)
45
45
  FileUtils.cp_r(Dir.glob(File.join(path, '*.re')), outdir)
46
46
  end
@@ -102,22 +102,35 @@ module ReVIEW
102
102
  def update_content_files(outdir, contentdir, contentfiles)
103
103
  files = contentfiles.is_a?(String) ? contentfiles.split(/\R/) : contentfiles
104
104
  files.each do |content|
105
- update_content(outdir, File.join(contentdir, content))
105
+ contentpath = File.join(contentdir, content)
106
+ unless File.exist?(contentpath)
107
+ srcpath = File.join(File.join(@basedir, @srccontentsdir), content)
108
+ # info srcpath
109
+ if File.exist?(srcpath)
110
+ FileUtils.cp(srcpath, contentdir)
111
+ end
112
+ end
113
+ update_content(outdir, contentpath)
106
114
  end
107
115
  end
108
116
 
109
- def update_contents(outdir)
117
+ def update_contents(outdir, options)
110
118
  yamlfile = @config['catalogfile']
111
119
  abspath = File.absolute_path(outdir)
112
- catalog = ReVIEW::Catalog.new(File.open(File.join(abspath, yamlfile)))
113
- # contentdir = File.join(abspath, @config['contentdir'])
114
120
  contentdir = abspath
115
121
  info 'replace //sideimage to //image'
116
122
  info 'replace starter inline command'
117
- update_content_files(outdir, contentdir, catalog.predef())
118
- update_content_files(outdir, contentdir, catalog.chaps())
119
- update_content_files(outdir, contentdir, catalog.appendix())
120
- update_content_files(outdir, contentdir, catalog.postdef())
123
+ if options['strict']
124
+ catalog = ReVIEW::Catalog.new(File.open(File.join(abspath, yamlfile)))
125
+ update_content_files(outdir, contentdir, catalog.predef())
126
+ update_content_files(outdir, contentdir, catalog.chaps())
127
+ update_content_files(outdir, contentdir, catalog.appendix())
128
+ update_content_files(outdir, contentdir, catalog.postdef())
129
+ else
130
+ # copy_contents(outdir)
131
+ contentsfiles = Pathname.glob(File.join(File.join(@basedir, @srccontentsdir), '*.re')).map(&:basename)
132
+ update_content_files(outdir, contentdir, contentsfiles)
133
+ end
121
134
  end
122
135
 
123
136
  def clean_initial_project(outdir)
@@ -131,6 +144,7 @@ module ReVIEW
131
144
  @configs.open(yamlfile)
132
145
  @config = @configs.config
133
146
  @basedir = @configs.basedir
147
+ @srccontentsdir = @config['contentdir']
134
148
  end
135
149
 
136
150
  def create_initial_project(outdir, options)
@@ -145,10 +159,9 @@ module ReVIEW
145
159
 
146
160
  copy_config(outdir)
147
161
  copy_catalog(outdir)
148
- copy_contents(outdir)
149
162
  copy_images(outdir)
150
163
  update_config(outdir)
151
- update_contents(outdir)
164
+ update_contents(outdir, options)
152
165
 
153
166
  pwd = Dir.pwd
154
167
  Dir.chdir(outdir)
@@ -1,5 +1,5 @@
1
1
  module ReVIEW
2
2
  module Retrovert
3
- VERSION = "0.1.0"
3
+ VERSION = "0.3.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: review-retrovert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - srz_zumix
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-06 00:00:00.000000000 Z
11
+ date: 2020-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -60,6 +60,7 @@ files:
60
60
  - ".rspec"
61
61
  - ".travis.yml"
62
62
  - CHANGELOG.md
63
+ - Dockerfile
63
64
  - Gemfile
64
65
  - Gemfile.lock
65
66
  - LICENSE
@@ -67,8 +68,8 @@ files:
67
68
  - Rakefile
68
69
  - bin/console
69
70
  - bin/setup
70
- - catalog.yml
71
71
  - exe/review-retrovert
72
+ - hooks/post_push
72
73
  - lib/review/retrovert.rb
73
74
  - lib/review/retrovert/cli.rb
74
75
  - lib/review/retrovert/converter.rb
@@ -1,49 +0,0 @@
1
- PREDEF:
2
- - c000-preface.re
3
-
4
- CHAPS:
5
- - 無料で使える CI サービス紹介:
6
- - c001-free-ci.re
7
- - c010-appveyor.re
8
- - c010-azure-pipelines.re
9
- - c010-bitrise.re
10
- - c010-buddy-works.re
11
- - c010-circleci.re
12
- - c010-cirrus-ci.re
13
- - c010-codefresh.re
14
- - c010-codeship.re
15
- - c010-drone.re
16
- - c010-github-actions.re
17
- - c010-semaphore.re
18
- - c010-shippable.re
19
- - c010-travis-ci.re
20
- # - c010-wercker.re
21
- - c090-free-others.re
22
- - 無料で使える CI サービス比較:
23
- - c101-vs-env.re
24
- - c102-vs-specs.re
25
- - c103-vs-yaml.re
26
- - c104-vs-comment-command.re
27
- - c105-vs-share.re
28
- - c106-vs-security.re
29
- - c130-vs-badge.re
30
-
31
- APPENDIX:
32
- - c200-appendix.re
33
-
34
- POSTDEF:
35
-
36
- ##
37
- ## ■Tips
38
- ## 第I部、第II部、…のように「部」を使うには、「CHAPS:」を次のようにする。
39
- ##
40
- ## CHAPS:
41
- ## - 部タイトル:
42
- ## - chap01.re
43
- ## - chap02.re
44
- ## - 部タイトル:
45
- ## - chap03.re
46
- ## - chap04.re
47
- ##
48
- ## 「部タイトル」の最後に半角の「:」をつけることに注意。
49
- ##