Skip to content

Commit ae42f42

Browse files
committed
Removed route and general_api template
1 parent 2471186 commit ae42f42

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2013 Aleksandr Ivanov
1+
Copyright (c) 2013 Aleksandr B. Ivanov
22

33
MIT License
44

lib/generators/grape_swagger/install/install_generator.rb

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,24 @@ def self.source_root
99
end
1010

1111
def install
12-
Zip::ZipFile.foreach(open('https://github.com/wordnik/swagger-ui/archive/master.zip')) do |zip_entry|
13-
zip_entry.extract(zip_entry.to_s.gsub('swagger-ui-master/dist/', 'public/apidoc/')) if zip_entry.to_s =~ /\/dist\//
12+
install_path = 'apidoc'
13+
swagger_ui_repo = 'https://github.com/wordnik/swagger-ui/'
14+
api_path = 'api'
15+
16+
Zip::ZipFile.foreach(open("#{swagger_ui_repo}/archive/master.zip")) do |zip_entry|
17+
zip_entry.extract(zip_entry.to_s.gsub('swagger-ui-master/dist/', "public/#{install_path}/")) if zip_entry.to_s =~ /\/dist\//
1418
end
1519

16-
file_name = 'public/apidoc/index.html'
20+
file_name = "public/#{install_path}/index.html"
1721
text = File.read(file_name)
18-
new_text = text.gsub('css/', '/apidoc/css/').gsub('lib/', '/apidoc/lib/').gsub('swagger-ui.js', '/apidoc/swagger-ui.js').gsub('images/', '/apidoc/images/').gsub('supportHeaderParams: false', 'supportHeaderParams: true').gsub('http://petstore.swagger.wordnik.com/api/api-docs.json', '/api/swagger_doc.json')
22+
new_text = text.
23+
gsub('css/', "/#{install_path}/css/").
24+
gsub('lib/', "/#{install_path}/lib/").
25+
gsub('swagger-ui.js', "/#{install_path}/swagger-ui.js").
26+
gsub('images/', "/#{install_path}/images/").
27+
gsub('supportHeaderParams: false', 'supportHeaderParams: true').
28+
gsub('http://petstore.swagger.wordnik.com/api/api-docs.json', "/#{api_path}/swagger_doc.json")
1929
File.open(file_name, 'w') { |file| file.puts new_text }
20-
21-
template 'general_api.rb', 'app/api/general_api.rb'
22-
23-
route "mount GeneralAPI => '/'"
2430
end
2531
end
2632
end

lib/generators/grape_swagger/install/templates/general_api.rb

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)