gitlab-peek 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.travis.yml +12 -0
  4. data/CHANGELOG.md +96 -0
  5. data/Gemfile +30 -0
  6. data/Gemfile-rails42 +27 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +253 -0
  9. data/Rakefile +13 -0
  10. data/app/assets/javascripts/peek.js +86 -0
  11. data/app/assets/javascripts/peek/vendor/jquery.tipsy.js +258 -0
  12. data/app/assets/stylesheets/peek.scss +85 -0
  13. data/app/assets/stylesheets/peek/vendor/tipsy.scss +22 -0
  14. data/app/controllers/peek/results_controller.rb +25 -0
  15. data/app/views/peek/_bar.html.erb +11 -0
  16. data/config/routes.rb +3 -0
  17. data/gitlab-peek.gemspec +22 -0
  18. data/lib/peek.rb +93 -0
  19. data/lib/peek/adapters/base.rb +17 -0
  20. data/lib/peek/adapters/elasticsearch.rb +33 -0
  21. data/lib/peek/adapters/memcache.rb +25 -0
  22. data/lib/peek/adapters/memory.rb +25 -0
  23. data/lib/peek/adapters/redis.rb +21 -0
  24. data/lib/peek/controller_helpers.rb +22 -0
  25. data/lib/peek/railtie.rb +37 -0
  26. data/lib/peek/version.rb +3 -0
  27. data/lib/peek/views/view.rb +124 -0
  28. data/test/controllers/requests_test.rb +33 -0
  29. data/test/dummy/README.rdoc +28 -0
  30. data/test/dummy/Rakefile +6 -0
  31. data/test/dummy/app/assets/javascripts/application.js +16 -0
  32. data/test/dummy/app/assets/stylesheets/application.css +14 -0
  33. data/test/dummy/app/controllers/application_controller.rb +13 -0
  34. data/test/dummy/app/controllers/home_controller.rb +11 -0
  35. data/test/dummy/app/helpers/application_helper.rb +2 -0
  36. data/test/dummy/app/views/home/show.html.erb +5 -0
  37. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  38. data/test/dummy/app/views/peek/_test_view.html.erb +1 -0
  39. data/test/dummy/bin/bundle +3 -0
  40. data/test/dummy/bin/rails +4 -0
  41. data/test/dummy/bin/rake +4 -0
  42. data/test/dummy/config.ru +4 -0
  43. data/test/dummy/config/application.rb +25 -0
  44. data/test/dummy/config/boot.rb +5 -0
  45. data/test/dummy/config/environment.rb +5 -0
  46. data/test/dummy/config/environments/development.rb +23 -0
  47. data/test/dummy/config/environments/test.rb +36 -0
  48. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  49. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  50. data/test/dummy/config/initializers/inflections.rb +16 -0
  51. data/test/dummy/config/initializers/mime_types.rb +5 -0
  52. data/test/dummy/config/initializers/peek.rb +3 -0
  53. data/test/dummy/config/initializers/secret_token.rb +12 -0
  54. data/test/dummy/config/initializers/session_store.rb +3 -0
  55. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  56. data/test/dummy/config/locales/en.yml +23 -0
  57. data/test/dummy/config/routes.rb +8 -0
  58. data/test/dummy/lib/test_view.rb +18 -0
  59. data/test/dummy/public/404.html +58 -0
  60. data/test/dummy/public/422.html +58 -0
  61. data/test/dummy/public/500.html +57 -0
  62. data/test/dummy/public/favicon.ico +0 -0
  63. data/test/peek/views/view_test.rb +37 -0
  64. data/test/peek_test.rb +69 -0
  65. data/test/test_helper.rb +22 -0
  66. metadata +161 -0
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/422.html -->
52
+ <div class="dialog">
53
+ <h1>The change you wanted was rejected.</h1>
54
+ <p>Maybe you tried to change something you didn't have access to.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/500.html -->
52
+ <div class="dialog">
53
+ <h1>We're sorry, but something went wrong.</h1>
54
+ </div>
55
+ <p>If you are the application owner check the logs for more information.</p>
56
+ </body>
57
+ </html>
File without changes
@@ -0,0 +1,37 @@
1
+ require 'test_helper'
2
+
3
+ describe Peek::Views::View do
4
+ before do
5
+ @view = Peek::Views::View.new
6
+ end
7
+
8
+ describe "partial path" do
9
+ it "should return correct partial class" do
10
+ assert_equal 'peek/views/view', @view.partial_path
11
+ end
12
+ end
13
+
14
+ describe "dom_id" do
15
+ it "should return correct dom_id" do
16
+ assert_equal 'peek-view-view', @view.dom_id
17
+ end
18
+ end
19
+
20
+ describe "key" do
21
+ it "should return correct key" do
22
+ assert_equal 'view', @view.key
23
+ end
24
+ end
25
+
26
+ describe "context" do
27
+ it "should return correct context_id" do
28
+ assert_equal 'peek-context-view', @view.context_id
29
+ end
30
+ end
31
+
32
+ describe "toggling off and on" do
33
+ it "should be enabled by default" do
34
+ assert @view.enabled?
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,69 @@
1
+ require 'test_helper'
2
+
3
+ class Staff < Peek::Views::View
4
+ def initialize(options = {})
5
+ @username = options.delete(:username)
6
+ end
7
+
8
+ def username
9
+ @username
10
+ end
11
+
12
+ def enabled?
13
+ !!@username
14
+ end
15
+ end
16
+
17
+ describe Peek do
18
+ describe "enabled?" do
19
+ it "should not be enabled in test" do
20
+ refute Peek.enabled?
21
+ end
22
+ end
23
+
24
+ describe "env" do
25
+ it "should return the current environment" do
26
+ assert_equal 'test', Peek.env
27
+ end
28
+ end
29
+
30
+ describe "views" do
31
+ before do
32
+ Peek.reset
33
+ end
34
+
35
+ it "should have none by default" do
36
+ assert_equal [], Peek.views
37
+ end
38
+
39
+ it "should be able to append views" do
40
+ Peek.into Staff, username: 'dewski'
41
+ assert_kind_of Staff, Peek.views.first
42
+ end
43
+
44
+ it "should be able to append views with options" do
45
+ Peek.into Staff, username: 'dewski'
46
+ @staff = Peek.views.first
47
+ assert_kind_of Staff, @staff
48
+ assert_equal 'dewski', @staff.username
49
+ end
50
+
51
+ it "should only return enabled views" do
52
+ Peek.into Staff, username: false
53
+ assert_equal [], Peek.views
54
+ end
55
+ end
56
+
57
+ describe "reset" do
58
+ before do
59
+ Peek.reset
60
+ end
61
+
62
+ it "should clear any current views" do
63
+ Peek.into Staff, username: 'dewski'
64
+ assert_kind_of Staff, Peek.views.first
65
+ Peek.reset
66
+ assert_equal [], Peek.views
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,22 @@
1
+ ENV['RAILS_ENV'] = 'test'
2
+
3
+ require File.expand_path('../dummy/config/environment.rb', __FILE__)
4
+ require 'rails/test_help'
5
+
6
+ Rails.backtrace_cleaner.remove_silencers!
7
+
8
+ # Load support files
9
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
10
+
11
+ # Load fixtures from the engine
12
+ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
13
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
14
+ end
15
+
16
+ require 'minitest/autorun'
17
+
18
+ begin
19
+ require 'turn'
20
+ rescue LoadError
21
+ # Not installed.
22
+ end
metadata ADDED
@@ -0,0 +1,161 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gitlab-peek
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Garrett Bjerkhoel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-08-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 4.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 4.0.0
27
+ description: Take a peek into your Rails application.
28
+ email:
29
+ - me@garrettbjerkhoel.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".gitignore"
35
+ - ".travis.yml"
36
+ - CHANGELOG.md
37
+ - Gemfile
38
+ - Gemfile-rails42
39
+ - LICENSE.txt
40
+ - README.md
41
+ - Rakefile
42
+ - app/assets/javascripts/peek.js
43
+ - app/assets/javascripts/peek/vendor/jquery.tipsy.js
44
+ - app/assets/stylesheets/peek.scss
45
+ - app/assets/stylesheets/peek/vendor/tipsy.scss
46
+ - app/controllers/peek/results_controller.rb
47
+ - app/views/peek/_bar.html.erb
48
+ - config/routes.rb
49
+ - gitlab-peek.gemspec
50
+ - lib/peek.rb
51
+ - lib/peek/adapters/base.rb
52
+ - lib/peek/adapters/elasticsearch.rb
53
+ - lib/peek/adapters/memcache.rb
54
+ - lib/peek/adapters/memory.rb
55
+ - lib/peek/adapters/redis.rb
56
+ - lib/peek/controller_helpers.rb
57
+ - lib/peek/railtie.rb
58
+ - lib/peek/version.rb
59
+ - lib/peek/views/view.rb
60
+ - test/controllers/requests_test.rb
61
+ - test/dummy/README.rdoc
62
+ - test/dummy/Rakefile
63
+ - test/dummy/app/assets/javascripts/application.js
64
+ - test/dummy/app/assets/stylesheets/application.css
65
+ - test/dummy/app/controllers/application_controller.rb
66
+ - test/dummy/app/controllers/home_controller.rb
67
+ - test/dummy/app/helpers/application_helper.rb
68
+ - test/dummy/app/views/home/show.html.erb
69
+ - test/dummy/app/views/layouts/application.html.erb
70
+ - test/dummy/app/views/peek/_test_view.html.erb
71
+ - test/dummy/bin/bundle
72
+ - test/dummy/bin/rails
73
+ - test/dummy/bin/rake
74
+ - test/dummy/config.ru
75
+ - test/dummy/config/application.rb
76
+ - test/dummy/config/boot.rb
77
+ - test/dummy/config/environment.rb
78
+ - test/dummy/config/environments/development.rb
79
+ - test/dummy/config/environments/test.rb
80
+ - test/dummy/config/initializers/backtrace_silencers.rb
81
+ - test/dummy/config/initializers/filter_parameter_logging.rb
82
+ - test/dummy/config/initializers/inflections.rb
83
+ - test/dummy/config/initializers/mime_types.rb
84
+ - test/dummy/config/initializers/peek.rb
85
+ - test/dummy/config/initializers/secret_token.rb
86
+ - test/dummy/config/initializers/session_store.rb
87
+ - test/dummy/config/initializers/wrap_parameters.rb
88
+ - test/dummy/config/locales/en.yml
89
+ - test/dummy/config/routes.rb
90
+ - test/dummy/lib/test_view.rb
91
+ - test/dummy/log/.keep
92
+ - test/dummy/public/404.html
93
+ - test/dummy/public/422.html
94
+ - test/dummy/public/500.html
95
+ - test/dummy/public/favicon.ico
96
+ - test/peek/views/view_test.rb
97
+ - test/peek_test.rb
98
+ - test/test_helper.rb
99
+ homepage: https://github.com/peek/peek
100
+ licenses:
101
+ - MIT
102
+ metadata: {}
103
+ post_install_message:
104
+ rdoc_options: []
105
+ require_paths:
106
+ - lib
107
+ required_ruby_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ requirements: []
118
+ rubygems_version: 3.0.3
119
+ signing_key:
120
+ specification_version: 4
121
+ summary: Take a peek into your Rails application.
122
+ test_files:
123
+ - test/controllers/requests_test.rb
124
+ - test/dummy/README.rdoc
125
+ - test/dummy/Rakefile
126
+ - test/dummy/app/assets/javascripts/application.js
127
+ - test/dummy/app/assets/stylesheets/application.css
128
+ - test/dummy/app/controllers/application_controller.rb
129
+ - test/dummy/app/controllers/home_controller.rb
130
+ - test/dummy/app/helpers/application_helper.rb
131
+ - test/dummy/app/views/home/show.html.erb
132
+ - test/dummy/app/views/layouts/application.html.erb
133
+ - test/dummy/app/views/peek/_test_view.html.erb
134
+ - test/dummy/bin/bundle
135
+ - test/dummy/bin/rails
136
+ - test/dummy/bin/rake
137
+ - test/dummy/config.ru
138
+ - test/dummy/config/application.rb
139
+ - test/dummy/config/boot.rb
140
+ - test/dummy/config/environment.rb
141
+ - test/dummy/config/environments/development.rb
142
+ - test/dummy/config/environments/test.rb
143
+ - test/dummy/config/initializers/backtrace_silencers.rb
144
+ - test/dummy/config/initializers/filter_parameter_logging.rb
145
+ - test/dummy/config/initializers/inflections.rb
146
+ - test/dummy/config/initializers/mime_types.rb
147
+ - test/dummy/config/initializers/peek.rb
148
+ - test/dummy/config/initializers/secret_token.rb
149
+ - test/dummy/config/initializers/session_store.rb
150
+ - test/dummy/config/initializers/wrap_parameters.rb
151
+ - test/dummy/config/locales/en.yml
152
+ - test/dummy/config/routes.rb
153
+ - test/dummy/lib/test_view.rb
154
+ - test/dummy/log/.keep
155
+ - test/dummy/public/404.html
156
+ - test/dummy/public/422.html
157
+ - test/dummy/public/500.html
158
+ - test/dummy/public/favicon.ico
159
+ - test/peek/views/view_test.rb
160
+ - test/peek_test.rb
161
+ - test/test_helper.rb