File tree Expand file tree Collapse file tree 4 files changed +8
-8
lines changed
Expand file tree Collapse file tree 4 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 1- load File . expand_path ( "../ tasks/rswag.rake" , __FILE__ )
1+ load File . expand_path ( "tasks/rswag.rake" , __dir__ )
Original file line number Diff line number Diff line change 22
33module RswagSchemaExport
44 class Import
5- def run
5+ def run ( stage = "develop" )
66 abort ( "RSWAG_SCHEMA_PATH is not defined. Example: tmp/swagger/swagger.json" ) unless ENV [ "RSWAG_SCHEMA_PATH" ]
77 abort ( "RSWAG_ACCESS_KEY_ID is not defined" ) unless ENV [ "RSWAG_ACCESS_KEY_ID" ]
88 abort ( "RSWAG_SECRET_ACCESS_KEY is not defined" ) unless ENV [ "RSWAG_SECRET_ACCESS_KEY" ]
99 abort ( "RSWAG_REGION is not defined" ) unless ENV [ "RSWAG_REGION" ]
1010 abort ( "RSWAG_BUCKET is not defined" ) unless ENV [ "RSWAG_BUCKET" ]
11-
12- stage = ENV [ "STAGE" ] || "develop"
1311 app_name = ENV [ "APP_NAME" ] || "app"
1412
1513 begin
@@ -22,7 +20,8 @@ def run
2220 versions = bucket . objects ( prefix : "schemas/#{ app_name } /#{ stage } _schemas/versions" ) . collect ( &:key )
2321
2422 last_schema_key = versions . max
25- bucket . object ( last_schema_key ) . copy_to ( "#{ ENV [ 'RSWAG_BUCKET' ] } /schemas/#{ app_name } /#{ stage } _schemas/schema.json" )
23+ bucket . object ( last_schema_key )
24+ . copy_to ( "#{ ENV [ 'RSWAG_BUCKET' ] } /schemas/#{ app_name } /#{ stage } _schemas/schema.json" )
2625 # Download schema.json
2726 if block_given?
2827 bucket . object ( "schemas/#{ app_name } /#{ stage } _schemas/schema.json" ) . download_file ( "schema.json" )
Original file line number Diff line number Diff line change 1- require ' rswag_schema_export/schema_import'
1+ require " rswag_schema_export/schema_import"
22
33namespace :rswag do
44 desc "Import latest schema.json to app"
55 task :schema_import do
66 on roles ( :all ) do
7- RswagSchemaExport ::Import . new . run do
7+ stage = ENV [ "STAGE" ] || fetch ( :stage , "develop" )
8+ RswagSchemaExport ::Import . new . run ( stage ) do
89 upload! ( "schema.json" , "#{ current_path } /#{ ENV [ 'RSWAG_SCHEMA_PATH' ] } " )
910 end
1011 end
Original file line number Diff line number Diff line change 11module RswagSchemaExport
2- VERSION = "0.1.0 " . freeze
2+ VERSION = "0.1.1 " . freeze
33end
You can’t perform that action at this time.
0 commit comments