middleman-robots 1.3.2 → 1.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ci.yml +25 -0
- data/.rspec +2 -0
- data/.rubocop.yml +28 -0
- data/.travis.yml +8 -9
- data/Gemfile +2 -0
- data/README.md +16 -16
- data/Rakefile +3 -3
- data/cucumber.yml +1 -0
- data/features/build.feature +30 -39
- data/features/support/env.rb +3 -2
- data/fixtures/server-app/config.rb +28 -14
- data/lib/middleman-robots.rb +4 -2
- data/lib/middleman-robots/extension.rb +13 -8
- data/lib/middleman-robots/generator.rb +12 -26
- data/lib/middleman-robots/generators/block.rb +55 -0
- data/lib/middleman-robots/generators/blocks.rb +26 -0
- data/lib/middleman-robots/generators/sitemap_uri.rb +24 -0
- data/lib/middleman-robots/version.rb +3 -1
- data/lib/middleman_extension.rb +2 -1
- data/middleman-robots.gemspec +21 -18
- data/spec/lib/middleman-robots/generator_spec.rb +65 -0
- data/spec/lib/middleman-robots/generators/block_spec.rb +205 -0
- data/spec/lib/middleman-robots/generators/blocks_spec.rb +50 -0
- data/spec/lib/middleman-robots/generators/sitemap_uri_spec.rb +51 -0
- data/spec/spec_helper.rb +13 -0
- metadata +97 -29
- data/lib/middleman-robots/group.rb +0 -50
- data/tests/test_generator.rb +0 -37
- data/tests/test_group.rb +0 -121
data/tests/test_group.rb
DELETED
@@ -1,121 +0,0 @@
|
|
1
|
-
require 'minitest/autorun'
|
2
|
-
require_relative '../lib/middleman-robots/group.rb'
|
3
|
-
|
4
|
-
class Test_Group < MiniTest::Test
|
5
|
-
|
6
|
-
def test_initialize
|
7
|
-
rule = {
|
8
|
-
user_agent: 'GoogleBot',
|
9
|
-
disallow: %w(tmp/* /someting/dir/disallow.html),
|
10
|
-
allow: %w(allow/* /someting/dir/allow.html),
|
11
|
-
}
|
12
|
-
group = Middleman::Robots::Group.new(rule)
|
13
|
-
|
14
|
-
assert_equal rule[:user_agent], group.user_agent
|
15
|
-
assert_equal %w(/tmp/* /someting/dir/disallow.html), group.disallow
|
16
|
-
assert_equal %w(/allow/* /someting/dir/allow.html), group.allow
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_initialize_without_user_agent
|
20
|
-
rule = {
|
21
|
-
disallow: %w(/tmp/*),
|
22
|
-
allow: %w(/allow/*),
|
23
|
-
}
|
24
|
-
group = Middleman::Robots::Group.new(rule)
|
25
|
-
|
26
|
-
assert_equal '*', group.user_agent
|
27
|
-
assert_equal rule[:disallow], group.disallow
|
28
|
-
assert_equal rule[:allow], group.allow
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_initialize_without_disallow
|
32
|
-
rule = {
|
33
|
-
user_agent: 'GoogleBot',
|
34
|
-
allow: %w(/allow/* /someting/dir/allow.html),
|
35
|
-
}
|
36
|
-
group = Middleman::Robots::Group.new(rule)
|
37
|
-
|
38
|
-
assert_equal rule[:user_agent], group.user_agent
|
39
|
-
assert_equal [], group.disallow
|
40
|
-
assert_equal rule[:allow], group.allow
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_initialize_without_allow
|
44
|
-
rule = {
|
45
|
-
user_agent: 'GoogleBot',
|
46
|
-
disallow: %w(/tmp/* /someting/dir/disallow.html),
|
47
|
-
}
|
48
|
-
group = Middleman::Robots::Group.new(rule)
|
49
|
-
|
50
|
-
assert_equal rule[:user_agent], group.user_agent
|
51
|
-
assert_equal rule[:disallow], group.disallow
|
52
|
-
assert_equal [], group.allow
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_text
|
56
|
-
rule = {
|
57
|
-
user_agent: 'GoogleBot',
|
58
|
-
disallow: %w(tmp/* /someting/dir/disallow.html),
|
59
|
-
allow: %w(allow/* /someting/dir/allow.html),
|
60
|
-
}
|
61
|
-
group = Middleman::Robots::Group.new(rule)
|
62
|
-
|
63
|
-
expected = <<-END
|
64
|
-
User-Agent: GoogleBot
|
65
|
-
Disallow: /tmp/*
|
66
|
-
Disallow: /someting/dir/disallow.html
|
67
|
-
Allow: /allow/*
|
68
|
-
Allow: /someting/dir/allow.html
|
69
|
-
END
|
70
|
-
|
71
|
-
assert_equal expected, group.text
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_text_without_user_agent
|
75
|
-
rule = {
|
76
|
-
disallow: %w(/tmp/*),
|
77
|
-
allow: %w(/allow/*),
|
78
|
-
}
|
79
|
-
group = Middleman::Robots::Group.new(rule)
|
80
|
-
|
81
|
-
expected = <<-END
|
82
|
-
User-Agent: *
|
83
|
-
Disallow: /tmp/*
|
84
|
-
Allow: /allow/*
|
85
|
-
END
|
86
|
-
|
87
|
-
assert_equal expected, group.text
|
88
|
-
end
|
89
|
-
|
90
|
-
def test_text_without_disallow
|
91
|
-
rule = {
|
92
|
-
user_agent: 'GoogleBot',
|
93
|
-
allow: %w(/allow/* /someting/dir/allow.html),
|
94
|
-
}
|
95
|
-
group = Middleman::Robots::Group.new(rule)
|
96
|
-
|
97
|
-
expected = <<-END
|
98
|
-
User-Agent: GoogleBot
|
99
|
-
Allow: /allow/*
|
100
|
-
Allow: /someting/dir/allow.html
|
101
|
-
END
|
102
|
-
|
103
|
-
assert_equal expected, group.text
|
104
|
-
end
|
105
|
-
|
106
|
-
def test_text_without_allow
|
107
|
-
rule = {
|
108
|
-
user_agent: 'GoogleBot',
|
109
|
-
disallow: %w(/tmp/* /someting/dir/disallow.html),
|
110
|
-
}
|
111
|
-
group = Middleman::Robots::Group.new(rule)
|
112
|
-
|
113
|
-
expected = <<-END
|
114
|
-
User-Agent: GoogleBot
|
115
|
-
Disallow: /tmp/*
|
116
|
-
Disallow: /someting/dir/disallow.html
|
117
|
-
END
|
118
|
-
|
119
|
-
assert_equal expected, group.text
|
120
|
-
end
|
121
|
-
end
|