robots_dot_text 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/controllers/robots_dot_text_controller.rb +1 -1
- data/lib/robots_dot_text.rb +1 -1
- data/lib/robots_dot_text/controller.rb +28 -0
- data/lib/robots_dot_text/version.rb +1 -1
- data/test/dummy/log/test.log +28 -0
- metadata +2 -2
- data/lib/robots_dot_text/robots_controller.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79cd616e115782d03d6b6277009bc58c765703af
|
4
|
+
data.tar.gz: 8f9407e3cd8e8b67d8cb91eae2a8d6f397e54136
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a4e501c49724f4864c8aad3c4b5dbaeb70425040e371a0c8f5fb1714c6316ec70253c67d4bad400576c6ab745e3a028b6fd3b066f31624cc869e487aaa56f7f
|
7
|
+
data.tar.gz: 00c473db6b46f7f164d0ada008c3af4d227c685a4ad46b1af575519fe0590edebb96accb5b6fd5e58ecd4929357d88c1625a7ee7eb8bf9d4678791789c6d2f3c
|
data/README.md
CHANGED
@@ -31,7 +31,7 @@ You can create a file for every rails environment using the naming convention ro
|
|
31
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
32
|
|
33
33
|
class RobotsDotTextController < ActionController::Base
|
34
|
-
include
|
34
|
+
include RobotsDotText::Controller
|
35
35
|
private
|
36
36
|
def robots_file_descriptor
|
37
37
|
request.env["SERVER_NAME"]
|
data/lib/robots_dot_text.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
module RobotsDotText
|
2
|
+
module Controller
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
def show
|
6
|
+
begin
|
7
|
+
render file: robots_file_path, layout: false, content_type: 'text/plain'
|
8
|
+
rescue ActionView::MissingTemplate
|
9
|
+
render file: default_robots_path, layout: false, content_type: 'text/plain'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def robots_file_path
|
16
|
+
File.join([Rails.root, 'public', "robots.#{robots_file_descriptor}.txt"])
|
17
|
+
end
|
18
|
+
|
19
|
+
def default_robots_path
|
20
|
+
File.join([Rails.root, 'public', 'robots.default.txt'])
|
21
|
+
end
|
22
|
+
|
23
|
+
def robots_file_descriptor
|
24
|
+
Rails.env.to_s
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
data/test/dummy/log/test.log
CHANGED
@@ -414,5 +414,33 @@ Completed 200 OK in 10ms (Views: 9.5ms | ActiveRecord: 0.0ms)
|
|
414
414
|
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
415
415
|
-----------------------------
|
416
416
|
RobotsDotTextTest: test_truth
|
417
|
+
-----------------------------
|
418
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
419
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
420
|
+
-----------------------------
|
421
|
+
RobotsDotTextTest: test_truth
|
422
|
+
-----------------------------
|
423
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
424
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
425
|
+
--------------------------------------------------------------------
|
426
|
+
RobotsDotTextRenderTest: test_The_test_robots.txt_should_be_rendered
|
427
|
+
--------------------------------------------------------------------
|
428
|
+
Started GET "/robots.txt" for 127.0.0.1 at 2015-02-20 15:57:31 -0800
|
429
|
+
Processing by RobotsDotTextController#show as HTML
|
430
|
+
Rendered public/robots.test.txt (1.1ms)
|
431
|
+
Completed 200 OK in 9ms (Views: 8.8ms | ActiveRecord: 0.0ms)
|
432
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
433
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
434
|
+
--------------------------------------------------------------------
|
435
|
+
RobotsDotTextRenderTest: test_The_test_robots.txt_should_be_rendered
|
436
|
+
--------------------------------------------------------------------
|
437
|
+
Started GET "/robots.txt" for 127.0.0.1 at 2015-02-20 15:58:16 -0800
|
438
|
+
Processing by RobotsDotTextController#show as HTML
|
439
|
+
Rendered public/robots.test.txt (1.0ms)
|
440
|
+
Completed 200 OK in 8ms (Views: 7.3ms | ActiveRecord: 0.0ms)
|
441
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
442
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
443
|
+
-----------------------------
|
444
|
+
RobotsDotTextTest: test_truth
|
417
445
|
-----------------------------
|
418
446
|
[1m[35m (0.0ms)[0m rollback transaction
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jessie Keck
|
@@ -52,8 +52,8 @@ files:
|
|
52
52
|
- config/routes.rb
|
53
53
|
- lib/generators/robots_dot_text/move_existing_robots_file_generator.rb
|
54
54
|
- lib/robots_dot_text.rb
|
55
|
+
- lib/robots_dot_text/controller.rb
|
55
56
|
- lib/robots_dot_text/engine.rb
|
56
|
-
- lib/robots_dot_text/robots_controller.rb
|
57
57
|
- lib/robots_dot_text/version.rb
|
58
58
|
- test/dummy/README.rdoc
|
59
59
|
- test/dummy/Rakefile
|
@@ -1,26 +0,0 @@
|
|
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
|