founders_template 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/ci.yml +22 -0
- data/.gitignore +13 -0
- data/.rspec +3 -0
- data/.rubocop.yml +7 -0
- data/Gemfile-rails5 +7 -0
- data/Gemfile-rails6 +7 -0
- data/Gemfile-rails6.lock +36 -0
- data/LICENSE.txt +21 -0
- data/README.md +40 -0
- data/Rakefile +6 -0
- data/bash/.gitkeep +0 -0
- data/bash/ci/build_image.sh +23 -0
- data/bash/ci/export_build_variables.sh +8 -0
- data/bash/ci/export_ecr_login.sh +3 -0
- data/bash/ci/get_git_branch.sh +3 -0
- data/bash/ci/get_git_commit_sha.sh +3 -0
- data/bash/ci/get_git_committed_at.sh +3 -0
- data/bash/ci/get_image_tag.sh +3 -0
- data/bash/ci/install.sh +12 -0
- data/bash/ci/post_build.sh +13 -0
- data/bash/ci/print_versions.sh +5 -0
- data/bash/ci/pull_latest_image.sh +2 -0
- data/bash/ci/push_images.sh +7 -0
- data/bash/ci/run_tests.sh +18 -0
- data/bash/ci/tag_images.sh +7 -0
- data/bash/ci/write_artifacts.sh +5 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/ft +7 -0
- data/founders_template.gemspec +31 -0
- data/lib/founders_template/cli.rb +18 -0
- data/lib/founders_template/version.rb +3 -0
- data/lib/founders_template.rb +6 -0
- metadata +93 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e33d787c6736db9ea253774787e9f7b3705b9e06afe93e1ca01411cdcad8e419
|
4
|
+
data.tar.gz: 17b6c122ec9e2f974b53bc3726bb58f758c7c78d9148855d782535b8dfa1456e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6ee77f90541b14c3be44429343302df959d3ba6bd713c95678a3a68564c99cc1bd7d819d2c11d03fbd6caeb3975f4e8e9f2a4640c830462276df6e6c891e2a9d
|
7
|
+
data.tar.gz: 918607bfd74e654da98d9861705a2b6f4195a9e6bb2938b9833f11619ba67d48a2ce8e5b4410a5163d50f260a5cd8c30f09222802f969be428c0ac7e36bfaa8c
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on: push
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
strategy:
|
9
|
+
matrix:
|
10
|
+
ruby: [ '2.5', '2.6', '2.7' ]
|
11
|
+
rails: [ 5, 6 ]
|
12
|
+
name: founders_template ruby:${{matrix.ruby}} rails:${{matrix.rails}}
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
- uses: actions/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: ${{ matrix.ruby }}
|
19
|
+
- run: |
|
20
|
+
gem install bundler
|
21
|
+
bundle install --jobs 4 --retry 3 --gemfile=Gemfile-rails${{matrix.rails}}
|
22
|
+
bundle exec rspec
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/Gemfile-rails5
ADDED
data/Gemfile-rails6
ADDED
data/Gemfile-rails6.lock
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
founders_template (0.1.0)
|
5
|
+
thor (~> 1.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
diff-lcs (1.3)
|
11
|
+
rake (12.3.3)
|
12
|
+
rspec (3.9.0)
|
13
|
+
rspec-core (~> 3.9.0)
|
14
|
+
rspec-expectations (~> 3.9.0)
|
15
|
+
rspec-mocks (~> 3.9.0)
|
16
|
+
rspec-core (3.9.1)
|
17
|
+
rspec-support (~> 3.9.1)
|
18
|
+
rspec-expectations (3.9.0)
|
19
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
20
|
+
rspec-support (~> 3.9.0)
|
21
|
+
rspec-mocks (3.9.1)
|
22
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
23
|
+
rspec-support (~> 3.9.0)
|
24
|
+
rspec-support (3.9.2)
|
25
|
+
thor (1.0.1)
|
26
|
+
|
27
|
+
PLATFORMS
|
28
|
+
ruby
|
29
|
+
|
30
|
+
DEPENDENCIES
|
31
|
+
founders_template!
|
32
|
+
rake (~> 12.0)
|
33
|
+
rspec (~> 3.0)
|
34
|
+
|
35
|
+
BUNDLED WITH
|
36
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Trae Robrock
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# FoundersTemplate
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/founders_template`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'founders_template'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install founders_template
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/founders_template.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bash/.gitkeep
ADDED
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
TARGET="$1"
|
4
|
+
|
5
|
+
if [[ "$TARGET" -eq "app" ]]; then
|
6
|
+
HAS_DOCKER_IMAGE="$(docker image ls --filter "reference=$APP_REPOSITORY_URI:latest" --format "{{.ID}}" | wc -l)"
|
7
|
+
CACHE_IMAGE="$(if [ $HAS_DOCKER_IMAGE -eq "1" ]; then echo "--cache-from $APP_REPOSITORY_URI:latest" ; fi)"
|
8
|
+
else
|
9
|
+
CACHE_IMAGE="--cache-from app:$GIT_COMMIT_SHA"
|
10
|
+
fi
|
11
|
+
|
12
|
+
echo "Building the $TARGET Docker image..."
|
13
|
+
exec docker build \
|
14
|
+
$CACHE_IMAGE \
|
15
|
+
--build-arg RAILS_ENV=$RAILS_ENV \
|
16
|
+
--build-arg DATABASE_URL=$DATABASE_URL \
|
17
|
+
--build-arg REDIS_URL=$REDIS_URL \
|
18
|
+
--build-arg SECRET_KEY_BASE=$RAILS_SECRET_KEY \
|
19
|
+
--build-arg RAILS_MASTER_KEY=$RAILS_MASTER_KEY \
|
20
|
+
--build-arg AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION \
|
21
|
+
--build-arg AWS_CONTAINER_CREDENTIALS_RELATIVE_URI=$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI \
|
22
|
+
-t $TARGET:$GIT_COMMIT_SHA \
|
23
|
+
--target $TARGET .
|
@@ -0,0 +1,8 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
cat <<-EOF
|
4
|
+
export \
|
5
|
+
GIT_COMMIT_SHA=$CODEBUILD_RESOLVED_SOURCE_VERSION \
|
6
|
+
GIT_COMMITTED_AT=$(echo $CODEBUILD_START_TIME | sed 's/.\{3\}$//') \
|
7
|
+
IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)-$(echo $CODEBUILD_BUILD_ID | sed 's/:/-/g')
|
8
|
+
EOF
|
data/bash/ci/install.sh
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
extra_environment=""
|
6
|
+
for e in $@
|
7
|
+
do
|
8
|
+
extra_environment="$extra_environment -e $e"
|
9
|
+
done
|
10
|
+
|
11
|
+
echo Running tests...
|
12
|
+
sed -i "s;%IMAGE;app:$GIT_COMMIT_SHA;" docker-compose.ci.yml
|
13
|
+
exec docker-compose -f docker-compose.ci.yml \
|
14
|
+
run --entrypoint "/bin/sh -c" \
|
15
|
+
-e GIT_COMMIT_SHA \
|
16
|
+
-e GIT_COMMITTED_AT \
|
17
|
+
$extra_environment \
|
18
|
+
app "exec sh ./ci/run_tests.sh"
|
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
echo "Tagging Docker images"
|
4
|
+
docker tag app:$GIT_COMMIT_SHA $APP_REPOSITORY_URI:$IMAGE_TAG
|
5
|
+
docker tag app:$GIT_COMMIT_SHA $APP_REPOSITORY_URI:latest
|
6
|
+
docker tag web:$GIT_COMMIT_SHA $WEB_REPOSITORY_URI:$IMAGE_TAG
|
7
|
+
docker tag web:$GIT_COMMIT_SHA $WEB_REPOSITORY_URI:latest
|
@@ -0,0 +1,5 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
echo Writing image definitions file...
|
4
|
+
printf '[{"name":"app","imageUri":"%s"}, {"name":"web","imageUri":"%s"}]' $APP_REPOSITORY_URI:$IMAGE_TAG $WEB_REPOSITORY_URI:$IMAGE_TAG > web_imagedefinitions.json
|
5
|
+
printf '[{"name":"worker","imageUri":"%s"}]' $APP_REPOSITORY_URI:$IMAGE_TAG > worker_imagedefinitions.json
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "founders_template"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/ft
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/founders_template/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'founders_template'
|
7
|
+
spec.version = FoundersTemplate::VERSION
|
8
|
+
spec.authors = ['Trae Robrock']
|
9
|
+
spec.email = ['trobrock@gmail.com']
|
10
|
+
|
11
|
+
spec.summary = "The command line tool used to manage the Founder's Template"
|
12
|
+
spec.description = "The command line tool used to manage the Founder's Template"
|
13
|
+
spec.homepage = 'https://github.com/trobrock/founders_template'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
16
|
+
|
17
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
18
|
+
spec.metadata['source_code_uri'] = 'https://github.com/trobrock/founders_template.git'
|
19
|
+
# spec.metadata['changelog_uri'] = "TODO: Put your gem's CHANGELOG.md URL here."
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
end
|
26
|
+
spec.bindir = 'exe'
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ['lib']
|
29
|
+
|
30
|
+
spec.add_dependency 'thor', '~> 1.0'
|
31
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'shellwords'
|
4
|
+
require 'thor'
|
5
|
+
|
6
|
+
SCRIPT_PATH = File.expand_path(File.join(__dir__, '..', '..', 'bash')).freeze
|
7
|
+
|
8
|
+
module FoundersTemplate
|
9
|
+
class CLI < Thor
|
10
|
+
desc 'ci SCRIPT_NAME', 'exec the ci script SCRIPT_NAME'
|
11
|
+
def ci(script_name, *args)
|
12
|
+
script_name = Shellwords.escape(script_name)
|
13
|
+
file_path = File.join(SCRIPT_PATH, 'ci', "#{script_name}.sh")
|
14
|
+
|
15
|
+
exec '/usr/bin/env', 'bash', file_path, *args
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: founders_template
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Trae Robrock
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-03-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
description: The command line tool used to manage the Founder's Template
|
28
|
+
email:
|
29
|
+
- trobrock@gmail.com
|
30
|
+
executables:
|
31
|
+
- ft
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- ".github/workflows/ci.yml"
|
36
|
+
- ".gitignore"
|
37
|
+
- ".rspec"
|
38
|
+
- ".rubocop.yml"
|
39
|
+
- Gemfile-rails5
|
40
|
+
- Gemfile-rails6
|
41
|
+
- Gemfile-rails6.lock
|
42
|
+
- LICENSE.txt
|
43
|
+
- README.md
|
44
|
+
- Rakefile
|
45
|
+
- bash/.gitkeep
|
46
|
+
- bash/ci/build_image.sh
|
47
|
+
- bash/ci/export_build_variables.sh
|
48
|
+
- bash/ci/export_ecr_login.sh
|
49
|
+
- bash/ci/get_git_branch.sh
|
50
|
+
- bash/ci/get_git_commit_sha.sh
|
51
|
+
- bash/ci/get_git_committed_at.sh
|
52
|
+
- bash/ci/get_image_tag.sh
|
53
|
+
- bash/ci/install.sh
|
54
|
+
- bash/ci/post_build.sh
|
55
|
+
- bash/ci/print_versions.sh
|
56
|
+
- bash/ci/pull_latest_image.sh
|
57
|
+
- bash/ci/push_images.sh
|
58
|
+
- bash/ci/run_tests.sh
|
59
|
+
- bash/ci/tag_images.sh
|
60
|
+
- bash/ci/write_artifacts.sh
|
61
|
+
- bin/console
|
62
|
+
- bin/setup
|
63
|
+
- exe/ft
|
64
|
+
- founders_template.gemspec
|
65
|
+
- lib/founders_template.rb
|
66
|
+
- lib/founders_template/cli.rb
|
67
|
+
- lib/founders_template/version.rb
|
68
|
+
homepage: https://github.com/trobrock/founders_template
|
69
|
+
licenses:
|
70
|
+
- MIT
|
71
|
+
metadata:
|
72
|
+
homepage_uri: https://github.com/trobrock/founders_template
|
73
|
+
source_code_uri: https://github.com/trobrock/founders_template.git
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options: []
|
76
|
+
require_paths:
|
77
|
+
- lib
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.3.0
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
requirements: []
|
89
|
+
rubygems_version: 3.1.2
|
90
|
+
signing_key:
|
91
|
+
specification_version: 4
|
92
|
+
summary: The command line tool used to manage the Founder's Template
|
93
|
+
test_files: []
|