affogata_love_muffins 0.1.0 → 0.6.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +20 -0
- data/README.md +29 -0
- data/Rakefile +3 -0
- data/lib/affogata_love_muffins/version.rb +3 -0
- data/lib/affogata_love_muffins.rb +46 -0
- data/lib/tasks/affogata.rake +32 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea36add1abadb8db319ae45e6e1975aea5a18eb4eeac247cf84b8e31293c67aa
|
4
|
+
data.tar.gz: df137bdfd966ef57333c6c17268cb4946a69d754f59e987c4fffac5871485a0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af108a0f36e5214ff3709f392d834402cf03f2a75d0c68b8dd461d21325b158a728d845bfd33d683ea3554f7dbeae64a5d7772ada3a5bd9ed7fd0dc34c25b7f1
|
7
|
+
data.tar.gz: 440bc46e0eb792309b9f5cd7773d7328104301c9a7a49a0da7c6119b1b9f5c965103430e52b004f80c6d4e42f3849c2d643afe035867fc60f4a5d3764718fe1e
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2022 Partytray
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# AffogataLoveMuffins
|
2
|
+
|
3
|
+
Orchestration harness for Affogata's applications.
|
4
|
+
|
5
|
+
We have best development practice. Very good.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
```bash
|
10
|
+
$ bundle add affogata_love_muffins
|
11
|
+
```
|
12
|
+
|
13
|
+
Herochestrator expects `affogata:bootstrap` to be a rake task to setup your application.
|
14
|
+
|
15
|
+
## Configuration
|
16
|
+
|
17
|
+
Make sure that `HEROCHESTRATOR_URL` is set in env.
|
18
|
+
|
19
|
+
Assumes some stuff is set in environments. If it's not, set it in the initializer.
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
AffogataLoveMuffins.setup do |config|
|
23
|
+
config.herochestrator_url = "https://fully-qualified.url" # no trailing slash
|
24
|
+
end
|
25
|
+
```
|
26
|
+
|
27
|
+
## License
|
28
|
+
|
29
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
module AffogataLoveMuffins
|
2
|
+
class Config
|
3
|
+
attr_accessor :herochestrator_url
|
4
|
+
attr_accessor :data
|
5
|
+
def initialize
|
6
|
+
@herochestrator_url = ENV['HEROCHESTRATOR_URL']
|
7
|
+
end
|
8
|
+
|
9
|
+
def data
|
10
|
+
@data ||= begin
|
11
|
+
repo = File.read(Rails.root.join("app.json"))
|
12
|
+
json = JSON.parse(repo)
|
13
|
+
{
|
14
|
+
app_id: ENV['HEROKU_APP_ID'],
|
15
|
+
app_name: ENV['HEROKU_APP_NAME'],
|
16
|
+
dyno_id: ENV['HEROKU_DYNO_ID'],
|
17
|
+
parent_app_name: ENV['HEROKU_PARENT_APP_NAME'],
|
18
|
+
repo_url: json['repository']
|
19
|
+
}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.setup
|
25
|
+
yield config
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.config
|
29
|
+
@config ||= Config.new
|
30
|
+
end
|
31
|
+
|
32
|
+
class Railtie < ::Rails::Railtie
|
33
|
+
railtie_name :affogata
|
34
|
+
|
35
|
+
rake_tasks do
|
36
|
+
path = File.expand_path(__dir__)
|
37
|
+
Dir.glob("#{path}/tasks/*.rake").each { |f| puts f; load f }
|
38
|
+
end
|
39
|
+
|
40
|
+
config.to_prepare do
|
41
|
+
if AffogataLoveMuffins.config.herochestrator_url.nil?
|
42
|
+
Rails.logger.warn("You have not defined HEROCHESTRATOR_URL in environment. All hell might break loose.")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'uri'
|
3
|
+
|
4
|
+
namespace :affogata do
|
5
|
+
desc "Fires when the initial app is created"
|
6
|
+
task created: :environment do
|
7
|
+
uri = URI("#{AffogataLoveMuffins.config.herochestrator_url}/webhooks/apps?step=created")
|
8
|
+
res = Net::HTTP.post_form(uri, AffogataLoveMuffins.config.data.map { |k,v| [k.to_s, v] }.to_h)
|
9
|
+
puts res.body
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "Fires when the app has all platform-specific settings configured"
|
13
|
+
task provisioned: :environment do
|
14
|
+
uri = URI("#{AffogataLoveMuffins.config.herochestrator_url}/webhooks/apps?step=provisioned")
|
15
|
+
res = Net::HTTP.post_form(uri, AffogataLoveMuffins.config.data.map { |k,v| [k.to_s, v] }.to_h)
|
16
|
+
puts res.body
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "Idk when this fires but it seems like a good idea to have it"
|
20
|
+
task post_setup: :environment do
|
21
|
+
uri = URI("#{AffogataLoveMuffins.config.herochestrator_url}/webhooks/apps?step=post_setup")
|
22
|
+
res = Net::HTTP.post_form(uri, AffogataLoveMuffins.config.data.map { |k,v| [k.to_s, v] }.to_h)
|
23
|
+
puts res.body
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "Fires when this instance is being removed from the platform"
|
27
|
+
task destroyed: :environment do
|
28
|
+
uri = URI("#{AffogataLoveMuffins.config.herochestrator_url}/webhooks/apps?step=destroyed")
|
29
|
+
res = Net::HTTP.post_form(uri, AffogataLoveMuffins.config.data.map { |k,v| [k.to_s, v] }.to_h)
|
30
|
+
puts res.body
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: affogata_love_muffins
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Partytray
|
@@ -30,7 +30,13 @@ email:
|
|
30
30
|
executables: []
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
|
-
files:
|
33
|
+
files:
|
34
|
+
- MIT-LICENSE
|
35
|
+
- README.md
|
36
|
+
- Rakefile
|
37
|
+
- lib/affogata_love_muffins.rb
|
38
|
+
- lib/affogata_love_muffins/version.rb
|
39
|
+
- lib/tasks/affogata.rake
|
34
40
|
homepage: https://github.com/affogata/affogata_love_muffins
|
35
41
|
licenses:
|
36
42
|
- MIT
|