Added ruby tests
This commit is contained in:
parent
8488897583
commit
c070967901
|
@ -26,7 +26,7 @@ return [
|
|||
'name' => 'Ruby',
|
||||
'version' => '2.7',
|
||||
'base' => 'ruby:2.7-alpine',
|
||||
'image' => 'appwrite/env-ruby-2.7:1.0.0',
|
||||
'image' => 'appwrite/env-ruby-2.7:1.0.2',
|
||||
'logo' => 'ruby.png',
|
||||
],
|
||||
'python-3.8' => [
|
||||
|
|
|
@ -19,4 +19,4 @@ echo 'Python 3.8...'
|
|||
docker buildx build --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le -t appwrite/env-python-3.8:1.0.0 ./docker/environments/python-3.8/ --push
|
||||
|
||||
echo 'Ruby 2.7...'
|
||||
docker buildx build --platform linux/amd64,linux/arm64,linux/386,linux/ppc64le -t appwrite/env-ruby-2.7:1.0.0 ./docker/environments/ruby-2.7/ --push
|
||||
docker buildx build --platform linux/amd64,linux/arm64,linux/386,linux/ppc64le -t appwrite/env-ruby-2.7:1.0.2 ./docker/environments/ruby-2.7/ --push
|
||||
|
|
|
@ -8,5 +8,5 @@ RUN mkdir /usr/local/src
|
|||
|
||||
WORKDIR /usr/local/src/
|
||||
|
||||
ENV GEM_PATH=/usr/local/src/.appwrite/2.1.0
|
||||
ENV GEM_PATH=/usr/local/src/.appwrite
|
||||
ENV GEM_SPEC_CACHE=/usr/local/src/.appwrite/specs
|
12
tests/resources/functions/package-ruby.sh
Normal file
12
tests/resources/functions/package-ruby.sh
Normal file
|
@ -0,0 +1,12 @@
|
|||
|
||||
echo 'Ruby Packaging...'
|
||||
|
||||
cp -r $(pwd)/tests/resources/functions/ruby $(pwd)/tests/resources/functions/packages/ruby
|
||||
|
||||
docker run --rm -v $(pwd)/tests/resources/functions/packages/ruby:/app -w /app --env GEM_HOME=./.appwrite appwrite/env-ruby-2.7:1.0.2 bundle install
|
||||
|
||||
docker run --rm -v $(pwd)/tests/resources/functions/packages/ruby:/app -w /app appwrite/env-ruby-2.7:1.0.2 tar -zcvf code.tar.gz .
|
||||
|
||||
mv $(pwd)/tests/resources/functions/packages/ruby/code.tar.gz $(pwd)/tests/resources/functions/ruby.tar.gz
|
||||
|
||||
rm -r $(pwd)/tests/resources/functions/packages/ruby
|
Binary file not shown.
BIN
tests/resources/functions/ruby.tar.gz
Normal file
BIN
tests/resources/functions/ruby.tar.gz
Normal file
Binary file not shown.
5
tests/resources/functions/ruby/Gemfile
Normal file
5
tests/resources/functions/ruby/Gemfile
Normal file
|
@ -0,0 +1,5 @@
|
|||
source "https://rubygems.org"
|
||||
|
||||
ruby "~> 2.7.0"
|
||||
|
||||
gem 'appwrite', '~> 1.0', '>= 1.0.11'
|
16
tests/resources/functions/ruby/Gemfile.lock
Normal file
16
tests/resources/functions/ruby/Gemfile.lock
Normal file
|
@ -0,0 +1,16 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
appwrite (1.0.11)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
appwrite (~> 1.0, >= 1.0.11)
|
||||
|
||||
RUBY VERSION
|
||||
ruby 2.7.2p137
|
||||
|
||||
BUNDLED WITH
|
||||
2.1.4
|
23
tests/resources/functions/ruby/app.rb
Normal file
23
tests/resources/functions/ruby/app.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
require 'appwrite'
|
||||
|
||||
client = Appwrite::Client.new()
|
||||
|
||||
client
|
||||
.set_endpoint(ENV["APPWRITE_ENDPOINT"]) # Your API Endpoint
|
||||
.set_project(ENV["APPWRITE_PROJECT"]) # Your project ID
|
||||
.set_key(ENV["APPWRITE_SECRET"]) # Your secret API key
|
||||
;
|
||||
|
||||
storage = Appwrite::Storage.new(client);
|
||||
|
||||
# result = storage.get_file(ENV["APPWRITE_FILEID"]);
|
||||
|
||||
puts ENV["APPWRITE_FUNCTION_ID"]
|
||||
puts ENV["APPWRITE_FUNCTION_NAME"]
|
||||
puts ENV["APPWRITE_FUNCTION_TAG"]
|
||||
puts ENV["APPWRITE_FUNCTION_TRIGGER"]
|
||||
puts ENV["APPWRITE_FUNCTION_ENV_NAME"]
|
||||
puts ENV["APPWRITE_FUNCTION_ENV_VERSION"]
|
||||
# puts result["$id"]
|
||||
puts ENV["APPWRITE_FUNCTION_EVENT"]
|
||||
puts ENV["APPWRITE_FUNCTION_EVENT_PAYLOAD"]
|
Loading…
Reference in a new issue