scout-camp 0.1.1 → 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: 6f890271ab935a22aef0383dbb515abf6198f4e91d965055655c862066a09f5a
4
- data.tar.gz: 04bf98b46eefc8e63a7b1ef158797f01ecb8aa3db24a92d42721eec2df2cefa5
3
+ metadata.gz: 91e19b9f83e8b15a04642fa32d87a0af095b382a9698c169c454edffda2cdc1f
4
+ data.tar.gz: 92f2e5d29ed614db92ed7bfe3cdb25a55f2d64b2c8ab91bc12dda8939dfb76db
5
5
  SHA512:
6
- metadata.gz: 6e8bb582fc33d1facaccb53f6e3d762f77a7dc41366a46bb032f65edb73bd976f9c0edf69fee313764e295417ad324c136366c49e5bcee0d0f927f4de7397dd2
7
- data.tar.gz: 7245f12146cadce9940e2d59d0cef3b6843ef0139cada356995236c39bf75b104888f9192fca247c98775cd2b3235e51bc7c661f502f9914fdb7c0998752a6fd
6
+ metadata.gz: 4dab11e3e250669b167f0f8f49e16fba9b8b55b66a4b6254f1815d4e04282e257442e25e72368616a33ac9a2bfcf471b32466d01833de94328cd2138ad7522c3
7
+ data.tar.gz: f3c21f33ee76f8fc8a90d231e46a620262647eac1941d34adf3aba3fc4100d2f77d3b390a339ed43e379cb95fd3378fd7d25df891e9f4799221f4f97aac75995
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
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
@@ -129,6 +133,11 @@ module Open
129
133
 
130
134
  self.singleton_class.alias_method :exist?, :exists?
131
135
 
136
+
137
+ def self.sensible_write(path, content = nil, options = {}, &block)
138
+ Open::S3.write(path, content)
139
+ end
140
+
132
141
  end
133
142
  end
134
143
 
@@ -0,0 +1,77 @@
1
+ # Generated by juwelier
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+ # stub: scout-camp 0.1.3 ruby lib
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "scout-camp".freeze
9
+ s.version = "0.1.3".freeze
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib".freeze]
13
+ s.authors = ["Miguel Vazquez".freeze]
14
+ s.date = "2025-03-25"
15
+ s.description = "Functionalities to deploy and use scouts in remote servers like AWS".freeze
16
+ s.email = "mikisvaz@gmail.com".freeze
17
+ s.executables = ["scout-camp".freeze]
18
+ s.extra_rdoc_files = [
19
+ "LICENSE",
20
+ "README.md"
21
+ ]
22
+ s.files = [
23
+ ".vimproject",
24
+ "LICENSE",
25
+ "README.md",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "bin/scout-camp",
29
+ "lib/scout-camp.rb",
30
+ "lib/scout/aws/s3.rb",
31
+ "lib/scout/offsite.rb",
32
+ "lib/scout/offsite/exceptions.rb",
33
+ "lib/scout/offsite/ssh.rb",
34
+ "lib/scout/offsite/step.rb",
35
+ "lib/scout/offsite/sync.rb",
36
+ "lib/scout/terraform_dsl.rb",
37
+ "lib/scout/terraform_dsl/deployment.rb",
38
+ "lib/scout/terraform_dsl/util.rb",
39
+ "scout-camp.gemspec",
40
+ "scout_commands/offsite",
41
+ "scout_commands/terraform/add",
42
+ "scout_commands/terraform/apply",
43
+ "scout_commands/terraform/destroy",
44
+ "scout_commands/terraform/list",
45
+ "scout_commands/terraform/remove",
46
+ "scout_commands/terraform/status",
47
+ "share/terraform/aws/bucket/main.tf",
48
+ "share/terraform/aws/bucket/output.tf",
49
+ "share/terraform/aws/bucket/variables.tf",
50
+ "share/terraform/aws/cluster/main.tf",
51
+ "share/terraform/aws/cluster/output.tf",
52
+ "share/terraform/aws/cluster/variables.tf",
53
+ "share/terraform/aws/host/locals.tf",
54
+ "share/terraform/aws/host/main.tf",
55
+ "share/terraform/aws/host/output.tf",
56
+ "share/terraform/aws/host/variables.tf",
57
+ "share/terraform/aws/lambda/main.tf",
58
+ "share/terraform/aws/lambda/variables.tf",
59
+ "share/terraform/aws/provider/data.tf",
60
+ "share/terraform/aws/provider/output.tf",
61
+ "test/scout/aws/test_s3.rb",
62
+ "test/scout/offsite/test_ssh.rb",
63
+ "test/scout/offsite/test_step.rb",
64
+ "test/scout/offsite/test_sync.rb",
65
+ "test/scout/test_terraform_dsl.rb",
66
+ "test/test_helper.rb"
67
+ ]
68
+ s.homepage = "http://github.com/mikisvaz/scout-camp".freeze
69
+ s.licenses = ["MIT".freeze]
70
+ s.rubygems_version = "3.6.5".freeze
71
+ s.summary = "Deploy you scouts".freeze
72
+
73
+ s.specification_version = 4
74
+
75
+ s.add_runtime_dependency(%q<scout-essentials>.freeze, [">= 0".freeze])
76
+ end
77
+
@@ -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.1
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
@@ -48,6 +48,7 @@ files:
48
48
  - lib/scout/terraform_dsl.rb
49
49
  - lib/scout/terraform_dsl/deployment.rb
50
50
  - lib/scout/terraform_dsl/util.rb
51
+ - scout-camp.gemspec
51
52
  - scout_commands/offsite
52
53
  - scout_commands/terraform/add
53
54
  - scout_commands/terraform/apply