Skip to content

🎥 Make videos programmatically with React

scaffold

Jonny Burger40f4a5ef5ef5
diff --git a/packages/lambda-ruby/lib/sdk.rb b/packages/lambda-ruby/lib/sdk.rb
new file mode 100644
index 0000000000..8ec00481f5
--- /dev/null
+++ b/packages/lambda-ruby/lib/sdk.rb
@@ -0,0 +1,64 @@
+require 'aws-sdk-s3'
+require 'aws-sdk-lambda'
+require 'json'
+require 'logger'
+require_relative 'version'
+
+module RemotionLambda
+ class Client
+ attr_reader :bucket_name, :function_name, :serve_url
+
+ def initialize(
+ function_name:,
+ serve_url:,
+ region: ENV.fetch('AWS_REGION', ''),
+ aws_profile: ENV.fetch('AWS_PROFILE', 'default')
+ )
+ @region = region
+ @aws_profile = aws_profile
+ @function_name = function_name
+ @serve_url = serve_url
+ @lambda_client = create_lambda_client
+ end
+
+ # Lambda methods
+ def invoke(payload, function_name: @function_name)
+ response = @lambda_client.invoke({
+ function_name: function_name,
+ payload: JSON.generate(payload)
+ })
+
+ JSON.parse(response.payload.string)
+ rescue Aws::Lambda::Errors::ServiceError => e
+ raise Remotion::Error, "Lambda invocation failed: #{e.message}"
+ end
+
+ def get_render_progress(render_id, bucket_name)
+ payload = {
+ "type" => "status",
+ "renderId" => render_id,
+ "bucketName" => bucket_name,
+ "version" => VERSION,
+ }
+
+ body = invoke(payload)
+ raise "Failed to fetch progress: #{body['message']}" if body["type"] == "error"
+
+ body
+ end
+
+ def get_render_progress
+
+ def create_lambda_client
+ Aws::Lambda::Client.new(region: @region, credentials: aws_credentials)
+ end
+
+ def aws_credentials
+ if @aws_profile
+ Aws::SharedCredentials.new(profile_name: @aws_profile)
+ else
+ Aws::Credentials.new(ENV['AWS_ACCESS_KEY'], ENV['AWS_SECRET_KEY'])
+ end
+ end
+ end
+end
diff --git a/packages/lambda-ruby/lib/version.rb b/packages/lambda-ruby/lib/version.rb
new file mode 100644
index 0000000000..61644d9a82
--- /dev/null
+++ b/packages/lambda-ruby/lib/version.rb
@@ -0,0 +1 @@
+VERSION = "4.0.222"
diff --git a/packages/lambda-ruby/package.json b/packages/lambda-ruby/package.json
new file mode 100644
index 0000000000..7509c027c0
--- /dev/null
+++ b/packages/lambda-ruby/package.json
@@ -0,0 +1,15 @@
+{
+ "repository": {
+ "url": "https://github.com/remotion-dev/remotion/tree/main/packages/lambda-ruby"
+ },
+ "name": "@remotion/lambda-ruby",
+ "private": true,
+ "version": "4.0.231",
+ "scripts": {
+ "publishprivate": "bun publish.ts"
+ },
+ "devDependencies": {
+ "remotion": "workspace:*"
+ },
+ "dependencies": {}
+}
diff --git a/packages/lambda-ruby/publish.ts b/packages/lambda-ruby/publish.ts
new file mode 100644
index 0000000000..7645751747
--- /dev/null
+++ b/packages/lambda-ruby/publish.ts
@@ -0,0 +1,57 @@
+import {execSync} from 'node:child_process';
+import {cpSync, existsSync, mkdirSync, rmSync, writeFileSync} from 'node:fs';
+import {tmpdir} from 'node:os';
+import path from 'node:path';
+import {VERSION} from 'remotion/version';
+
+const tmpDir = tmpdir();
+
+const workingDir = path.join(tmpDir, `lambda-ruby-sdk-${Math.random()}`);
+if (existsSync(workingDir)) {
+ rmSync(workingDir, {recursive: true});
+}
+mkdirSync(workingDir);
+
+execSync('gem signin', {stdio: 'inherit'});
+
+execSync(
+ `git clone [email protected]:remotion-dev/lambda-ruby-sdk.git ${workingDir}`,
+ {
+ cwd: tmpDir,
+ },
+);
+
+cpSync('lib', path.join(workingDir, 'lib'), {recursive: true});
+cpSync(
+ 'remotion_lambda.gemspec',
+ path.join(workingDir, 'remotion_lambda.gemspec'),
+ {recursive: true},
+);
+writeFileSync(
+ path.join(workingDir, 'README.md'),
+ [
+ '# Remotion Lambda Ruby SDK',
+ 'Do not open issues or pull requests here. ',
+ 'The actual source code is located in the [Remotion repository](https://remotion.dev/github). ',
+ 'This repository is automatically updated when a new version of Remotion is released.',
+ '',
+ '## Installation',
+ 'Visit https://www.remotion.dev/docs/lambda/ruby to learn how to install the Remotion Lambda Ruby SDK.',
+ ].join('\n'),
+);
+execSync('git add .', {cwd: workingDir, stdio: 'inherit'});
+execSync(`git commit --allow-empty -m 'Release ${VERSION}'`, {
+ cwd: workingDir,
+ stdio: 'inherit',
+});
+try {
+ execSync(`git tag ${VERSION}`, {cwd: workingDir, stdio: 'inherit'});
+} catch (e) {}
+execSync('git push', {cwd: workingDir, stdio: 'inherit'});
+execSync(`git push origin ${VERSION}`, {cwd: workingDir, stdio: 'inherit'});
+execSync('git push --tags', {cwd: workingDir, stdio: 'inherit'});
+execSync('gem build remotion_lambda.gemspec', {
+ cwd: workingDir,
+ stdio: 'inherit',
+});
+execSync('gem push remotion_lambda-*.gem', {cwd: workingDir, stdio: 'inherit'});
diff --git a/packages/lambda-ruby/remotion_lambda.gemspec b/packages/lambda-ruby/remotion_lambda.gemspec
new file mode 100644
index 0000000000..ab578931ec
--- /dev/null
+++ b/packages/lambda-ruby/remotion_lambda.gemspec
@@ -0,0 +1,12 @@
+Gem::Specification.new do |s|
+ s.name = "remotion_lambda"
+ s.version = "0.0.1"
+ s.summary = "Remotion Lambda SDK"
+ s.description = "A Ruby SDK for Remotion Lambda"
+ s.authors = ["Jonny Burger"]
+ s.email = "[email protected]"
+ s.files = ["lib/sdk.rb"]
+ s.homepage =
+ "https://rubygems.org/gems/remotion_lambda"
+ s.license = "MIT"
+end
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 887619a04f..0fd55b9d4f 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1398,6 +1398,12 @@ importers:
specifier: workspace:*
version: link:../core
+ packages/lambda-ruby:
+ devDependencies:
+ remotion:
+ specifier: workspace:*
+ version: link:../core
+
packages/layout-utils:
devDependencies:
'@remotion/eslint-config-internal':