api_doc_viewer 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +1 -4
- data/app/assets/javascripts/api_doc_viewer/angular/controllers/mainController.js.coffee +1 -1
- data/app/controllers/api_doc_viewer/main_controller.rb +5 -8
- data/config/routes.rb +1 -1
- data/lib/api_doc_viewer/version.rb +1 -1
- data/lib/api_doc_viewer.rb +1 -1
- data/test/api_doc_viewer_test.rb +1 -1
- data/test/dummy/config/application.rb +1 -2
- data/test/dummy/config/environments/test.rb +1 -1
- data/test/dummy/config/routes.rb +1 -1
- data/test/dummy/log/test.log +5 -0
- data/test/integration/navigation_test.rb +0 -1
- data/test/test_helper.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25c2ca3661218734a8b9cbf73ea26f37439670eb
|
4
|
+
data.tar.gz: c74bb775676baaa917b630144748afd5bd971bc6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b4521dc23aa928c4dc37f2c3a33f5b1c7783484203fa309cd960ae8ceb91de17dee528f07403b21260f7f2d84aaf4db9e8e6d05032ee44491e3cb33f9f209ea
|
7
|
+
data.tar.gz: 3b6888920a487570fee74909ec648360f8633996723a906e91d5ada8fca31c78ad1e2acf90b1edd97b0b350ea834302863f57d7141680e86ddd46093d58daeb1
|
data/Rakefile
CHANGED
@@ -14,11 +14,9 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
14
14
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
15
|
end
|
16
16
|
|
17
|
-
APP_RAKEFILE = File.expand_path(
|
17
|
+
APP_RAKEFILE = File.expand_path('../test/dummy/Rakefile', __FILE__)
|
18
18
|
load 'rails/tasks/engine.rake'
|
19
19
|
|
20
|
-
|
21
|
-
|
22
20
|
Bundler::GemHelper.install_tasks
|
23
21
|
|
24
22
|
require 'rake/testtask'
|
@@ -30,5 +28,4 @@ Rake::TestTask.new(:test) do |t|
|
|
30
28
|
t.verbose = false
|
31
29
|
end
|
32
30
|
|
33
|
-
|
34
31
|
task default: :test
|
@@ -22,7 +22,7 @@ angular.module('controllers').controller 'mainController', ['$scope', 'mainServi
|
|
22
22
|
]
|
23
23
|
|
24
24
|
formatJSONWithSpaces = (data) ->
|
25
|
-
if data && data.trim().match(
|
25
|
+
if data && data.trim().match(/^[\[\{].*[\}\]]$/)
|
26
26
|
JSON.stringify(JSON.parse(data), undefined, 2);
|
27
27
|
|
28
28
|
filterHeaders = (headers) ->
|
@@ -1,18 +1,15 @@
|
|
1
|
-
require_dependency
|
1
|
+
require_dependency 'api_doc_viewer/application_controller'
|
2
2
|
|
3
3
|
module ApiDocViewer
|
4
4
|
class MainController < ApplicationController
|
5
|
-
|
6
5
|
def index
|
7
6
|
end
|
8
7
|
|
9
8
|
def documentation
|
10
|
-
|
11
|
-
if
|
12
|
-
|
13
|
-
|
14
|
-
head :not_found
|
15
|
-
end
|
9
|
+
path = File.join(Rails.root, 'doc', 'api', params[:link] || 'index.json')
|
10
|
+
return head :unauthorized if path.include?('..') || !path.ends_with?('.json')
|
11
|
+
return head :not_found unless File.exist?(path)
|
12
|
+
render json: File.read(path)
|
16
13
|
end
|
17
14
|
end
|
18
15
|
end
|
data/config/routes.rb
CHANGED
data/lib/api_doc_viewer.rb
CHANGED
data/test/api_doc_viewer_test.rb
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path('../boot', __FILE__)
|
|
3
3
|
require 'rails/all'
|
4
4
|
|
5
5
|
Bundler.require(*Rails.groups)
|
6
|
-
require
|
6
|
+
require 'api_doc_viewer'
|
7
7
|
|
8
8
|
module Dummy
|
9
9
|
class Application < Rails::Application
|
@@ -20,4 +20,3 @@ module Dummy
|
|
20
20
|
# config.i18n.default_locale = :de
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
@@ -14,7 +14,7 @@ Dummy::Application.configure do
|
|
14
14
|
|
15
15
|
# Configure static asset server for tests with Cache-Control for performance.
|
16
16
|
config.serve_static_assets = true
|
17
|
-
config.static_cache_control =
|
17
|
+
config.static_cache_control = 'public, max-age=3600'
|
18
18
|
|
19
19
|
# Show full error reports and disable caching.
|
20
20
|
config.consider_all_requests_local = true
|
data/test/dummy/config/routes.rb
CHANGED
data/test/dummy/log/test.log
CHANGED
@@ -11,5 +11,10 @@ ApiDocViewerTest: test_truth
|
|
11
11
|
[1m[36m (0.3ms)[0m [1mbegin transaction[0m
|
12
12
|
----------------------------
|
13
13
|
ApiDocViewerTest: test_truth
|
14
|
+
----------------------------
|
15
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
16
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
17
|
+
----------------------------
|
18
|
+
ApiDocViewerTest: test_truth
|
14
19
|
----------------------------
|
15
20
|
[1m[35m (0.1ms)[0m rollback transaction
|
data/test/test_helper.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Configure Rails Environment
|
2
|
-
ENV[
|
2
|
+
ENV['RAILS_ENV'] = 'test'
|
3
3
|
|
4
|
-
require File.expand_path(
|
5
|
-
require
|
4
|
+
require File.expand_path('../dummy/config/environment.rb', __FILE__)
|
5
|
+
require 'rails/test_help'
|
6
6
|
|
7
7
|
Rails.backtrace_cleaner.remove_silencers!
|
8
8
|
|
@@ -11,5 +11,5 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
|
11
11
|
|
12
12
|
# Load fixtures from the engine
|
13
13
|
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
14
|
-
ActiveSupport::TestCase.fixture_path = File.expand_path(
|
14
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path('../fixtures', __FILE__)
|
15
15
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_doc_viewer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Endri Gjiri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05
|
11
|
+
date: 2014-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|