robots_dot_text 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -1
- data/app/controllers/robots_dot_text_controller.rb +1 -7
- data/lib/robots_dot_text.rb +1 -0
- data/lib/robots_dot_text/robots_controller.rb +26 -0
- data/lib/robots_dot_text/version.rb +1 -1
- data/test/dummy/log/test.log +83 -0
- data/test/integration/robots_dot_text_render_test.rb +1 -1
- metadata +7 -7
- data/lib/tasks/robots_dot_text_tasks.rake +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3471a326d11dbfc727ce646ca8fe5b7a4225b47
|
4
|
+
data.tar.gz: d2455c4ba664b536e4b54fc315174c66715541ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cba5a0eea5b7d943acd576c801248e4fd88dc844244728ecebb7073126060b10912ae90208a019c28009e361b9e60ceef9e253aede25b45de0bd7bbb004c01f0
|
7
|
+
data.tar.gz: c3f9c19785211cf6df7c286d441ca01458cb1aff5c6c94176171326b4c4770afc6bff288b63ce82923b3983a0eb7fd897f6c2d105f484c896930112a5470cdf5
|
data/README.md
CHANGED
@@ -27,4 +27,15 @@ You can create a file for every rails environment using the naming convention ro
|
|
27
27
|
robots.production.txt
|
28
28
|
robots.development.txt
|
29
29
|
|
30
|
-
|
30
|
+
## Further customization of robots.txt file names
|
31
|
+
If you would like to customize the robots.txt file name to something other than the rails environment you can do so by overriding the `RobotsDotTextController#robots_file_descriptor` method in your app.
|
32
|
+
|
33
|
+
class RobotsDotTextController < ActionController::Base
|
34
|
+
include RobotsController
|
35
|
+
private
|
36
|
+
def robots_file_descriptor
|
37
|
+
request.env["SERVER_NAME"]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
The above would load `robots.localhost.txt` when running under `localhost:3000` or `robots.example.txt` when running under `example.com`.
|
@@ -1,9 +1,3 @@
|
|
1
1
|
class RobotsDotTextController < ActionController::Base
|
2
|
-
|
3
|
-
begin
|
4
|
-
render "public/robots.#{Rails.env}.txt", layout: false, content_type: 'text/plain'
|
5
|
-
rescue ActionView::MissingTemplate
|
6
|
-
render "public/robots.default.txt", layout: false, content_type: 'text/plain'
|
7
|
-
end
|
8
|
-
end
|
2
|
+
include RobotsController
|
9
3
|
end
|
data/lib/robots_dot_text.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
module RobotsController
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
def show
|
5
|
+
begin
|
6
|
+
render file: robots_file_path, layout: false, content_type: 'text/plain'
|
7
|
+
rescue ActionView::MissingTemplate
|
8
|
+
render file: default_robots_path, layout: false, content_type: 'text/plain'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def robots_file_path
|
15
|
+
File.join([Rails.root, 'public', "robots.#{robots_file_descriptor}.txt"])
|
16
|
+
end
|
17
|
+
|
18
|
+
def default_robots_path
|
19
|
+
File.join([Rails.root, 'public', 'robots.default.txt'])
|
20
|
+
end
|
21
|
+
|
22
|
+
def robots_file_descriptor
|
23
|
+
Rails.env.to_s
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/test/dummy/log/test.log
CHANGED
@@ -333,3 +333,86 @@ Processing by RobotsDotTextController#show as HTML
|
|
333
333
|
Rendered public/robots.test.txt (1.2ms)
|
334
334
|
Completed 200 OK in 7ms (Views: 7.0ms | ActiveRecord: 0.0ms)
|
335
335
|
[1m[35m (0.1ms)[0m rollback transaction
|
336
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
337
|
+
--------------------------------------------------------------------
|
338
|
+
RobotsDotTextRenderTest: test_The_test_robots.txt_should_be_rendered
|
339
|
+
--------------------------------------------------------------------
|
340
|
+
Started GET "/robots.txt" for 127.0.0.1 at 2015-02-20 12:36:49 -0800
|
341
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
342
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
343
|
+
-----------------------------
|
344
|
+
RobotsDotTextTest: test_truth
|
345
|
+
-----------------------------
|
346
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
347
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
348
|
+
-----------------------------
|
349
|
+
RobotsDotTextTest: test_truth
|
350
|
+
-----------------------------
|
351
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
352
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
353
|
+
--------------------------------------------------------------------
|
354
|
+
RobotsDotTextRenderTest: test_The_test_robots.txt_should_be_rendered
|
355
|
+
--------------------------------------------------------------------
|
356
|
+
Started GET "/robots.txt" for 127.0.0.1 at 2015-02-20 12:37:17 -0800
|
357
|
+
Processing by RobotsDotTextController#show as HTML
|
358
|
+
Rendered public/robots.test.txt (3.8ms)
|
359
|
+
Completed 200 OK in 17ms (Views: 16.6ms | ActiveRecord: 0.0ms)
|
360
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
361
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
362
|
+
-----------------------------
|
363
|
+
RobotsDotTextTest: test_truth
|
364
|
+
-----------------------------
|
365
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
366
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
367
|
+
--------------------------------------------------------------------
|
368
|
+
RobotsDotTextRenderTest: test_The_test_robots.txt_should_be_rendered
|
369
|
+
--------------------------------------------------------------------
|
370
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
371
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
372
|
+
--------------------------------------------------------------------
|
373
|
+
RobotsDotTextRenderTest: test_The_test_robots.txt_should_be_rendered
|
374
|
+
--------------------------------------------------------------------
|
375
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
376
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
377
|
+
-----------------------------
|
378
|
+
RobotsDotTextTest: test_truth
|
379
|
+
-----------------------------
|
380
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
381
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
382
|
+
--------------------------------------------------------------------
|
383
|
+
RobotsDotTextRenderTest: test_The_test_robots.txt_should_be_rendered
|
384
|
+
--------------------------------------------------------------------
|
385
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
386
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
387
|
+
-----------------------------
|
388
|
+
RobotsDotTextTest: test_truth
|
389
|
+
-----------------------------
|
390
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
391
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
392
|
+
--------------------------------------------------------------------
|
393
|
+
RobotsDotTextRenderTest: test_The_test_robots.txt_should_be_rendered
|
394
|
+
--------------------------------------------------------------------
|
395
|
+
Started GET "/robots.txt" for 127.0.0.1 at 2015-02-20 15:30:26 -0800
|
396
|
+
Processing by RobotsDotTextController#show as HTML
|
397
|
+
Rendered public/robots.test.txt (1.4ms)
|
398
|
+
Completed 200 OK in 11ms (Views: 10.8ms | ActiveRecord: 0.0ms)
|
399
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
400
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
401
|
+
-----------------------------
|
402
|
+
RobotsDotTextTest: test_truth
|
403
|
+
-----------------------------
|
404
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
405
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
406
|
+
--------------------------------------------------------------------
|
407
|
+
RobotsDotTextRenderTest: test_The_test_robots.txt_should_be_rendered
|
408
|
+
--------------------------------------------------------------------
|
409
|
+
Started GET "/robots.txt" for 127.0.0.1 at 2015-02-20 15:32:15 -0800
|
410
|
+
Processing by RobotsDotTextController#show as HTML
|
411
|
+
Rendered public/robots.test.txt (1.4ms)
|
412
|
+
Completed 200 OK in 10ms (Views: 9.5ms | ActiveRecord: 0.0ms)
|
413
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
414
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
415
|
+
-----------------------------
|
416
|
+
RobotsDotTextTest: test_truth
|
417
|
+
-----------------------------
|
418
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
@@ -4,7 +4,7 @@ class RobotsDotTextRenderTest < ActionDispatch::IntegrationTest
|
|
4
4
|
fixtures :all
|
5
5
|
|
6
6
|
test "The test robots.txt should be rendered" do
|
7
|
-
get 'robots.txt'
|
7
|
+
get '/robots.txt'
|
8
8
|
assert_response :success
|
9
9
|
assert_equal "# Dummy test-app robots file", response.body, 'Incorrect robots.txt returned'
|
10
10
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: robots_dot_text
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jessie Keck
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.
|
19
|
+
version: 4.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.
|
26
|
+
version: 4.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sqlite3
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,8 +53,8 @@ files:
|
|
53
53
|
- lib/generators/robots_dot_text/move_existing_robots_file_generator.rb
|
54
54
|
- lib/robots_dot_text.rb
|
55
55
|
- lib/robots_dot_text/engine.rb
|
56
|
+
- lib/robots_dot_text/robots_controller.rb
|
56
57
|
- lib/robots_dot_text/version.rb
|
57
|
-
- lib/tasks/robots_dot_text_tasks.rake
|
58
58
|
- test/dummy/README.rdoc
|
59
59
|
- test/dummy/Rakefile
|
60
60
|
- test/dummy/app/assets/javascripts/application.js
|