cheepub 0.1.0 → 0.2.0

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: 48f7b932a8c34bbfcdc9ab5729bc1fd2f361230f915f4728126e3aee7985fb55
4
- data.tar.gz: 56b9172d5f6920b0bfa8153cbdd9d7ee7a5d1b0639340da9b70259a4ea568124
3
+ metadata.gz: 2a8208f7e95b12fbe291fa305052ab6845b86727ad9d6c32eeaebe4290946a64
4
+ data.tar.gz: 2c38721ff77731851add0e51e952c69286995316cf86e726909b69b922e774cf
5
5
  SHA512:
6
- metadata.gz: ed20b41c81fb991248dbe1ec532c738bbc264d13243837b81a9bdfb633e963667952681290c0c432fbf5b378fa326c8fa923bd2bbcde154ce56a93bdb75f453a
7
- data.tar.gz: 01b5f2cf9d51e45a47fc8eeb40c8acfe0191d7ac03dfff0c3308e568f0c4d79338cff1da964cacac1a0cab28e3ca49d52ffeda1f534da1fd0f6623ca6a376c48
6
+ metadata.gz: 1495dad487da24e6a782966908b3d8228b249b71e23fdc66d818fe64c37cba241da061b5e4320debbabf0946a5b4e58352ff24da7304c95f24a0e80b2efe1252
7
+ data.tar.gz: eb7146ec19ff947c938f291161f5d1459f51badf7e6c1140b759cadbd2738c0e4841e455f2d8e04325ca97408b5c824333b66cb1b5ead7504a9eaead3ab03bc8
data/README.md CHANGED
@@ -6,7 +6,11 @@ Cheepub uses [Kramdown](https://github.com/gettalong/kramdown) and [Gepub](https
6
6
 
7
7
  ## Installation
8
8
 
9
- Add this line to your application's Gemfile:
9
+ You can install just use `gem` command:
10
+
11
+ $ gem install cheepub
12
+
13
+ If you use the gem in your project, add this line to your application's Gemfile:
10
14
 
11
15
  ```ruby
12
16
  gem 'cheepub'
@@ -16,16 +20,31 @@ And then execute:
16
20
 
17
21
  $ bundle
18
22
 
19
- Or install it yourself as:
23
+ ## Usage
20
24
 
21
- $ gem install cheepub
25
+ You can add options `--title` and `--author`.
22
26
 
23
- ## Usage
27
+ ```sh
28
+ $ cheepub --title foo --author bar source.md
29
+ ```
30
+
31
+ If you use front-matter section like Jekyll, you can execute without any options:
24
32
 
25
33
  ```sh
26
34
  $ cheepub source.md
27
35
  ```
28
36
 
37
+ ## History
38
+
39
+ ### 0.2.0
40
+
41
+ - add option `--title`, `--author`, `--config`
42
+
43
+ ### 0.1.0
44
+
45
+ - First release.
46
+
47
+
29
48
  ## Development
30
49
 
31
50
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
data/lib/cheepub/cli.rb CHANGED
@@ -1,14 +1,25 @@
1
1
  module Cheepub
2
2
  class CLI < Clamp::Command
3
+ using Cheepub::ExtHash
4
+
3
5
  option ["-v", "--version"], :flag, "Show version" do
4
6
  puts Cheepub::VERSION
5
7
  exit(0)
6
8
  end
9
+ option ["--author"], "AUTOR", "author of the book"
10
+ option ["--title"], "TITLE", "title of the book"
11
+ option ["--config"], "CONFIG", "configuration file"
7
12
 
8
13
  parameter "SRC", "source file"
9
14
 
10
15
  def execute
11
- gen = Cheepub::Generator.new(src)
16
+ params = {}
17
+ if config
18
+ params = YAML.safe_load(config).symbolize_keys!
19
+ end
20
+ params[:author] = author if author
21
+ params[:title] = title if title
22
+ gen = Cheepub::Generator.new(src, params)
12
23
  begin
13
24
  gen.execute
14
25
  rescue Cheepub::Error => e
@@ -1,3 +1,5 @@
1
+ require 'yaml'
2
+
1
3
  module Cheepub
2
4
  class Content
3
5
  using Cheepub::ExtHash
@@ -1,5 +1,4 @@
1
1
  require 'securerandom'
2
- require 'yaml'
3
2
  require 'gepub'
4
3
 
5
4
  module Cheepub
@@ -1,3 +1,3 @@
1
1
  module Cheepub
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cheepub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - takahashim