affogata_love_muffins 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f81059f8d2ed0c3df7864a642c7df4b8736a1ff53cae4d5c0e75522e26ad7a64
4
- data.tar.gz: aaccfd14760bca78ba9d2b43c82c40c3bf8a3acd614e2c88886642f4053abbd6
3
+ metadata.gz: a14d5efb644234f5242c4e0995053f69fbd60c94eb55bb6d0ff7b70f6fa7de3e
4
+ data.tar.gz: 2eb99fab1d156bc7966d947365403d3e0f617e9151893ceef2962e0b66e2f8f5
5
5
  SHA512:
6
- metadata.gz: 849fe14a8718011b40d88a46b8dec1c1219a2580197a6f3e2ae14290d5360616befa4169847d7e3bc859438f55cde21c661e2233e44dc4779226b6329209303b
7
- data.tar.gz: 933b8d84262d85470a32f1e8edbf0aeeeddff04113d0855adf8162518c43046d7ecd9c1977b6b4e5ab4dfdc74b7da4a8514a1a267c46dd54398b4cc18d948697
6
+ metadata.gz: '08312ab35b25f8f30abfd15305c96de9666e256b8dd9cef1d82438703e5c7635f3d5a6e33d594e8bd5dd04391aa3c0438b30efa0faf629cf63c38f2815407631'
7
+ data.tar.gz: f301d825430bf5c9927154e608f9809115a66fcfcec96dbc1df18ef454529156665747e6d223bc9fd4b7b0b46b1817e42d3f0a0a59bd2a5c4eeab3a12ad54d84
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,3 @@
1
+ require "bundler/setup"
2
+
3
+ require "bundler/gem_tasks"
@@ -0,0 +1,3 @@
1
+ module AffogataLoveMuffins
2
+ VERSION = "0.1.1"
3
+ end
@@ -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,19 @@
1
+ namespace :affogata do
2
+ task created: :environment do
3
+ uri = URI("#{AffogataLoveMuffins.config.herochestrator_url}/apps/create?step=created")
4
+ res = Net::HTTP.post_form(uri, AffogataLoveMuffins.config.data.map { |k,v| [k.to_s, v] }.to_h)
5
+ puts res.body
6
+ end
7
+
8
+ task provisioned: :environment do
9
+ uri = URI("#{AffogataLoveMuffins.config.herochestrator_url}/apps/create?step=provisioned")
10
+ res = Net::HTTP.post_form(uri, AffogataLoveMuffins.config.data.map { |k,v| [k.to_s, v] }.to_h)
11
+ puts res.body
12
+ end
13
+
14
+ task post_setup: :environment do
15
+ uri = URI("#{AffogataLoveMuffins.config.herochestrator_url}/apps/create?step=post_setup")
16
+ res = Net::HTTP.post_form(uri, AffogataLoveMuffins.config.data.map { |k,v| [k.to_s, v] }.to_h)
17
+ puts res.body
18
+ end
19
+ 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.1.0
4
+ version: 0.1.1
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