mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Updated to api version 0.1.30
This commit is contained in:
@@ -9,6 +9,7 @@ require_relative 'utils.rb'
|
|||||||
swaggerUrl = "https://raw.githubusercontent.com/treeder/functions/master/docs/swagger.yml"
|
swaggerUrl = "https://raw.githubusercontent.com/treeder/functions/master/docs/swagger.yml"
|
||||||
spec = YAML.load(open(swaggerUrl))
|
spec = YAML.load(open(swaggerUrl))
|
||||||
version = spec['info']['version']
|
version = spec['info']['version']
|
||||||
|
version = '0.1.30'
|
||||||
puts "VERSION: #{version}"
|
puts "VERSION: #{version}"
|
||||||
|
|
||||||
# Can pass in a particular language to only do that one
|
# Can pass in a particular language to only do that one
|
||||||
@@ -21,9 +22,9 @@ ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
|||||||
|
|
||||||
def clone(lang)
|
def clone(lang)
|
||||||
Dir.chdir 'tmp'
|
Dir.chdir 'tmp'
|
||||||
ldir = "functions_#{lang}"
|
ldir = "fn_#{lang}"
|
||||||
if !Dir.exist? ldir
|
if !Dir.exist? ldir
|
||||||
cmd = "git clone https://github.com/treeder/#{ldir}"
|
cmd = "git clone https://github.com/fnproject/#{ldir}"
|
||||||
stream_exec(cmd)
|
stream_exec(cmd)
|
||||||
else
|
else
|
||||||
Dir.chdir ldir
|
Dir.chdir ldir
|
||||||
@@ -36,10 +37,11 @@ end
|
|||||||
|
|
||||||
FileUtils.mkdir_p 'tmp'
|
FileUtils.mkdir_p 'tmp'
|
||||||
languages = nil
|
languages = nil
|
||||||
|
# See all supported langauges here: https://generator.swagger.io/api/gen/clients
|
||||||
if only
|
if only
|
||||||
languages = [only]
|
languages = [only]
|
||||||
else
|
else
|
||||||
languages = JSON.parse(HTTP.get("https://generator.swagger.io/api/gen/clients", ssl_context: ctx).body)
|
languages = ['go', 'ruby', 'php', 'python', 'elixir', 'javascript'] # JSON.parse(HTTP.get("https://generator.swagger.io/api/gen/clients", ssl_context: ctx).body)
|
||||||
end
|
end
|
||||||
languages.each do |l|
|
languages.each do |l|
|
||||||
puts l
|
puts l
|
||||||
@@ -61,27 +63,24 @@ languages.each do |l|
|
|||||||
options['packageVersion'] = version
|
options['packageVersion'] = version
|
||||||
when 'ruby'
|
when 'ruby'
|
||||||
clone(l)
|
clone(l)
|
||||||
fruby = "functions_ruby"
|
fruby = "fn_ruby"
|
||||||
gem_name = "oracle_functions"
|
gem_name = "fn_ruby"
|
||||||
glob_pattern = ["**", "*.rb"] # just rb files
|
glob_pattern = ["**", "*.rb"] # just rb files
|
||||||
skip_files = ["#{gem_name}.gemspec"]
|
skip_files = [] # ["#{gem_name}.gemspec"]
|
||||||
deploy = ["gem build #{gem_name}.gemspec", "gem push #{gem_name}-#{version}.gem"]
|
deploy = ["gem build #{gem_name}.gemspec", "gem push #{gem_name}-#{version}.gem"]
|
||||||
options['gemName'] = gem_name
|
options['gemName'] = gem_name
|
||||||
options['moduleName'] = "OracleFunctions"
|
options['moduleName'] = "Fn"
|
||||||
options['gemVersion'] = version
|
options['gemVersion'] = version
|
||||||
options['gemHomepage'] = "https://github.com/treeder/#{fruby}"
|
options['gemHomepage'] = "https://github.com/fnproject/#{fruby}"
|
||||||
options['gemSummary'] = 'Ruby gem for Oracle Functions'
|
options['gemSummary'] = 'Ruby gem for Fn Project'
|
||||||
options['gemDescription'] = 'Ruby gem for Oracle Functions.'
|
options['gemDescription'] = 'Ruby gem for Fn Project.'
|
||||||
options['gemAuthorEmail'] = 'treeder@gmail.com'
|
options['gemAuthorEmail'] = 'treeder@gmail.com'
|
||||||
when 'javascript'
|
when 'javascript'
|
||||||
lshort = 'js'
|
lshort = 'js'
|
||||||
# copy_dir = "javascript-client/."
|
# copy_dir = "javascript-client/."
|
||||||
clone(lshort)
|
clone(lshort)
|
||||||
options['projectName'] = "oracle_functions"
|
options['projectName'] = "fn_js"
|
||||||
deploy << "npm publish"
|
deploy << "npm publish"
|
||||||
else
|
|
||||||
puts "Skipping #{l}"
|
|
||||||
next
|
|
||||||
end
|
end
|
||||||
p options
|
p options
|
||||||
if l == 'go'
|
if l == 'go'
|
||||||
@@ -89,6 +88,13 @@ languages.each do |l|
|
|||||||
# This is using https://goswagger.io/ instead
|
# This is using https://goswagger.io/ instead
|
||||||
# TODO: run this build command instead: this works if run manually
|
# TODO: run this build command instead: this works if run manually
|
||||||
# dep ensure && docker run --rm -it -v $HOME/dev/go:/go -w /go/src/github.com/treeder/functions_go quay.io/goswagger/swagger generate client -f https://raw.githubusercontent.com/treeder/functions/master/docs/swagger.yml -A functions
|
# dep ensure && docker run --rm -it -v $HOME/dev/go:/go -w /go/src/github.com/treeder/functions_go quay.io/goswagger/swagger generate client -f https://raw.githubusercontent.com/treeder/functions/master/docs/swagger.yml -A functions
|
||||||
|
# cmd := exec.Command("docker", "run", "--rm", "-u", fmt.Sprintf("%s:%s", u.Uid, u.Gid), "-v", fmt.Sprintf("%s/%s:/go/src/github.com/funcy/functions_go", cwd, target), "-v", fmt.Sprintf("%s/%s:/go/swagger.spec", cwd, swaggerURL), "-w", "/go/src", "quay.io/goswagger/swagger", "generate", "client", "-f", "/go/swagger.spec", "-t", "github.com/funcy/functions_go", "-A", "functions")
|
||||||
|
# d, err := cmd.CombinedOutput()
|
||||||
|
# if err != nil {
|
||||||
|
# log.Printf("Error running go-swagger: %s\n", d)
|
||||||
|
# return err
|
||||||
|
# }
|
||||||
|
next
|
||||||
else
|
else
|
||||||
gen = JSON.parse(HTTP.post("https://generator.swagger.io/api/gen/clients/#{l}",
|
gen = JSON.parse(HTTP.post("https://generator.swagger.io/api/gen/clients/#{l}",
|
||||||
json: {
|
json: {
|
||||||
@@ -117,7 +123,7 @@ languages.each do |l|
|
|||||||
fj = File.join(['tmp', lv, "#{l}-client"] + glob_pattern)
|
fj = File.join(['tmp', lv, "#{l}-client"] + glob_pattern)
|
||||||
# FileUtils.mkdir_p "tmp/#{l}-copy"
|
# FileUtils.mkdir_p "tmp/#{l}-copy"
|
||||||
# FileUtils.cp_r(Dir.glob(fj), "tmp/#{l}-copy")
|
# FileUtils.cp_r(Dir.glob(fj), "tmp/#{l}-copy")
|
||||||
destdir = "tmp/functions_#{lshort}"
|
destdir = "tmp/fn_#{lshort}"
|
||||||
puts "Trying cp", "tmp/#{lv}/#{l}-client/#{copy_dir}", destdir
|
puts "Trying cp", "tmp/#{lv}/#{l}-client/#{copy_dir}", destdir
|
||||||
FileUtils.cp_r("tmp/#{lv}/#{l}-client/#{copy_dir}", destdir)
|
FileUtils.cp_r("tmp/#{lv}/#{l}-client/#{copy_dir}", destdir)
|
||||||
# Write a version file, this ensures there's always a change.
|
# Write a version file, this ensures there's always a change.
|
||||||
@@ -125,7 +131,7 @@ languages.each do |l|
|
|||||||
|
|
||||||
# Commit and push
|
# Commit and push
|
||||||
begin
|
begin
|
||||||
Dir.chdir("tmp/functions_#{lshort}")
|
Dir.chdir("tmp/fn_#{lshort}")
|
||||||
stream_exec "git add ."
|
stream_exec "git add ."
|
||||||
stream_exec "git commit -am \"Updated to api version #{version}\""
|
stream_exec "git commit -am \"Updated to api version #{version}\""
|
||||||
begin
|
begin
|
||||||
@@ -153,5 +159,3 @@ end
|
|||||||
# Uncomment the following lines if we start using the Go lib
|
# Uncomment the following lines if we start using the Go lib
|
||||||
# Dir.chdir("../")
|
# Dir.chdir("../")
|
||||||
# stream_exec "glide up"
|
# stream_exec "glide up"
|
||||||
Dir.chdir("../tests/")
|
|
||||||
stream_exec "bundle update"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user