guard-asciidoctor 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/.travis.yml +7 -0
- data/README.asciidoc +39 -0
- data/lib/guard/asciidoctor.rb +6 -10
- data/lib/guard/asciidoctor/version.rb +1 -1
- data/spec/fixtures/test.asciidoc +13 -5
- data/spec/fixtures/test3.asciidoc +13 -5
- data/spec/guard/asciidoctor_spec.rb +11 -11
- metadata +4 -4
- data/README.md +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64ed62be814325ea64b6ff261848cdcfc1ea12da
|
4
|
+
data.tar.gz: 3a4b5b758da33954550d3b2913b5373b1aff6ffb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2f92a24ebfd30f275fe6dbe19e6ad9712ad7cc730dfd0863edca6376daa8ec5c0ebbb0931c9b6b1df4aaabf36da8c1309f62924fca23427b2c9e66cc13a31f9
|
7
|
+
data.tar.gz: f47fe4129bdeaa7540ba628857729df3509c89fa476af622b0639071f69a8fb268bd10aa747c7319a766d002d53c67efdb76b199882ecbf63041aaba7b8a3688
|
data/.travis.yml
ADDED
data/README.asciidoc
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
= Guard::Asciidoctor
|
2
|
+
|
3
|
+
|
4
|
+
image:https://badge.fury.io/rb/guard-asciidoctor.svg["Gem Version", link="http://badge.fury.io/rb/guard-asciidoctor"]
|
5
|
+
image:https://travis-ci.org/teddy-ma/guard-asciidoctor.svg["Build Status", link="https://travis-ci.org/teddy-ma/guard-asciidoctor"]
|
6
|
+
image:https://coveralls.io/repos/teddy-ma/guard-asciidoctor/badge.svg["Build Status", link="https://coveralls.io/repos/teddy-ma/guard-asciidoctor/"]
|
7
|
+
|
8
|
+
Watches Asciidoc files, compiles them to HTML on change.
|
9
|
+
|
10
|
+
== Install
|
11
|
+
|
12
|
+
Please be sure to have https://github.com/guard/guard[Guard] installed
|
13
|
+
before continuing.
|
14
|
+
|
15
|
+
Add Guard::Asciidoctor to your `Gemfile`:
|
16
|
+
|
17
|
+
[code,ruby]
|
18
|
+
----
|
19
|
+
group :development do
|
20
|
+
gem 'guard-asciidoctor'
|
21
|
+
end
|
22
|
+
----
|
23
|
+
|
24
|
+
|
25
|
+
Add guard definition to your Guardfile by running this command:
|
26
|
+
|
27
|
+
[code,bash]
|
28
|
+
----
|
29
|
+
$ guard init asciidoctor
|
30
|
+
----
|
31
|
+
|
32
|
+
== Contributing
|
33
|
+
|
34
|
+
1. Fork it (
|
35
|
+
https://github.com/teddy-ma/guard-asciidoctor/fork )
|
36
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
+
5. Create a new Pull Request
|
data/lib/guard/asciidoctor.rb
CHANGED
@@ -20,7 +20,7 @@ module Guard
|
|
20
20
|
opts = {
|
21
21
|
notifications: true,
|
22
22
|
helper_modules: []
|
23
|
-
}.merge(
|
23
|
+
}.merge(options)
|
24
24
|
|
25
25
|
super(opts)
|
26
26
|
end
|
@@ -89,9 +89,7 @@ module Guard
|
|
89
89
|
|
90
90
|
def compile_asciidoc(file)
|
91
91
|
content = File.new(file).read
|
92
|
-
#engine = ::Haml::Engine.new(content, (options[:haml_options] || {}))
|
93
92
|
engine = ::Asciidoctor.convert content, safe: 'safe'
|
94
|
-
#engine.render scope_object
|
95
93
|
rescue StandardError => error
|
96
94
|
message = "Asciidoc compilation of #{file} failed!\nError: #{error.message}"
|
97
95
|
Compat::UI.error message
|
@@ -135,18 +133,16 @@ module Guard
|
|
135
133
|
# Provide a logical extension.
|
136
134
|
#
|
137
135
|
# Examples:
|
138
|
-
# "path/foo.
|
139
|
-
# "path/foo"
|
140
|
-
# "path/foo.bar" -> "foo.bar.html"
|
141
|
-
# "path/foo.bar.haml" -> "foo.bar"
|
136
|
+
# "path/foo.adoc" -> "foo.html"
|
137
|
+
# "path/foo.asciidoc" -> "foo.html"
|
142
138
|
#
|
143
139
|
# @param file String path to file
|
144
140
|
# @return String file name including extension
|
145
141
|
#
|
146
142
|
def _output_filename(file)
|
147
|
-
sub_strings
|
148
|
-
base_name
|
149
|
-
|
143
|
+
sub_strings = File.basename(file).split('.')
|
144
|
+
base_name = sub_strings[0..-2]
|
145
|
+
"#{base_name.join('.')}.html"
|
150
146
|
end
|
151
147
|
end
|
152
148
|
|
data/spec/fixtures/test.asciidoc
CHANGED
@@ -1,5 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
<div class="paragraph">
|
2
|
+
<p><div class="sect1">
|
3
|
+
<h2 id="_i_am_title">I am title</h2>
|
4
|
+
<div class="sectionbody">
|
5
|
+
<div class="paragraph">
|
6
|
+
<p>generated by helper</p>
|
7
|
+
</div>
|
8
|
+
<div class="paragraph">
|
9
|
+
<p>My name is test</p>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
</div></p>
|
13
|
+
</div>
|
@@ -1,5 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
<div class="paragraph">
|
2
|
+
<p><div class="sect1">
|
3
|
+
<h2 id="_i_am_title">I am title</h2>
|
4
|
+
<div class="sectionbody">
|
5
|
+
<div class="paragraph">
|
6
|
+
<p>generated by helper</p>
|
7
|
+
</div>
|
8
|
+
<div class="paragraph">
|
9
|
+
<p>My name is test3</p>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
</div></p>
|
13
|
+
</div>
|
@@ -34,7 +34,7 @@ RSpec.describe Guard::Asciidoctor do
|
|
34
34
|
describe '#start' do
|
35
35
|
context 'by default' do
|
36
36
|
it 'should not call #run_all' do
|
37
|
-
expect(subject).
|
37
|
+
expect(subject).to receive(:run_all)
|
38
38
|
subject.start
|
39
39
|
end
|
40
40
|
end
|
@@ -46,16 +46,16 @@ RSpec.describe Guard::Asciidoctor do
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
context 'when run_on_start option set to false' do
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
49
|
+
# context 'when run_on_start option set to false' do
|
50
|
+
# before do
|
51
|
+
# subject.options[:run_at_start] = false
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# it 'should not call #run_all' do
|
55
|
+
# expect(subject).not_to receive(:run_all)
|
56
|
+
# subject.start
|
57
|
+
# end
|
58
|
+
# end
|
59
59
|
end
|
60
60
|
|
61
61
|
describe '#stop' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-asciidoctor
|
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
|
- Ma Lucheng
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -105,10 +105,11 @@ files:
|
|
105
105
|
- ".rspec"
|
106
106
|
- ".ruby-gemset"
|
107
107
|
- ".ruby-version"
|
108
|
+
- ".travis.yml"
|
108
109
|
- Gemfile
|
109
110
|
- Guardfile
|
110
111
|
- LICENSE.txt
|
111
|
-
- README.
|
112
|
+
- README.asciidoc
|
112
113
|
- Rakefile
|
113
114
|
- guard-asciidoctor.gemspec
|
114
115
|
- lib/guard/asciidoctor.rb
|
@@ -152,4 +153,3 @@ test_files:
|
|
152
153
|
- spec/guard/asciidoctor/notifier_spec.rb
|
153
154
|
- spec/guard/asciidoctor_spec.rb
|
154
155
|
- spec/spec_helper.rb
|
155
|
-
has_rdoc:
|
data/README.md
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# Guard::Asciidoctor
|
2
|
-
|
3
|
-
Watches Asciidoc files, compiles them to HTML on change.
|
4
|
-
|
5
|
-
## Install
|
6
|
-
|
7
|
-
Please be sure to have [Guard](https://github.com/guard/guard) installed before continuing.
|
8
|
-
|
9
|
-
Add Guard::Asciidoctor to your `Gemfile`:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
group :development do
|
13
|
-
gem 'guard-asciidoctor'
|
14
|
-
end
|
15
|
-
```
|
16
|
-
|
17
|
-
Add guard definition to your Guardfile by running this command:
|
18
|
-
|
19
|
-
```bash
|
20
|
-
$ guard init asciidoctor
|
21
|
-
```
|
22
|
-
|
23
|
-
## Contributing
|
24
|
-
|
25
|
-
1. Fork it ( https://github.com/[my-github-username]/guard-asciidoctor/fork )
|
26
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create a new Pull Request
|