forked from paketo-buildpacks/ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds rails-assets buildpack to group orderings
- also includes node-engine, yarn, and yarn-install to support rails-assets
- Loading branch information
1 parent
8a5043a
commit 6bc3980
Showing
63 changed files
with
9,127 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package integration_test | ||
|
||
import ( | ||
"fmt" | ||
"io/ioutil" | ||
"net/http" | ||
"os" | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/paketo-buildpacks/occam" | ||
"github.com/sclevine/spec" | ||
|
||
. "github.com/onsi/gomega" | ||
. "github.com/paketo-buildpacks/occam/matchers" | ||
) | ||
|
||
func testRailsAssets(t *testing.T, context spec.G, it spec.S) { | ||
var ( | ||
Expect = NewWithT(t).Expect | ||
Eventually = NewWithT(t).Eventually | ||
|
||
pack occam.Pack | ||
docker occam.Docker | ||
) | ||
|
||
it.Before(func() { | ||
pack = occam.NewPack() | ||
docker = occam.NewDocker() | ||
}) | ||
|
||
context("when building a rails app", func() { | ||
var ( | ||
image occam.Image | ||
container occam.Container | ||
|
||
name string | ||
source string | ||
) | ||
|
||
it.Before(func() { | ||
var err error | ||
name, err = occam.RandomName() | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
source, err = occam.Source(filepath.Join("testdata", "rails")) | ||
Expect(err).NotTo(HaveOccurred()) | ||
}) | ||
|
||
it.After(func() { | ||
Expect(docker.Container.Remove.Execute(container.ID)).To(Succeed()) | ||
Expect(docker.Image.Remove.Execute(image.ID)).To(Succeed()) | ||
Expect(docker.Volume.Remove.Execute(occam.CacheVolumeNames(name))).To(Succeed()) | ||
Expect(os.RemoveAll(source)).To(Succeed()) | ||
}) | ||
|
||
it("creates a working OCI image with rails assets precompiled", func() { | ||
var err error | ||
var logs fmt.Stringer | ||
image, logs, err = pack.WithNoColor().Build. | ||
WithBuildpacks(rubyBuildpack). | ||
WithPullPolicy("never"). | ||
Execute(name, source) | ||
Expect(err).NotTo(HaveOccurred(), logs.String()) | ||
|
||
container, err = docker.Container.Run. | ||
WithEnv(map[string]string{ | ||
"PORT": "8080", | ||
"SECRET_KEY_BASE": "some-secret", | ||
}). | ||
WithPublish("8080"). | ||
WithPublishAll(). | ||
Execute(image.ID) | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
Eventually(container).Should(BeAvailable()) | ||
|
||
response, err := http.Get(fmt.Sprintf("http://localhost:%s", container.HostPort("8080"))) | ||
Expect(err).NotTo(HaveOccurred()) | ||
defer response.Body.Close() | ||
|
||
Expect(response.StatusCode).To(Equal(http.StatusOK)) | ||
|
||
content, err := ioutil.ReadAll(response.Body) | ||
Expect(err).NotTo(HaveOccurred()) | ||
Expect(string(content)).To(ContainSubstring("Hello World!")) | ||
|
||
Expect(logs).To(ContainLines(ContainSubstring("MRI Buildpack"))) | ||
Expect(logs).To(ContainLines(ContainSubstring("Bundler Buildpack"))) | ||
Expect(logs).To(ContainLines(ContainSubstring("Bundle Install Buildpack"))) | ||
Expect(logs).To(ContainLines(ContainSubstring("Node Engine Buildpack"))) | ||
Expect(logs).To(ContainLines(ContainSubstring("Yarn Buildpack"))) | ||
Expect(logs).To(ContainLines(ContainSubstring("Yarn Install Buildpack"))) | ||
Expect(logs).To(ContainLines(ContainSubstring("Rails Assets Buildpack"))) | ||
Expect(logs).To(ContainLines(ContainSubstring("Puma Buildpack"))) | ||
Expect(logs).NotTo(ContainLines(ContainSubstring("Procfile Buildpack"))) | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
defaults |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# See https://help.github.com/articles/ignoring-files for more about ignoring files. | ||
# | ||
# If you find yourself ignoring temporary files generated by your text editor | ||
# or operating system, you probably want to add a global ignore instead: | ||
# git config --global core.excludesfile '~/.gitignore_global' | ||
|
||
# Ignore bundler config. | ||
/.bundle | ||
|
||
# Ignore all logfiles and tempfiles. | ||
/log/* | ||
/tmp/* | ||
!/tmp/pids | ||
|
||
|
||
/public/assets | ||
.byebug_history | ||
|
||
# Ignore master key for decrypting credentials and more. | ||
/config/master.key | ||
|
||
/public/packs | ||
/public/packs-test | ||
/node_modules | ||
/yarn-error.log | ||
yarn-debug.log* | ||
.yarn-integrity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ruby-2.6.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
source 'https://rubygems.org' | ||
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | ||
|
||
ruby '~> 2.6.0' | ||
|
||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | ||
gem 'rails', '~> 6.0.3', '>= 6.0.3.4' | ||
# Use Puma as the app server | ||
gem 'puma', '~> 4.1' | ||
|
||
# Use SCSS for stylesheets | ||
gem 'sass-rails', '>= 6' | ||
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker | ||
gem 'webpacker', '~> 4.0' |
Oops, something went wrong.