scout-camp 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b22b7fc83e0cee051edf923ffd40bfaa3759f78eb59d80c7abb0b120be250682
4
- data.tar.gz: aa35cfafdb9ac3aeee81b247c1f81e1ab3bfb638b51c08108eb88e23940254f2
3
+ metadata.gz: 91e19b9f83e8b15a04642fa32d87a0af095b382a9698c169c454edffda2cdc1f
4
+ data.tar.gz: 92f2e5d29ed614db92ed7bfe3cdb25a55f2d64b2c8ab91bc12dda8939dfb76db
5
5
  SHA512:
6
- metadata.gz: 7c48331d38a61928b7de2aa8c94d04a6feaf11e60bedcac7bde2be0ecb242a78f622b519ee7dccc2faefa42d721ed58fd22a3ce58202641ce92c67c2b3d90988
7
- data.tar.gz: c6ede844ae01c2acffe2150b88b2ab1b674fe2e3937161da471a0a03be710d3cbf728a2a353be840f5ef1a3cdab20a1660d41bd579cbc4dc30b6281b890a8e93
6
+ metadata.gz: 4dab11e3e250669b167f0f8f49e16fba9b8b55b66a4b6254f1815d4e04282e257442e25e72368616a33ac9a2bfcf471b32466d01833de94328cd2138ad7522c3
7
+ data.tar.gz: f3c21f33ee76f8fc8a90d231e46a620262647eac1941d34adf3aba3fc4100d2f77d3b390a339ed43e379cb95fd3378fd7d25df891e9f4799221f4f97aac75995
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
data/bin/scout-camp CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ $LOAD_PATH.unshift File.join(__dir__, '../lib')
4
+
3
5
  require 'scout-camp'
4
6
 
5
7
  load Scout.bin.scout.find
data/lib/scout/aws/s3.rb CHANGED
@@ -9,6 +9,10 @@ module Open
9
9
  module S3
10
10
  extend Hook
11
11
 
12
+ def self.lock(*args, &block)
13
+ yield nil
14
+ end
15
+
12
16
  def self.is_s3?(uri)
13
17
  uri.start_with? 's3://'
14
18
  end
data/scout-camp.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: scout-camp 0.1.2 ruby lib
5
+ # stub: scout-camp 0.1.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "scout-camp".freeze
9
- s.version = "0.1.2".freeze
9
+ s.version = "0.1.3".freeze
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Miguel Vazquez".freeze]
14
- s.date = "2025-03-19"
14
+ s.date = "2025-03-25"
15
15
  s.description = "Functionalities to deploy and use scouts in remote servers like AWS".freeze
16
16
  s.email = "mikisvaz@gmail.com".freeze
17
17
  s.executables = ["scout-camp".freeze]
@@ -12,6 +12,8 @@ $ #{$0} [<options>] <name>
12
12
 
13
13
  -h--help Print this help
14
14
  -w--workflows* Workflows to provision
15
+ -w--dependencies* Workflows to provision
16
+ -b--bucket* Bucket to connect
15
17
  EOF
16
18
  if options[:help]
17
19
  if defined? scout_usage
@@ -29,19 +31,27 @@ deployments = Scout.var.deployments.glob_all("*").collect(&:basename)
29
31
  raise "Deployment clash" if deployments.include? name
30
32
  dir = Scout.var.deployments[name]
31
33
 
32
- IndiferentHash.add_defaults options, workflows: '', dependencies: 'scout-gear'
34
+ IndiferentHash.add_defaults options, workflows: '', dependencies: 'scout-gear,scout-camp', bucket: 'scout.var'
33
35
 
34
36
  workflows = options[:workflows].split(",")
35
37
  dependencies = options[:dependencies].split(",")
36
38
 
37
- code =<<-EOF
39
+ code =<<-'EOF'
38
40
  def lambda_handler(event:, context:)
41
+ require 'scout'
42
+ Path.path_maps[:bucket] = "s3://#{ENV["AWS_BUCKET"]}/{TOPLEVEL}/{SUBPATH}"
43
+ Path.path_maps[:default] = :bucket
44
+
39
45
  require 'scout/workflow'
46
+ require 'scout/aws/s3'
47
+
48
+ workflow, task_name, jobname, inputs = IndiferentHash.process_options event,
49
+ :workflow, :task_name, :jobname, :inputs
40
50
 
41
- wf = Workflow.require_workflow event["workflow"]
42
- job = wf.job(event["task_name"], event["jobname"], event["inputs"])
43
- id = job.short_path
44
- id
51
+ wf = Workflow.require_workflow workflow
52
+
53
+ job = wf.job(task_name, jobname, inputs)
54
+ job.run
45
55
  end
46
56
  EOF
47
57
 
@@ -71,8 +81,13 @@ lambda_package dependencies, workflows, code do |file|
71
81
  terraform = TerraformDSL.new
72
82
  filename = 'lambda_package.zip'
73
83
  Open.cp file, dir[filename]
74
- terraform.add :aws, :lambda, function_name: "ScoutJob", filename: filename, environment_variables: {HOME: '.'}
75
- terraform.config dir
76
- end
77
84
 
85
+ terraform.add :aws, :lambda, function_name: "#{name}Job", filename: filename,
86
+ environment_variables: {
87
+ HOME: '.',
88
+ HOSTNAME: "aws_lambda",
89
+ AWS_BUCKET: options[:bucket],
90
+ }
78
91
 
92
+ terraform.config dir
93
+ end
@@ -1,8 +1,4 @@
1
- provider "aws" {
2
- region = "eu-west-2" # Change to your preferred AWS region
3
- }
4
-
5
1
  resource "aws_s3_bucket" "this" {
6
- bucket = var.name # Change to a globally unique name
2
+ bucket = var.bucket_name # Change to a globally unique name
7
3
  }
8
4
 
@@ -1,3 +1,3 @@
1
- output "bucket_name" {
2
- value = aws_s3_bucket.my_bucket.id
1
+ output "bucket_id" {
2
+ value = aws_s3_bucket.this.id
3
3
  }
@@ -1,4 +1,4 @@
1
- variable "name" {
1
+ variable "bucket_name" {
2
2
  description = "Bucket name"
3
3
  type = string
4
4
  }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout-camp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-19 00:00:00.000000000 Z
10
+ date: 2025-03-25 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: scout-essentials