Skip to content

Commit

Permalink
Update test files to use new repo
Browse files Browse the repository at this point in the history
  • Loading branch information
jho406 committed Jan 13, 2025
1 parent 3f51edc commit 8760545
Show file tree
Hide file tree
Showing 12 changed files with 115 additions and 10 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/build_rails.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Test superglue_rails
on:
push:
pull_request:
workflow_dispatch:

jobs:
build:
name: Ruby ${{ matrix.ruby }}. Rails ${{ matrix.version }}
strategy:
fail-fast: false
matrix:
ruby: ["3.3", "3.2", "3.1"]
version: ["70", "71", "72", "80"]
exclude:
- ruby: 3.1
version: 80
runs-on: "ubuntu-latest"

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Which bundler?
run: bundle -v
- name: Using Gemfile
run: |
mv -f Gemfile.${{ matrix.version }} ./Gemfile
- name: Bundle install
run: bundle install
- name: Run unit test
run: bundle exec rake test
- name: Run acceptance test
run: BUNDLE_GEMFILE='' ruby -Ilib:test test/acceptance/superglue_installation_acceptance.rb
19 changes: 19 additions & 0 deletions .github/workflows/dynamic-security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: update-security

on:
push:
paths:
- SECURITY.md
branches:
- main
workflow_dispatch:

jobs:
update-security:
permissions:
contents: write
pull-requests: write
pages: write
uses: thoughtbot/templates/.github/workflows/dynamic-security.yaml@main
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ breezy/build/**/*.js
props_template/performance/**/*.png
.tool-versions
testapp/

superglue/
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ gem 'capybara'
gem 'minitest'
gem 'rake'
gem 'sqlite3', '~> 1.4'
gem 'byebug'
gem 'git'

1 change: 1 addition & 0 deletions Gemfile.70
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ gem 'capybara'
gem 'minitest'
gem 'rake'
gem 'sqlite3', '~> 1.4'
gem 'git'
1 change: 1 addition & 0 deletions Gemfile.71
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ gem 'capybara'
gem 'minitest'
gem 'rake'
gem 'sqlite3', '~> 1.4'
gem 'git'
1 change: 1 addition & 0 deletions Gemfile.72
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ gem 'capybara'
gem 'minitest'
gem 'rake'
gem 'sqlite3', '~> 1.4'
gem 'git'
1 change: 1 addition & 0 deletions Gemfile.80
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ gem 'capybara'
gem 'minitest'
gem 'rake'
gem 'sqlite3'
gem 'git'
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<div align="center" style="padding: 30px 0px 20px 0px;">
<img src="https://thoughtbot.github.io/superglue/images/superglue.svg" data-origin="images/superglue.svg" alt="Logo" width=250>
</div>

# Superglue Rails
Use classic Rails to build rich React Redux applications with **NO APIs** and
**NO client-side routing**.

This is the officially supported Rails adapter to [Superglue]. This gem will
add install and scaffold generators to your rails project.

To get started, visit the [documentation] and add this to your Gemfile

[documentation]: https://thoughtbot.github.io/superglue/

```
gem 'superglue'
```

Then run `bundle`

[![Test superglue_rails](https://github.com/thoughtbot/superglue_rails/actions/workflows/build_rails.yml/badge.svg)](https://github.com/thoughtbot/superglue_rails/actions/workflows/build_rails.yml)

## Documentation

Documentation is hosted on [Github pages](https://thoughtbot.github.io/superglue).

## Contributing

Thank you, [contributors]!

[contributors]: https://github.com/thoughtbot/superglue_rails/graphs/contributors
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0
2 changes: 1 addition & 1 deletion superglue.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = File.read(File.expand_path("../VERSION", __dir__)).strip
version = File.read(File.expand_path("./VERSION", __dir__)).strip

Gem::Specification.new do |s|
s.name = "superglue"
Expand Down
24 changes: 16 additions & 8 deletions test/acceptance/superglue_installation_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
require "capybara"
require "capybara/minitest"
require "selenium-webdriver"
require "git"

ROOT_DIR = File.expand_path("../../../../", __FILE__)
ROOT_DIR = File.expand_path("../../../", __FILE__)
TMP_DIR = File.join(ROOT_DIR, "tmp")
SUPERGLUE_RAILS_PATH = File.join(ROOT_DIR, "superglue_rails")
SUPERGLUE_SUPERGLUE_PATH = File.join(ROOT_DIR, "superglue")
VERSION = File.read(File.expand_path("../../../VERSION", __dir__)).strip
SUPERGLUE_JS_VERSION = JSON.parse(
File.read(File.expand_path("../../../superglue/package.json", __dir__)).strip
)["version"]
SUPERGLUE_RAILS_PATH = ROOT_DIR
SUPERGLUE_SUPERGLUE_PATH = File.join(ROOT_DIR, "superglue/superglue")
VERSION = File.read(File.expand_path("../../VERSION", __dir__)).strip

SERVER_PORT = "3000"

Expand Down Expand Up @@ -52,14 +50,24 @@ def successfully(command, silent = false)
end

def update_package_json
js_version = JSON.parse(
File.read(File.expand_path("package.json", SUPERGLUE_SUPERGLUE_PATH)).strip
)["version"]

content = File.read("package.json").gsub(
/"@thoughtbot\/superglue.*$/,
"\"@thoughtbot/superglue\":\"file:#{SUPERGLUE_SUPERGLUE_PATH}/thoughtbot-superglue-#{SUPERGLUE_JS_VERSION}.tgz\","
"\"@thoughtbot/superglue\":\"file:#{SUPERGLUE_SUPERGLUE_PATH}/thoughtbot-superglue-#{js_version}.tgz\","
)

File.open("package.json", "w") { |file| file.puts content }
end

def install_superglue
Dir.chdir(ROOT_DIR) do
successfully "rm -rf ./superglue"
Git.clone("https://github.com/thoughtbot/superglue.git")
end

Dir.chdir(SUPERGLUE_SUPERGLUE_PATH) do
successfully "npm install"
successfully "npm run build"
Expand Down

0 comments on commit 8760545

Please sign in to comment.