middleman-robots 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e78c1efa5b9bec03f5fa71f4315435c37358736
4
- data.tar.gz: 210eed6e5699d58baf442bd92d17d6170ba60221
3
+ metadata.gz: d4f01f8d0fdf3304844fdb713988704f4f423358
4
+ data.tar.gz: 001ecdfa3873a65ad43e8efb9e62372622dba93b
5
5
  SHA512:
6
- metadata.gz: f7c9627ad0c9abe4d66c24a7203500b5076e772f331f6cc709c60bb2e4c214d691d6e958dfd0db473f3356d6b2eb612edc6dc3af620976ad7927d919a723b861
7
- data.tar.gz: f4ad15bb069c2731d09560a30600e573aad3695d5d689ce8a8922e4625409608d4e0d6d1b10c2ac8aa9c2a194f80a6fc70f5c8918266949a6dfe5cc2123ee1fd
6
+ metadata.gz: 0be81551938bbf181122120adb2bb52b3e8c87580fd93bb8b1651809ec838744eac22171aec43ed0962f2d44e518fd325d0899f54ee47f201cbaff0cea5a5d1c
7
+ data.tar.gz: 029da2753b999fcd612fec08d7ab68386a5541a63cc5f5d0ec057fdf471dea09d3f0712016932ce722604bb044c26d55613448c4a7e8e71a1924b6bc3c6ebd4d
data/README.jp.md ADDED
@@ -0,0 +1,97 @@
1
+ # Middleman::Robots
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/middleman-robots.svg)](http://badge.fury.io/rb/middleman-robots)
4
+ [![Build Status](https://travis-ci.org/yterajima/middleman-robots.svg?branch=master)](https://travis-ci.org/yterajima/middleman-robots)
5
+
6
+ `middleman-robots` は [Middleman](http://middlemanapp.com/) の拡張機能です。 build 実行時に `config.rb` に記述されたルールに基いて `robots.txt` を作ります。
7
+
8
+ ## Installation
9
+
10
+ Gemfile に次の行を追加してください:
11
+
12
+ ```ruby
13
+ gem 'middleman-robots'
14
+ ```
15
+
16
+ コマンドを実行します:
17
+
18
+ $ bundle
19
+
20
+ Gemfile を使わずにインストールする場合は次のコマンドを実行してください:
21
+
22
+ $ gem install middleman-robots
23
+
24
+ ## 使い方
25
+
26
+ 基本的な使い方です:
27
+
28
+ ```ruby
29
+ # config.rb
30
+ configure :build do
31
+ activate :robots, :rules => [
32
+ {:user_agent => '*', :allow => %w(/)}
33
+ ],
34
+ :sitemap => "http://example.com/sitemap.xml"
35
+ end
36
+ ```
37
+
38
+ 作成される `robots.txt`:
39
+
40
+ ```
41
+ User-Agent: *
42
+ Allow: /
43
+
44
+ Sitemap: http://example.com/sitemap.xml
45
+
46
+ ```
47
+
48
+
49
+ オプションには `:rules` {[`:user_agent`(string), `:allow`(array), `:disallow`(array)]} と `:sitemap` を指定できます。すべてのオプションを指定すると次のようになります:
50
+
51
+ ```ruby
52
+ # config.rb
53
+ configure :build do
54
+ activate :robots,
55
+ :rules => [
56
+ {
57
+ :user_agent => 'Googlebot',
58
+ :disallow => %w(tmp/ /something/dir/file_disallow.html),
59
+ :allow => %w(allow/ /something/dir/file_allow.html)
60
+ },
61
+ {
62
+ :user_agent => 'Googlebot-Image',
63
+ :disallow => %w(tmp/ /something/dir/file_disallow.html),
64
+ :allow => %w(allow/ /something/dir/file_allow.html)
65
+ }
66
+ ],
67
+ :sitemap => "http://example.com/sitemap.xml"
68
+ end
69
+ ```
70
+
71
+ 作成される `robots.txt`:
72
+
73
+ ```
74
+ User-Agent: Googlebot
75
+ Disallow: /tmp/
76
+ Disallow: /something/dir/file_disallow.html
77
+ Allow: /allow/
78
+ Allow: /something/dir/file_allow.html
79
+
80
+ User-Agent: Googlebot-Image
81
+ Disallow: /tmp/
82
+ Disallow: /something/dir/file_disallow.html
83
+ Allow: /allow/
84
+ Allow: /something/dir/file_allow.html
85
+
86
+ Sitemap: http://example.com/sitemap.xml
87
+
88
+ ```
89
+
90
+ ## Contributing
91
+
92
+ 1. Fork it ( https://github.com/yterajima/middleman-robots/fork )
93
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
94
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
95
+ 4. Push to the branch (`git push origin my-new-feature`)
96
+ 5. Create a new Pull Request
97
+
data/README.md CHANGED
@@ -29,13 +29,23 @@ Basic usage:
29
29
  # config.rb
30
30
  configure :build do
31
31
  activate :robots, :rules => [
32
- {'user-agent' => '*', :allow => %w(/)}
32
+ {:user_agent => '*', :allow => %w(/)}
33
33
  ],
34
34
  :sitemap => "http://example.com/sitemap.xml"
35
35
  end
36
36
  ```
37
37
 
38
- You can use options, `rules` {[`user-agent`(string), `allow`(array), `disallow`(array)]} and `sitemap`. Like this:
38
+ Created `robots.txt`:
39
+
40
+ ```
41
+ User-Agent: *
42
+ Allow: /
43
+
44
+ Sitemap: http://example.com/sitemap.xml
45
+
46
+ ```
47
+
48
+ You can use options, `:rules` {[`:user_agent`(string), `:allow`(array), `:disallow`(array)]} and `:sitemap`. Like this:
39
49
 
40
50
  ```ruby
41
51
  # config.rb
@@ -43,24 +53,44 @@ configure :build do
43
53
  activate :robots,
44
54
  :rules => [
45
55
  {
46
- 'user-agent' => 'Googlebot',
47
- :disallow => %w(tmp/* /something/dir/file_disallow.html),
48
- :allow => %w(allow/* /something/dir/file_allow.html)
56
+ :user_agent => 'Googlebot',
57
+ :disallow => %w(tmp/ /something/dir/file_disallow.html),
58
+ :allow => %w(allow/ /something/dir/file_allow.html)
49
59
  },
50
60
  {
51
- 'user-agent' => 'Googlebot-Image',
52
- :disallow => %w(tmp/* /something/dir/file_disallow.html),
53
- :allow => %w(allow/* /something/dir/file_allow.html)
61
+ :user_agent => 'Googlebot-Image',
62
+ :disallow => %w(tmp/ /something/dir/file_disallow.html),
63
+ :allow => %w(allow/ /something/dir/file_allow.html)
54
64
  }
55
65
  ],
56
66
  :sitemap => "http://example.com/sitemap.xml"
57
67
  end
58
68
  ```
59
69
 
70
+ Created `robots.txt`:
71
+
72
+ ```
73
+ User-Agent: Googlebot
74
+ Disallow: /tmp/
75
+ Disallow: /something/dir/file_disallow.html
76
+ Allow: /allow/
77
+ Allow: /something/dir/file_allow.html
78
+
79
+ User-Agent: Googlebot-Image
80
+ Disallow: /tmp/
81
+ Disallow: /something/dir/file_disallow.html
82
+ Allow: /allow/
83
+ Allow: /something/dir/file_allow.html
84
+
85
+ Sitemap: http://example.com/sitemap.xml
86
+
87
+ ```
88
+
60
89
  ## Contributing
61
90
 
62
- 1. Fork it ( https://github.com/[my-github-username]/middleman-robots/fork )
91
+ 1. Fork it ( https://github.com/yterajima/middleman-robots/fork )
63
92
  2. Create your feature branch (`git checkout -b my-new-feature`)
64
93
  3. Commit your changes (`git commit -am 'Add some feature'`)
65
94
  4. Push to the branch (`git push origin my-new-feature`)
66
95
  5. Create a new Pull Request
96
+
@@ -13,6 +13,24 @@ Feature: Middleman-Robots
13
13
  Then a file named "robots.txt" should exist
14
14
  And the output should contain "middleman-robots: robots.txt created"
15
15
 
16
+ Scenario: Rules option with user_agent
17
+ Given a fixture app "basic-app"
18
+ And a file named "config.rb" with:
19
+ """
20
+ configure :build do
21
+ activate :robots, :rules => [
22
+ {:user_agent => '*'}
23
+ ]
24
+ end
25
+ """
26
+ And a successfully built app at "basic-app"
27
+ When I cd to "build"
28
+ Then the file "robots.txt" should contain exactly:
29
+ """
30
+ User-Agent: *
31
+
32
+ """
33
+
16
34
  Scenario: Rules option with user-agent
17
35
  Given a fixture app "basic-app"
18
36
  And a file named "config.rb" with:
@@ -38,7 +56,7 @@ Feature: Middleman-Robots
38
56
  configure :build do
39
57
  activate :robots, :rules => [
40
58
  {
41
- 'user-agent' => '*',
59
+ :user_agent => '*',
42
60
  :disallow => %w(tmp/* /something/dir/file_disallow.html)
43
61
  }
44
62
  ]
@@ -61,7 +79,7 @@ Feature: Middleman-Robots
61
79
  configure :build do
62
80
  activate :robots, :rules => [
63
81
  {
64
- 'user-agent' => '*',
82
+ :user_agent => '*',
65
83
  :allow => %w(allow/* /something/dir/file_allow.html)
66
84
  }
67
85
  ]
@@ -84,7 +102,7 @@ Feature: Middleman-Robots
84
102
  configure :build do
85
103
  activate :robots, :rules => [
86
104
  {
87
- 'user-agent' => '*',
105
+ :user_agent => '*',
88
106
  :disallow => %w(tmp/* /something/dir/file_disallow.html),
89
107
  :allow => %w(allow/* /something/dir/file_allow.html)
90
108
  }
@@ -110,12 +128,12 @@ Feature: Middleman-Robots
110
128
  configure :build do
111
129
  activate :robots, :rules => [
112
130
  {
113
- 'user-agent' => 'Googlebot',
131
+ :user_agent => 'Googlebot',
114
132
  :disallow => %w(tmp/* /something/dir/file_disallow.html),
115
133
  :allow => %w(allow/* /something/dir/file_allow.html)
116
134
  },
117
135
  {
118
- 'user-agent' => 'Googlebot-Image',
136
+ :user_agent => 'Googlebot-Image',
119
137
  :disallow => %w(tmp/* /something/dir/file_disallow.html),
120
138
  :allow => %w(allow/* /something/dir/file_allow.html)
121
139
  }
@@ -164,12 +182,12 @@ Feature: Middleman-Robots
164
182
  activate :robots,
165
183
  :rules => [
166
184
  {
167
- 'user-agent' => 'Googlebot',
185
+ :user_agent => 'Googlebot',
168
186
  :disallow => %w(tmp/* /something/dir/file_disallow.html),
169
187
  :allow => %w(allow/* /something/dir/file_allow.html)
170
188
  },
171
189
  {
172
- 'user-agent' => 'Googlebot-Image',
190
+ :user_agent => 'Googlebot-Image',
173
191
  :disallow => %w(tmp/* /something/dir/file_disallow.html),
174
192
  :allow => %w(allow/* /something/dir/file_allow.html)
175
193
  }
@@ -25,8 +25,10 @@ module Middleman
25
25
  data = []
26
26
  rules.each do |rule|
27
27
  row = []
28
- if (rule["user-agent"])
29
- row << "User-Agent: #{rule["user-agent"]}"
28
+
29
+ if (rule["user-agent"] || rule[:user_agent])
30
+ user_agent = rule[:user_agent] || rule["user-agent"]
31
+ row << "User-Agent: #{user_agent}"
30
32
  end
31
33
 
32
34
  if (rule[:disallow])
@@ -55,3 +57,4 @@ module Middleman
55
57
  end
56
58
  end
57
59
  end
60
+
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module Robots
3
- VERSION = "0.1.0"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-robots
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yterajima
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-10 00:00:00.000000000 Z
11
+ date: 2014-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman
@@ -91,6 +91,7 @@ files:
91
91
  - ".travis.yml"
92
92
  - Gemfile
93
93
  - LICENSE.txt
94
+ - README.jp.md
94
95
  - README.md
95
96
  - Rakefile
96
97
  - features/robots.feature