guard-asciidoctor 0.1.0 → 0.1.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
  SHA1:
3
- metadata.gz: f8825b58f2bcdeb0c3f340a14ca3882c83aa9647
4
- data.tar.gz: f569cf96d7228c06455a3189846bbad15b8ce1af
3
+ metadata.gz: 64ed62be814325ea64b6ff261848cdcfc1ea12da
4
+ data.tar.gz: 3a4b5b758da33954550d3b2913b5373b1aff6ffb
5
5
  SHA512:
6
- metadata.gz: 773dd163f498a90e6a0aeefffa99b725dfe7394263848733dbc02db610c1235d0446c9d42bb93bef9ac27e56ed4b6b524b0952aa1c3896b34f1e33f1d3b6510e
7
- data.tar.gz: 423c2fd630641857bb49590423fe4cb168e650e148d50a53d89d52dd9b74a4930932e33c92aecd8a1edb83f8577c827808dc6c201d56f298fd67f15aced83d8b
6
+ metadata.gz: a2f92a24ebfd30f275fe6dbe19e6ad9712ad7cc730dfd0863edca6376daa8ec5c0ebbb0931c9b6b1df4aaabf36da8c1309f62924fca23427b2c9e66cc13a31f9
7
+ data.tar.gz: f47fe4129bdeaa7540ba628857729df3509c89fa476af622b0639071f69a8fb268bd10aa747c7319a766d002d53c67efdb76b199882ecbf63041aaba7b8a3688
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ bundler_args: --without development
3
+ rvm:
4
+ - 2.2.0
5
+ notifications:
6
+ recipients:
7
+ - mlc880926@gmail.com
@@ -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
@@ -20,7 +20,7 @@ module Guard
20
20
  opts = {
21
21
  notifications: true,
22
22
  helper_modules: []
23
- }.merge(opts)
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.haml" -> "foo.html"
139
- # "path/foo" -> "foo.html"
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 = File.basename(file).split('.')
148
- base_name, extensions = sub_strings.first, sub_strings[1..-1]
149
- [base_name, extensions].flatten.join('.')
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
 
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  class AsciidoctorVersion
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -1,5 +1,13 @@
1
- == I am title
2
-
3
- generated by helper
4
-
5
- My name is test
1
+ <div class="paragraph">
2
+ <p>&lt;div class="sect1"&gt;
3
+ &lt;h2 id="_i_am_title"&gt;I am title&lt;/h2&gt;
4
+ &lt;div class="sectionbody"&gt;
5
+ &lt;div class="paragraph"&gt;
6
+ &lt;p&gt;generated by helper&lt;/p&gt;
7
+ &lt;/div&gt;
8
+ &lt;div class="paragraph"&gt;
9
+ &lt;p&gt;My name is test&lt;/p&gt;
10
+ &lt;/div&gt;
11
+ &lt;/div&gt;
12
+ &lt;/div&gt;</p>
13
+ </div>
@@ -1,5 +1,13 @@
1
- == I am title
2
-
3
- generated by helper
4
-
5
- My name is test3
1
+ <div class="paragraph">
2
+ <p>&lt;div class="sect1"&gt;
3
+ &lt;h2 id="_i_am_title"&gt;I am title&lt;/h2&gt;
4
+ &lt;div class="sectionbody"&gt;
5
+ &lt;div class="paragraph"&gt;
6
+ &lt;p&gt;generated by helper&lt;/p&gt;
7
+ &lt;/div&gt;
8
+ &lt;div class="paragraph"&gt;
9
+ &lt;p&gt;My name is test3&lt;/p&gt;
10
+ &lt;/div&gt;
11
+ &lt;/div&gt;
12
+ &lt;/div&gt;</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).not_to receive(:run_all)
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
- 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
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.0
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-22 00:00:00.000000000 Z
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.md
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