about_page 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/.gitignore +7 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +18 -0
  4. data/Gemfile.lock +140 -0
  5. data/LICENSE +5 -0
  6. data/README.md +21 -0
  7. data/Rakefile +8 -0
  8. data/about_page.gemspec +25 -0
  9. data/app/assets/javascripts/about_page.js +7 -0
  10. data/app/assets/stylesheets/about_page.scss +16 -0
  11. data/app/controllers/about_page/about_controller.rb +19 -0
  12. data/app/helpers/about_page/about_helper.rb +19 -0
  13. data/app/views/about_page/about/_app.html.erb +1 -0
  14. data/app/views/about_page/about/_dependencies.html.erb +9 -0
  15. data/app/views/about_page/about/_dependency_tree.html.erb +10 -0
  16. data/app/views/about_page/about/_environment.html.erb +11 -0
  17. data/app/views/about_page/about/_exception.html.erb +2 -0
  18. data/app/views/about_page/about/_generic_hash.html.erb +6 -0
  19. data/app/views/about_page/about/index.html.erb +8 -0
  20. data/config/routes.rb +3 -0
  21. data/lib/about_page.rb +22 -0
  22. data/lib/about_page/configuration.rb +69 -0
  23. data/lib/about_page/dependencies.rb +33 -0
  24. data/lib/about_page/engine.rb +4 -0
  25. data/lib/about_page/environment.rb +38 -0
  26. data/lib/about_page/fedora.rb +15 -0
  27. data/lib/about_page/request_environment.rb +14 -0
  28. data/lib/about_page/solr.rb +41 -0
  29. data/lib/about_page/version.rb +3 -0
  30. data/lib/generators/about_page/about_page_generator.rb +13 -0
  31. data/lib/generators/about_page/templates/about_page.rb +14 -0
  32. data/lib/tasks/about_page_tasks.rake +4 -0
  33. data/script/rails +8 -0
  34. data/spec/dummy/README.rdoc +261 -0
  35. data/spec/dummy/Rakefile +7 -0
  36. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  37. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  38. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  39. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  40. data/spec/dummy/app/mailers/.gitkeep +0 -0
  41. data/spec/dummy/app/models/.gitkeep +0 -0
  42. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  43. data/spec/dummy/config.ru +4 -0
  44. data/spec/dummy/config/application.rb +56 -0
  45. data/spec/dummy/config/boot.rb +10 -0
  46. data/spec/dummy/config/database.yml +25 -0
  47. data/spec/dummy/config/environment.rb +5 -0
  48. data/spec/dummy/config/environments/development.rb +37 -0
  49. data/spec/dummy/config/environments/production.rb +67 -0
  50. data/spec/dummy/config/environments/test.rb +37 -0
  51. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  52. data/spec/dummy/config/initializers/inflections.rb +15 -0
  53. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  54. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  55. data/spec/dummy/config/initializers/session_store.rb +8 -0
  56. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  57. data/spec/dummy/config/locales/en.yml +5 -0
  58. data/spec/dummy/config/routes.rb +4 -0
  59. data/spec/dummy/db/.gitkeep +0 -0
  60. data/spec/dummy/db/schema.rb +16 -0
  61. data/spec/dummy/lib/assets/.gitkeep +0 -0
  62. data/spec/dummy/log/.gitkeep +0 -0
  63. data/spec/dummy/public/404.html +26 -0
  64. data/spec/dummy/public/422.html +26 -0
  65. data/spec/dummy/public/500.html +25 -0
  66. data/spec/dummy/public/favicon.ico +0 -0
  67. data/spec/dummy/script/rails +6 -0
  68. data/spec/integration/about_page_spec.rb +61 -0
  69. data/spec/lib/about_page_configuration.rb +8 -0
  70. data/spec/lib/configuration_environment_spec.rb +13 -0
  71. data/spec/lib/solr_spec.rb +80 -0
  72. data/spec/spec_helper.rb +23 -0
  73. metadata +246 -0
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+
3
+ describe "the about page", :type => :request do
4
+ before :all do
5
+ AboutPage.reset!
6
+
7
+ AboutPage.configure do |config|
8
+ config.app = { :name => 'Application Name', :version => '0.0.0' }
9
+
10
+ config.dependencies = AboutPage::Dependencies.new
11
+
12
+ config.environment = AboutPage::Environment.new({
13
+ 'Ruby' => /^(RUBY|GEM_|rvm)/
14
+ })
15
+
16
+ config.request = AboutPage::RequestEnvironment.new({
17
+ 'HTTP Server' => /^(SERVER_|POW_)/,
18
+ 'WebAuth' => /^WEBAUTH_/
19
+ })
20
+ end
21
+ end
22
+ describe "dependency versions" do
23
+ before do
24
+ visit("/about")
25
+ end
26
+
27
+ it "should contain a list of dependencies" do
28
+ page.should have_content "about_page"
29
+ end
30
+ end
31
+
32
+ describe "environment section" do
33
+ before do
34
+ visit("/about")
35
+ end
36
+
37
+ it "should contain a list of environment variables" do
38
+ page.should have_content "GEM_HOME"
39
+ end
40
+ end
41
+
42
+ describe "xml" do
43
+ before do
44
+ visit("/about.xml")
45
+ end
46
+
47
+ it "should" do
48
+ page.body.should_not be_empty
49
+ end
50
+ end
51
+
52
+ describe "json" do
53
+ before do
54
+ visit("/about.json")
55
+ end
56
+
57
+ it "should" do
58
+ page.body.should_not be_empty
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe "AboutPage::Configuration" do
4
+ it "" do
5
+ AboutPage.configuration.environment.should be_a_kind_of AboutPage::Environment
6
+ end
7
+
8
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe "AboutPage::Environment" do
4
+ describe "#to_h" do
5
+ it "should" do
6
+ AboutPage::Environment.new.to_h
7
+ end
8
+
9
+ end
10
+ it "should" do
11
+ AboutPage::Environment.new.should be_a_kind_of(AboutPage::Environment)
12
+ end
13
+ end
@@ -0,0 +1,80 @@
1
+ require 'spec_helper'
2
+
3
+ describe AboutPage::Solr do
4
+ before :each do
5
+ @mock_solr_connection = double('RSolr::Connection')
6
+ end
7
+
8
+ subject { AboutPage::Solr.new(@mock_solr_connection) }
9
+
10
+ describe "#schema" do
11
+ it "should be empty if the connection to solr fails" do
12
+ @mock_solr_connection.should_receive(:luke).with(any_args).and_throw(:msg)
13
+ subject.schema.should be_empty
14
+ end
15
+ it "should retrieve index information from luke" do
16
+ @mock_solr_connection.should_receive(:luke).with(any_args).and_return { Hash.new }
17
+ subject.schema.should be_a_kind_of(Hash)
18
+ end
19
+ end
20
+
21
+ describe "#index" do
22
+ it "should get the index information from the schema" do
23
+ m = mock()
24
+ subject.stub(:schema).and_return { { 'index' => m }}
25
+
26
+ subject.index.should == m
27
+ end
28
+ end
29
+
30
+
31
+ describe "#ok?" do
32
+ it "should be ok if the number of documents in the index is greater than or equal to the :minimum_numdocs" do
33
+ subject.stub(:index).and_return { { :numDocs => 1 }}
34
+ subject.stub(:minimum_numdocs).and_return 1
35
+ subject.should be_ok
36
+ end
37
+
38
+ it "should be not be ok if the number of documents in the index is less than the :minimum_numdocs" do
39
+ subject.stub(:index).and_return { { :numDocs => 1 }}
40
+ subject.stub(:minimum_numdocs).and_return 5
41
+ subject.should_not be_ok
42
+ end
43
+
44
+ it "should not be ok if the index :numDocs param is not set" do
45
+ subject.stub(:index).and_return { Hash.new }
46
+ subject.stub(:minimum_numdocs).and_return 1
47
+ subject.should_not be_ok
48
+ end
49
+ end
50
+
51
+ describe "#set_headers!" do
52
+ it "should add helpful headers when something is wrong" do
53
+ subject.stub(:index).and_return { { :numDocs => 1 }}
54
+ subject.stub(:minimum_numdocs).and_return 5
55
+
56
+ subject.should_receive(:add_header)
57
+ subject.set_headers! mock()
58
+ end
59
+ end
60
+
61
+ describe "#minimum_numdocs" do
62
+ it "should default to 1" do
63
+ subject.minimum_numdocs.should == 1
64
+ end
65
+
66
+ it "should use parameters given in the configuration" do
67
+ node = AboutPage::Solr.new(@mock_solr_connection, :minimum_numdocs => 5)
68
+ node.minimum_numdocs.should == 5
69
+ end
70
+
71
+ it "should use the request parameters to set the minimum_numdocs" do
72
+ node = AboutPage::Solr.new(@mock_solr_connection, :minimum_numdocs => 5)
73
+ node.preflight(mock(:params => { 'solr.numDocs' => 1000 }))
74
+
75
+ node.minimum_numdocs.should == 1000
76
+ end
77
+ end
78
+
79
+
80
+ end
@@ -0,0 +1,23 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+ require File.expand_path("../../spec/dummy/config/environment", __FILE__)
4
+ require 'capybara/rspec'
5
+
6
+ require 'rspec/rails'
7
+ require 'rspec/autorun'
8
+ require 'capybara/rails'
9
+
10
+ # Requires supporting ruby files with custom matchers and macros, etc,
11
+ # in spec/support/ and its subdirectories.
12
+ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
13
+
14
+ RSpec.configure do |config|
15
+ # ## Mock Framework
16
+ #
17
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
18
+ #
19
+ # config.mock_with :mocha
20
+ # config.mock_with :flexmock
21
+ # config.mock_with :rr
22
+
23
+ end
metadata ADDED
@@ -0,0 +1,246 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: about_page
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Michael B. Klein
9
+ - Chris Beer
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2012-05-21 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rails
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: '3.2'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: '3.2'
31
+ - !ruby/object:Gem::Dependency
32
+ name: rspec
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ type: :development
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec-rails
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ - !ruby/object:Gem::Dependency
64
+ name: capybara
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ type: :development
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ - !ruby/object:Gem::Dependency
80
+ name: launchy
81
+ requirement: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ type: :development
88
+ prerelease: false
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ description: Description of AboutPage.
96
+ email:
97
+ - mbklein@stanford.edu
98
+ - cabeer@stanford.edu
99
+ executables: []
100
+ extensions: []
101
+ extra_rdoc_files: []
102
+ files:
103
+ - .gitignore
104
+ - .rspec
105
+ - Gemfile
106
+ - Gemfile.lock
107
+ - LICENSE
108
+ - README.md
109
+ - Rakefile
110
+ - about_page.gemspec
111
+ - app/assets/javascripts/about_page.js
112
+ - app/assets/stylesheets/about_page.scss
113
+ - app/controllers/about_page/about_controller.rb
114
+ - app/helpers/about_page/about_helper.rb
115
+ - app/views/about_page/about/_app.html.erb
116
+ - app/views/about_page/about/_dependencies.html.erb
117
+ - app/views/about_page/about/_dependency_tree.html.erb
118
+ - app/views/about_page/about/_environment.html.erb
119
+ - app/views/about_page/about/_exception.html.erb
120
+ - app/views/about_page/about/_generic_hash.html.erb
121
+ - app/views/about_page/about/index.html.erb
122
+ - config/routes.rb
123
+ - lib/about_page.rb
124
+ - lib/about_page/configuration.rb
125
+ - lib/about_page/dependencies.rb
126
+ - lib/about_page/engine.rb
127
+ - lib/about_page/environment.rb
128
+ - lib/about_page/fedora.rb
129
+ - lib/about_page/request_environment.rb
130
+ - lib/about_page/solr.rb
131
+ - lib/about_page/version.rb
132
+ - lib/generators/about_page/about_page_generator.rb
133
+ - lib/generators/about_page/templates/about_page.rb
134
+ - lib/tasks/about_page_tasks.rake
135
+ - script/rails
136
+ - spec/dummy/README.rdoc
137
+ - spec/dummy/Rakefile
138
+ - spec/dummy/app/assets/javascripts/application.js
139
+ - spec/dummy/app/assets/stylesheets/application.css
140
+ - spec/dummy/app/controllers/application_controller.rb
141
+ - spec/dummy/app/helpers/application_helper.rb
142
+ - spec/dummy/app/mailers/.gitkeep
143
+ - spec/dummy/app/models/.gitkeep
144
+ - spec/dummy/app/views/layouts/application.html.erb
145
+ - spec/dummy/config.ru
146
+ - spec/dummy/config/application.rb
147
+ - spec/dummy/config/boot.rb
148
+ - spec/dummy/config/database.yml
149
+ - spec/dummy/config/environment.rb
150
+ - spec/dummy/config/environments/development.rb
151
+ - spec/dummy/config/environments/production.rb
152
+ - spec/dummy/config/environments/test.rb
153
+ - spec/dummy/config/initializers/backtrace_silencers.rb
154
+ - spec/dummy/config/initializers/inflections.rb
155
+ - spec/dummy/config/initializers/mime_types.rb
156
+ - spec/dummy/config/initializers/secret_token.rb
157
+ - spec/dummy/config/initializers/session_store.rb
158
+ - spec/dummy/config/initializers/wrap_parameters.rb
159
+ - spec/dummy/config/locales/en.yml
160
+ - spec/dummy/config/routes.rb
161
+ - spec/dummy/db/.gitkeep
162
+ - spec/dummy/db/schema.rb
163
+ - spec/dummy/lib/assets/.gitkeep
164
+ - spec/dummy/log/.gitkeep
165
+ - spec/dummy/public/404.html
166
+ - spec/dummy/public/422.html
167
+ - spec/dummy/public/500.html
168
+ - spec/dummy/public/favicon.ico
169
+ - spec/dummy/script/rails
170
+ - spec/dummy/tmp/capybara/capybara-201204200939394978936149.html
171
+ - spec/integration/about_page_spec.rb
172
+ - spec/lib/about_page_configuration.rb
173
+ - spec/lib/configuration_environment_spec.rb
174
+ - spec/lib/solr_spec.rb
175
+ - spec/spec_helper.rb
176
+ homepage: http://github.com/sul-dlss/about_page
177
+ licenses: []
178
+ post_install_message:
179
+ rdoc_options: []
180
+ require_paths:
181
+ - lib
182
+ required_ruby_version: !ruby/object:Gem::Requirement
183
+ none: false
184
+ requirements:
185
+ - - ! '>='
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ segments:
189
+ - 0
190
+ hash: 1997216736359114848
191
+ required_rubygems_version: !ruby/object:Gem::Requirement
192
+ none: false
193
+ requirements:
194
+ - - ! '>='
195
+ - !ruby/object:Gem::Version
196
+ version: '0'
197
+ segments:
198
+ - 0
199
+ hash: 1997216736359114848
200
+ requirements: []
201
+ rubyforge_project:
202
+ rubygems_version: 1.8.24
203
+ signing_key:
204
+ specification_version: 3
205
+ summary: Summary of AboutPage.
206
+ test_files:
207
+ - spec/dummy/README.rdoc
208
+ - spec/dummy/Rakefile
209
+ - spec/dummy/app/assets/javascripts/application.js
210
+ - spec/dummy/app/assets/stylesheets/application.css
211
+ - spec/dummy/app/controllers/application_controller.rb
212
+ - spec/dummy/app/helpers/application_helper.rb
213
+ - spec/dummy/app/mailers/.gitkeep
214
+ - spec/dummy/app/models/.gitkeep
215
+ - spec/dummy/app/views/layouts/application.html.erb
216
+ - spec/dummy/config.ru
217
+ - spec/dummy/config/application.rb
218
+ - spec/dummy/config/boot.rb
219
+ - spec/dummy/config/database.yml
220
+ - spec/dummy/config/environment.rb
221
+ - spec/dummy/config/environments/development.rb
222
+ - spec/dummy/config/environments/production.rb
223
+ - spec/dummy/config/environments/test.rb
224
+ - spec/dummy/config/initializers/backtrace_silencers.rb
225
+ - spec/dummy/config/initializers/inflections.rb
226
+ - spec/dummy/config/initializers/mime_types.rb
227
+ - spec/dummy/config/initializers/secret_token.rb
228
+ - spec/dummy/config/initializers/session_store.rb
229
+ - spec/dummy/config/initializers/wrap_parameters.rb
230
+ - spec/dummy/config/locales/en.yml
231
+ - spec/dummy/config/routes.rb
232
+ - spec/dummy/db/.gitkeep
233
+ - spec/dummy/db/schema.rb
234
+ - spec/dummy/lib/assets/.gitkeep
235
+ - spec/dummy/log/.gitkeep
236
+ - spec/dummy/public/404.html
237
+ - spec/dummy/public/422.html
238
+ - spec/dummy/public/500.html
239
+ - spec/dummy/public/favicon.ico
240
+ - spec/dummy/script/rails
241
+ - spec/dummy/tmp/capybara/capybara-201204200939394978936149.html
242
+ - spec/integration/about_page_spec.rb
243
+ - spec/lib/about_page_configuration.rb
244
+ - spec/lib/configuration_environment_spec.rb
245
+ - spec/lib/solr_spec.rb
246
+ - spec/spec_helper.rb