Skip to content

Commit

Permalink
update client generation
Browse files Browse the repository at this point in the history
  • Loading branch information
wr0ngway committed Nov 30, 2021
1 parent 82ebf82 commit 29b9ab7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6,280 deletions.
14 changes: 10 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ end

task :console do
local = get_var(:local, prompt: false, required: false, default: false)
image_name = get_var(:image_name, default: "#{APP[:name]}", prompt: false, required: false)

if local
$LOAD_PATH.unshift File.expand_path("lib", __dir__)
require "bundler/setup"
Expand All @@ -229,25 +231,29 @@ task :console do
Pry.start
else
Rake::Task["build_development"].invoke
sh "docker run -it kubetruth:development console"
sh "docker run -it #{image_name}:development console"
end
end

file "#{CLIENT_DIR}/Gemfile" => "openapi.yml" do
file "#{CLIENT_DIR}/openapi.yml" do
mkdir_p "client"
File.write("#{CLIENT_DIR}/openapi.yml", URI.parse("https://api.cloudtruth.io/api/schema/").read)
end

file "#{CLIENT_DIR}/Gemfile" => "#{CLIENT_DIR}/openapi.yml" do

if ENV['MINIKUBE_ACTIVE_DOCKERD']
puts "Cannot generate the rest client in the minikube docker environment"
puts "Run in a shell without 'eval $(minikube docker-env)'"
exit 1
end

rm_rf "client"
# may need --user #{Process.uid}:#{Process.gid} for some Hosts
sh *%W[
docker run --rm
-v #{Dir.pwd}:/data
openapitools/openapi-generator-cli generate
-i /data/openapi.yml
-i /data/client/openapi.yml
-g ruby
-o /data/client
--library faraday
Expand Down
Loading

0 comments on commit 29b9ab7

Please sign in to comment.