super_test_engine 0.0.10 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -21
- data/lib/super_test_engine.rb +1 -3
- data/lib/super_test_engine/copy_app_templates/controllers/favorite_things_controller.rb +50 -0
- data/lib/super_test_engine/copy_app_templates/controllers/members_controller.rb +57 -0
- data/lib/super_test_engine/copy_app_templates/controllers/ships_controller.rb +47 -0
- data/{db/migrate → lib/super_test_engine/copy_app_templates/migrations}/20190216224956_create_members.rb +0 -0
- data/{db/migrate → lib/super_test_engine/copy_app_templates/migrations}/20190803143320_create_ships.rb +0 -0
- data/{db/migrate → lib/super_test_engine/copy_app_templates/migrations}/20190806014121_add_ship_to_members.rb +0 -0
- data/lib/super_test_engine/copy_app_templates/migrations/20191126050453_create_favorite_things.rb +10 -0
- data/lib/super_test_engine/copy_app_templates/models/favorite_thing.rb +7 -0
- data/{app → lib/super_test_engine/copy_app_templates}/models/member.rb +8 -0
- data/{app → lib/super_test_engine/copy_app_templates}/models/ship.rb +0 -0
- data/lib/super_test_engine/copy_app_templates/routes.rb +11 -0
- data/lib/super_test_engine/copy_app_templates/seeds.rb +2 -0
- data/lib/super_test_engine/copy_app_templates/views/members/_favorite_things.html.erb +11 -0
- data/lib/super_test_engine/copy_app_templates/views/members/show.html.erb +11 -0
- data/lib/super_test_engine/fixtures/favorite_things.yml +9 -0
- data/{test → lib/super_test_engine}/fixtures/members.yml +0 -0
- data/{test → lib/super_test_engine}/fixtures/ships.yml +0 -0
- data/lib/super_test_engine/generate_copy_app.rb +49 -0
- data/lib/super_test_engine/generate_dummy.rb +98 -0
- data/{db/seeds.rb → lib/super_test_engine/starfleet_seeder.rb} +9 -6
- data/super_test_engine.gemspec +23 -0
- metadata +47 -34
- data/MIT-LICENSE +0 -20
- data/Rakefile +0 -32
- data/app/controllers/admin/members_controller.rb +0 -9
- data/app/controllers/admin/ships_controller.rb +0 -9
- data/app/controllers/admin_controller.rb +0 -2
- data/app/super/member_dashboard.rb +0 -90
- data/app/super/ship_dashboard.rb +0 -79
- data/config/routes.rb +0 -6
- data/lib/generators/super_test_engine/dummy/USAGE +0 -8
- data/lib/generators/super_test_engine/dummy/dummy_generator.rb +0 -108
- data/lib/generators/super_test_engine/dummy/templates/db_seeds.rb.tt +0 -1
- data/lib/super_test_engine/engine.rb +0 -9
- data/lib/super_test_engine/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7d20e2c3646b4dee8144f92fa4f43ea042d0f03bce4a8111b3a081ba57cd067
|
4
|
+
data.tar.gz: a9ee55f386103ea4522409f6a16c564a6db2eb950a44b3e54a09a49913653e4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e00688f985b35865f04a61bf0bb7815dbf92ff603bb8e60f962d0cde6237dca9af1ba0551eafa189f86e64029f2c27ca03951da686f0c5a3ecd1babf258a6d65
|
7
|
+
data.tar.gz: 90fcf2eda947e9f281cdff7cd83234cbad475df837d13dd80f259d5dd87339fce01ae34c81aa1c8308c673724511f5e18956a6b321ccf9ec5845d09f9e04ee83
|
data/README.md
CHANGED
@@ -1,28 +1,14 @@
|
|
1
1
|
# SuperTestEngine
|
2
|
-
Short description and motivation.
|
3
2
|
|
4
|
-
|
5
|
-
How to use my plugin.
|
3
|
+
Not an engine. Not just for tests.
|
6
4
|
|
7
|
-
## Installation
|
8
|
-
Add this line to your application's Gemfile:
|
9
5
|
|
10
|
-
|
11
|
-
gem 'super_test_engine'
|
12
|
-
```
|
6
|
+
## Example usage
|
13
7
|
|
14
|
-
And then execute:
|
15
|
-
```bash
|
16
|
-
$ bundle
|
17
8
|
```
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
9
|
+
env BUNDLE_GEMFILE="gemfiles/rails50_sprockets3.gemfile" bundle exec ruby super_test_engine/lib/super_test_engine/generate_copy_app.rb --destination=test/dummy50_sprockets3
|
10
|
+
env BUNDLE_GEMFILE="gemfiles/rails51_sprockets3.gemfile" bundle exec ruby super_test_engine/lib/super_test_engine/generate_copy_app.rb --destination=test/dummy51_sprockets3
|
11
|
+
env BUNDLE_GEMFILE="gemfiles/rails52_sprockets4.gemfile" bundle exec ruby super_test_engine/lib/super_test_engine/generate_copy_app.rb --destination=test/dummy52_sprockets4
|
12
|
+
env BUNDLE_GEMFILE="gemfiles/rails60_sprockets4.gemfile" bundle exec ruby super_test_engine/lib/super_test_engine/generate_copy_app.rb --destination=test/dummy60_sprockets4
|
13
|
+
env BUNDLE_GEMFILE="gemfiles/rails60_webpacker4.gemfile" bundle exec ruby super_test_engine/lib/super_test_engine/generate_copy_app.rb --destination=test/dummy60_webpacker4
|
22
14
|
```
|
23
|
-
|
24
|
-
## Contributing
|
25
|
-
Contribution directions go here.
|
26
|
-
|
27
|
-
## License
|
28
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/lib/super_test_engine.rb
CHANGED
@@ -0,0 +1,50 @@
|
|
1
|
+
module Admin
|
2
|
+
class FavoriteThingsController < AdminController
|
3
|
+
private
|
4
|
+
|
5
|
+
def new_controls
|
6
|
+
Controls.new
|
7
|
+
end
|
8
|
+
|
9
|
+
class Controls
|
10
|
+
def title
|
11
|
+
FavoriteThing.name.pluralize
|
12
|
+
end
|
13
|
+
|
14
|
+
def model
|
15
|
+
FavoriteThing
|
16
|
+
end
|
17
|
+
|
18
|
+
def scope(action:)
|
19
|
+
FavoriteThing.all
|
20
|
+
end
|
21
|
+
|
22
|
+
def permitted_params(params, action:)
|
23
|
+
params.require(:favorite_thing).permit(:name, member_attributes: [:id, :name, :rank, :position, :ship_id])
|
24
|
+
end
|
25
|
+
|
26
|
+
def display_schema(action:)
|
27
|
+
Super::Schema.new(Super::Display::SchemaTypes.new) do |fields, type|
|
28
|
+
fields[:name] = type.dynamic(&:itself)
|
29
|
+
fields[:member] = type.dynamic { |member| "#{member.name} (member ##{member.id})" }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def form_schema(action:)
|
34
|
+
Super::Schema.new(Super::Form::SchemaTypes.new) do |fields, type|
|
35
|
+
fields[:name] = type.generic("form_field_text")
|
36
|
+
|
37
|
+
fields[:member_attributes] = type.belongs_to(:member) do
|
38
|
+
fields[:name] = type.generic("form_field_text")
|
39
|
+
fields[:rank] = type.generic("form_field_select", collection: Member.ranks.keys)
|
40
|
+
fields[:position] = type.generic("form_field_text")
|
41
|
+
fields[:ship_id] = type.generic(
|
42
|
+
"form_field_select",
|
43
|
+
collection: Ship.all.map { |s| ["#{s.name} (Ship ##{s.id})", s.id] },
|
44
|
+
)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Admin
|
2
|
+
class MembersController < AdminController
|
3
|
+
private
|
4
|
+
|
5
|
+
def new_controls
|
6
|
+
Controls.new
|
7
|
+
end
|
8
|
+
|
9
|
+
class Controls
|
10
|
+
def title
|
11
|
+
Member.name.pluralize
|
12
|
+
end
|
13
|
+
|
14
|
+
def model
|
15
|
+
Member
|
16
|
+
end
|
17
|
+
|
18
|
+
def scope(action:)
|
19
|
+
Member.all
|
20
|
+
end
|
21
|
+
|
22
|
+
def permitted_params(params, action:)
|
23
|
+
params.require(:member).permit(:name, :rank, :position, :ship_id, favorite_things_attributes: [:id, :name, :_destroy])
|
24
|
+
end
|
25
|
+
|
26
|
+
def display_schema(action:)
|
27
|
+
Super::Schema.new(Super::Display::SchemaTypes.new) do |fields, type|
|
28
|
+
fields[:name] = type.dynamic(&:itself)
|
29
|
+
fields[:rank] = type.dynamic(&:itself)
|
30
|
+
fields[:position] = type.dynamic(&:itself)
|
31
|
+
fields[:ship] = type.dynamic { |ship| "#{ship.name} (Ship ##{ship.id})" }
|
32
|
+
fields[:created_at] = type.dynamic(&:iso8601)
|
33
|
+
if action.show?
|
34
|
+
fields[:updated_at] = type.dynamic(&:iso8601)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def form_schema(action:)
|
40
|
+
Super::Schema.new(Super::Form::SchemaTypes.new) do |fields, type|
|
41
|
+
fields[:name] = type.generic("form_field_text")
|
42
|
+
fields[:rank] = type.generic("form_field_select", collection: Member.ranks.keys)
|
43
|
+
fields[:position] = type.generic("form_field_text")
|
44
|
+
fields[:ship_id] = type.generic(
|
45
|
+
"form_field_select",
|
46
|
+
collection: Ship.all.map { |s| ["#{s.name} (Ship ##{s.id})", s.id] },
|
47
|
+
)
|
48
|
+
|
49
|
+
fields[:favorite_things_attributes] = type.has_many(:favorite_things) do
|
50
|
+
fields[:name] = type.generic("form_field_text")
|
51
|
+
fields[:_destroy] = type._destroy
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Admin
|
2
|
+
class ShipsController < AdminController
|
3
|
+
private
|
4
|
+
|
5
|
+
def new_controls
|
6
|
+
Controls.new
|
7
|
+
end
|
8
|
+
|
9
|
+
class Controls
|
10
|
+
def title
|
11
|
+
Ship.name.pluralize
|
12
|
+
end
|
13
|
+
|
14
|
+
def model
|
15
|
+
Ship
|
16
|
+
end
|
17
|
+
|
18
|
+
def scope(action:)
|
19
|
+
Ship.all
|
20
|
+
end
|
21
|
+
|
22
|
+
def permitted_params(params, action:)
|
23
|
+
params.require(:ship).permit(:name, :registry, :class_name)
|
24
|
+
end
|
25
|
+
|
26
|
+
def display_schema(action:)
|
27
|
+
Super::Schema.new(Super::Display::SchemaTypes.new) do |fields, type|
|
28
|
+
fields[:name] = type.dynamic(&:itself)
|
29
|
+
fields[:registry] = type.dynamic(&:itself)
|
30
|
+
fields[:class_name] = type.dynamic(&:itself)
|
31
|
+
if action.show?
|
32
|
+
fields[:created_at] = type.dynamic(&:iso8601)
|
33
|
+
fields[:updated_at] = type.dynamic(&:iso8601)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def form_schema(action:)
|
39
|
+
Super::Schema.new(Super::Form::SchemaTypes.new) do |fields, type|
|
40
|
+
fields[:name] = type.generic("form_field_text")
|
41
|
+
fields[:registry] = type.generic("form_field_text")
|
42
|
+
fields[:class_name] = type.generic("form_field_text")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -10,7 +10,15 @@ class Member < ApplicationRecord
|
|
10
10
|
}
|
11
11
|
|
12
12
|
belongs_to :ship
|
13
|
+
has_many :favorite_things, dependent: :delete_all
|
14
|
+
|
15
|
+
accepts_nested_attributes_for(
|
16
|
+
:favorite_things,
|
17
|
+
allow_destroy: true,
|
18
|
+
reject_if: -> (record) { record[:name].blank? }
|
19
|
+
)
|
13
20
|
|
14
21
|
validates :name, presence: true
|
15
22
|
validates :rank, presence: true
|
23
|
+
validates :position, presence: true
|
16
24
|
end
|
File without changes
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<% if @resource.favorite_things.any? %>
|
2
|
+
<%= render(Super::Panel.new) do %>
|
3
|
+
<h1 class="text-xl">Favorite Things</h1>
|
4
|
+
|
5
|
+
<ul class="list-disc list-outside mt-4">
|
6
|
+
<% @resource.favorite_things.each do |favorite_thing| %>
|
7
|
+
<li class="ml-6"><%= favorite_thing.name %></li>
|
8
|
+
<% end %>
|
9
|
+
</ul>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
File without changes
|
File without changes
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
super_development_path = File.expand_path("../../..", __dir__)
|
4
|
+
if File.exist?(File.join(super_development_path, "super.gemspec"))
|
5
|
+
super_lib_path = File.join(super_development_path, "lib")
|
6
|
+
|
7
|
+
$LOAD_PATH.unshift(super_lib_path) if !$LOAD_PATH.include?(super_lib_path)
|
8
|
+
end
|
9
|
+
|
10
|
+
require "rails/generators"
|
11
|
+
require "generators/super/install/install_generator"
|
12
|
+
|
13
|
+
class SuperCopyAppGenerator < Rails::Generators::Base
|
14
|
+
source_root(File.expand_path("copy_app_templates", __dir__))
|
15
|
+
|
16
|
+
class_option :destination, required: true
|
17
|
+
|
18
|
+
def set_destination_root
|
19
|
+
self.destination_root = options[:destination]
|
20
|
+
end
|
21
|
+
|
22
|
+
def ensure_reasonable_directory
|
23
|
+
app_path = File.join(destination_root, "app")
|
24
|
+
if !File.directory?(app_path)
|
25
|
+
raise "Can't find dir: #{app_path}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def install_super
|
30
|
+
Super::InstallGenerator.start([], destination_root: destination_root)
|
31
|
+
end
|
32
|
+
|
33
|
+
def copy_app
|
34
|
+
directory "models", "app/models", exclude_pattern: /\.swp$/
|
35
|
+
directory "controllers", "app/controllers/admin", exclude_pattern: /\.swp$/
|
36
|
+
directory "views/members", "app/views/admin/members", exclude_pattern: /\.swp$/
|
37
|
+
end
|
38
|
+
|
39
|
+
def copy_db
|
40
|
+
directory "migrations", "db/migrate", exclude_pattern: /\.swp$/
|
41
|
+
copy_file "seeds.rb", "db/seeds.rb"
|
42
|
+
end
|
43
|
+
|
44
|
+
def copy_config
|
45
|
+
copy_file "routes.rb", "config/routes.rb"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
SuperCopyAppGenerator.start
|
@@ -0,0 +1,98 @@
|
|
1
|
+
require "fileutils"
|
2
|
+
require "tmpdir"
|
3
|
+
|
4
|
+
super_development_path = File.expand_path("../../..", __dir__)
|
5
|
+
if File.exist?(File.join(super_development_path, "super.gemspec"))
|
6
|
+
super_lib_path = File.join(super_development_path, "lib")
|
7
|
+
|
8
|
+
$LOAD_PATH.unshift(super_lib_path) if !$LOAD_PATH.include?(super_lib_path)
|
9
|
+
end
|
10
|
+
|
11
|
+
require "rails"
|
12
|
+
require "rails/generators/rails/app/app_generator"
|
13
|
+
require "rails/generators/rails/plugin/plugin_generator"
|
14
|
+
require "generators/super/install/install_generator"
|
15
|
+
|
16
|
+
module Rails
|
17
|
+
module Generators
|
18
|
+
class AppGenerator
|
19
|
+
def valid_const?
|
20
|
+
true
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class PluginGenerator
|
25
|
+
def valid_const?
|
26
|
+
true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class SuperDummyGenerator < Rails::Generators::Base
|
33
|
+
source_root(File.expand_path("templates", __dir__))
|
34
|
+
|
35
|
+
class_option :destination, required: true
|
36
|
+
|
37
|
+
def create_new_plugin
|
38
|
+
if plugin_name.blank?
|
39
|
+
warn "Not currently in a plugin directory"
|
40
|
+
exit
|
41
|
+
end
|
42
|
+
|
43
|
+
opts = {
|
44
|
+
force: true,
|
45
|
+
skip_active_storage: true,
|
46
|
+
skip_action_mailer: true,
|
47
|
+
skip_action_mailbox: true,
|
48
|
+
skip_action_text: true,
|
49
|
+
skip_action_cable: true,
|
50
|
+
skip_coffee: true,
|
51
|
+
database: "sqlite3",
|
52
|
+
}
|
53
|
+
|
54
|
+
Dir.mktmpdir do |dir|
|
55
|
+
plugin_path = File.join(dir, plugin_name)
|
56
|
+
generated_dummy_path = File.join(plugin_path, "test/dummy")
|
57
|
+
|
58
|
+
invoke(Rails::Generators::PluginGenerator, [plugin_path], opts)
|
59
|
+
|
60
|
+
inside(generated_dummy_path) do
|
61
|
+
remove_file(".ruby-version")
|
62
|
+
end
|
63
|
+
|
64
|
+
FileUtils.rm_rf(dummy_path)
|
65
|
+
FileUtils.mv(generated_dummy_path, dummy_path)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def delete_unnecessary_files
|
70
|
+
inside(dummy_path) do
|
71
|
+
remove_file("app/assets/javascripts/cable.js")
|
72
|
+
remove_file("app/channels/")
|
73
|
+
remove_file("public/apple-touch-icon-precomposed.png")
|
74
|
+
remove_file("public/apple-touch-icon.png")
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
private
|
79
|
+
|
80
|
+
def dummy_path
|
81
|
+
@dummy_path ||= File.expand_path(options[:destination], destination_root)
|
82
|
+
end
|
83
|
+
|
84
|
+
def plugin_name
|
85
|
+
@plugin_name ||=
|
86
|
+
begin
|
87
|
+
filename = Dir.glob("*.gemspec").first
|
88
|
+
|
89
|
+
if filename.present?
|
90
|
+
File.basename(filename, ".gemspec")
|
91
|
+
else
|
92
|
+
""
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
SuperDummyGenerator.start
|
@@ -1,4 +1,11 @@
|
|
1
|
-
class
|
1
|
+
class StarfleetSeeder
|
2
|
+
def self.seed
|
3
|
+
seeder = StarfleetSeeder.new
|
4
|
+
seeder.seed_from_fixture("ships", Ship)
|
5
|
+
seeder.seed_from_fixture("members", Member)
|
6
|
+
seeder.seed_from_fixture("favorite_things", FavoriteThing)
|
7
|
+
end
|
8
|
+
|
2
9
|
def initialize
|
3
10
|
@seeded = {}
|
4
11
|
@association_reflections = {}
|
@@ -36,12 +43,8 @@ class EnterpriseSeeder
|
|
36
43
|
private
|
37
44
|
|
38
45
|
def fixtures(basename)
|
39
|
-
@fixtures_dir ||= Pathname.new("
|
46
|
+
@fixtures_dir ||= Pathname.new("./fixtures").expand_path(__dir__)
|
40
47
|
|
41
48
|
YAML.load_file(@fixtures_dir.join("#{basename}.yml"))
|
42
49
|
end
|
43
50
|
end
|
44
|
-
|
45
|
-
seeder = EnterpriseSeeder.new
|
46
|
-
seeder.seed_from_fixture("ships", Ship)
|
47
|
-
seeder.seed_from_fixture("members", Member)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "super_test_engine"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "super_test_engine"
|
7
|
+
spec.version = SuperTestEngine::VERSION
|
8
|
+
spec.authors = ["Zach Ahn"]
|
9
|
+
spec.email = ["engineering@zachahn.com"]
|
10
|
+
|
11
|
+
spec.summary = "A thing to help test Super"
|
12
|
+
|
13
|
+
# Specify which files should be added to the gem when it is released.
|
14
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
15
|
+
spec.files = Dir.glob("{lib/**/*,*.gemspec,README.*}").select { |e| File.file?(e) }
|
16
|
+
spec.bindir = "exe"
|
17
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
21
|
+
spec.add_development_dependency "rake"
|
22
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
23
|
+
end
|
metadata
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: super_test_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zach Ahn
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
type: :
|
19
|
+
version: '1.17'
|
20
|
+
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1.17'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
41
55
|
description:
|
42
56
|
email:
|
43
57
|
- engineering@zachahn.com
|
@@ -45,32 +59,31 @@ executables: []
|
|
45
59
|
extensions: []
|
46
60
|
extra_rdoc_files: []
|
47
61
|
files:
|
48
|
-
- MIT-LICENSE
|
49
62
|
- README.md
|
50
|
-
- Rakefile
|
51
|
-
- app/controllers/admin/members_controller.rb
|
52
|
-
- app/controllers/admin/ships_controller.rb
|
53
|
-
- app/controllers/admin_controller.rb
|
54
|
-
- app/models/member.rb
|
55
|
-
- app/models/ship.rb
|
56
|
-
- app/super/member_dashboard.rb
|
57
|
-
- app/super/ship_dashboard.rb
|
58
|
-
- config/routes.rb
|
59
|
-
- db/migrate/20190216224956_create_members.rb
|
60
|
-
- db/migrate/20190803143320_create_ships.rb
|
61
|
-
- db/migrate/20190806014121_add_ship_to_members.rb
|
62
|
-
- db/seeds.rb
|
63
|
-
- lib/generators/super_test_engine/dummy/USAGE
|
64
|
-
- lib/generators/super_test_engine/dummy/dummy_generator.rb
|
65
|
-
- lib/generators/super_test_engine/dummy/templates/db_seeds.rb.tt
|
66
63
|
- lib/super_test_engine.rb
|
67
|
-
- lib/super_test_engine/
|
68
|
-
- lib/super_test_engine/
|
69
|
-
-
|
70
|
-
-
|
64
|
+
- lib/super_test_engine/copy_app_templates/controllers/favorite_things_controller.rb
|
65
|
+
- lib/super_test_engine/copy_app_templates/controllers/members_controller.rb
|
66
|
+
- lib/super_test_engine/copy_app_templates/controllers/ships_controller.rb
|
67
|
+
- lib/super_test_engine/copy_app_templates/migrations/20190216224956_create_members.rb
|
68
|
+
- lib/super_test_engine/copy_app_templates/migrations/20190803143320_create_ships.rb
|
69
|
+
- lib/super_test_engine/copy_app_templates/migrations/20190806014121_add_ship_to_members.rb
|
70
|
+
- lib/super_test_engine/copy_app_templates/migrations/20191126050453_create_favorite_things.rb
|
71
|
+
- lib/super_test_engine/copy_app_templates/models/favorite_thing.rb
|
72
|
+
- lib/super_test_engine/copy_app_templates/models/member.rb
|
73
|
+
- lib/super_test_engine/copy_app_templates/models/ship.rb
|
74
|
+
- lib/super_test_engine/copy_app_templates/routes.rb
|
75
|
+
- lib/super_test_engine/copy_app_templates/seeds.rb
|
76
|
+
- lib/super_test_engine/copy_app_templates/views/members/_favorite_things.html.erb
|
77
|
+
- lib/super_test_engine/copy_app_templates/views/members/show.html.erb
|
78
|
+
- lib/super_test_engine/fixtures/favorite_things.yml
|
79
|
+
- lib/super_test_engine/fixtures/members.yml
|
80
|
+
- lib/super_test_engine/fixtures/ships.yml
|
81
|
+
- lib/super_test_engine/generate_copy_app.rb
|
82
|
+
- lib/super_test_engine/generate_dummy.rb
|
83
|
+
- lib/super_test_engine/starfleet_seeder.rb
|
84
|
+
- super_test_engine.gemspec
|
71
85
|
homepage:
|
72
|
-
licenses:
|
73
|
-
- MIT
|
86
|
+
licenses: []
|
74
87
|
metadata: {}
|
75
88
|
post_install_message:
|
76
89
|
rdoc_options: []
|
@@ -90,5 +103,5 @@ requirements: []
|
|
90
103
|
rubygems_version: 3.0.3
|
91
104
|
signing_key:
|
92
105
|
specification_version: 4
|
93
|
-
summary:
|
106
|
+
summary: A thing to help test Super
|
94
107
|
test_files: []
|
data/MIT-LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright 2019 Zach Ahn
|
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/Rakefile
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'bundler/setup'
|
3
|
-
rescue LoadError
|
4
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
-
end
|
6
|
-
|
7
|
-
require 'rdoc/task'
|
8
|
-
|
9
|
-
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
-
rdoc.rdoc_dir = 'rdoc'
|
11
|
-
rdoc.title = 'SuperTestEngine'
|
12
|
-
rdoc.options << '--line-numbers'
|
13
|
-
rdoc.rdoc_files.include('README.md')
|
14
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
-
end
|
16
|
-
|
17
|
-
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
18
|
-
load 'rails/tasks/engine.rake'
|
19
|
-
|
20
|
-
load 'rails/tasks/statistics.rake'
|
21
|
-
|
22
|
-
require 'bundler/gem_tasks'
|
23
|
-
|
24
|
-
require 'rake/testtask'
|
25
|
-
|
26
|
-
Rake::TestTask.new(:test) do |t|
|
27
|
-
t.libs << 'test'
|
28
|
-
t.pattern = 'test/**/*_test.rb'
|
29
|
-
t.verbose = false
|
30
|
-
end
|
31
|
-
|
32
|
-
task default: :test
|
@@ -1,90 +0,0 @@
|
|
1
|
-
class MemberDashboard
|
2
|
-
def title
|
3
|
-
Member.name.pluralize
|
4
|
-
end
|
5
|
-
|
6
|
-
def model
|
7
|
-
Member
|
8
|
-
end
|
9
|
-
|
10
|
-
def index_scope
|
11
|
-
Member.all
|
12
|
-
end
|
13
|
-
|
14
|
-
def index_schema
|
15
|
-
Super::Schema.new(Super::Display::SchemaTypes.new) do |fields, type|
|
16
|
-
fields[:name] = type.dynamic { |name| name }
|
17
|
-
fields[:rank] = type.dynamic { |rank| rank }
|
18
|
-
fields[:position] = type.dynamic { |position| position }
|
19
|
-
fields[:ship] = type.dynamic { |ship| "#{ship.name} (Ship ##{ship.id})" }
|
20
|
-
fields[:created_at] = type.dynamic(&:iso8601)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def create_scope
|
25
|
-
Member.all
|
26
|
-
end
|
27
|
-
|
28
|
-
def create_permitted_params(params)
|
29
|
-
params.require(:member).permit(:name, :rank, :position, :ship_id)
|
30
|
-
end
|
31
|
-
|
32
|
-
def new_scope
|
33
|
-
Member.all
|
34
|
-
end
|
35
|
-
|
36
|
-
def new_schema
|
37
|
-
Super::Schema.new(Super::Form::SchemaTypes.new) do |fields, type|
|
38
|
-
fields[:name] = type.generic("form_generic_text")
|
39
|
-
fields[:rank] = type.generic("form_generic_select", collection: Member.ranks.keys)
|
40
|
-
fields[:position] = type.generic("form_generic_text")
|
41
|
-
fields[:ship_id] = type.generic(
|
42
|
-
"form_generic_select",
|
43
|
-
collection: Ship.all.map { |s| ["#{s.name} (Ship ##{s.id})", s.id] },
|
44
|
-
)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def edit_scope
|
49
|
-
Member.all
|
50
|
-
end
|
51
|
-
|
52
|
-
def edit_schema
|
53
|
-
Super::Schema.new(Super::Form::SchemaTypes.new) do |fields, type|
|
54
|
-
fields[:name] = type.generic("form_generic_text")
|
55
|
-
fields[:rank] = type.generic("form_generic_select", collection: Member.ranks.keys)
|
56
|
-
fields[:position] = type.generic("form_generic_text")
|
57
|
-
fields[:ship_id] = type.generic(
|
58
|
-
"form_generic_select",
|
59
|
-
collection: Ship.all.map { |s| ["#{s.name} (Ship ##{s.id})", s.id] },
|
60
|
-
)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def show_scope
|
65
|
-
Member.all
|
66
|
-
end
|
67
|
-
|
68
|
-
def show_schema
|
69
|
-
Super::Schema.new(Super::Display::SchemaTypes.new) do |fields, type|
|
70
|
-
fields[:name] = type.dynamic { |name| name }
|
71
|
-
fields[:rank] = type.dynamic { |rank| rank }
|
72
|
-
fields[:position] = type.dynamic { |position| position }
|
73
|
-
fields[:ship] = type.dynamic { |ship| "#{ship.name} (Ship ##{ship.id})" }
|
74
|
-
fields[:created_at] = type.dynamic(&:iso8601)
|
75
|
-
fields[:updated_at] = type.dynamic(&:iso8601)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def update_scope
|
80
|
-
Member.all
|
81
|
-
end
|
82
|
-
|
83
|
-
def update_permitted_params(params)
|
84
|
-
params.require(:member).permit(:name, :rank, :position, :ship_id)
|
85
|
-
end
|
86
|
-
|
87
|
-
def destroy_scope
|
88
|
-
Member.all
|
89
|
-
end
|
90
|
-
end
|
data/app/super/ship_dashboard.rb
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
class ShipDashboard
|
2
|
-
def title
|
3
|
-
Ship.name.pluralize
|
4
|
-
end
|
5
|
-
|
6
|
-
def model
|
7
|
-
Ship
|
8
|
-
end
|
9
|
-
|
10
|
-
def index_scope
|
11
|
-
Ship.all
|
12
|
-
end
|
13
|
-
|
14
|
-
def index_schema
|
15
|
-
Super::Schema.new(Super::Display::SchemaTypes.new) do |fields, type|
|
16
|
-
fields[:name] = type.dynamic { |name| name }
|
17
|
-
fields[:registry] = type.dynamic { |registry| registry }
|
18
|
-
fields[:class_name] = type.dynamic { |class_name| class_name }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def create_scope
|
23
|
-
Ship.all
|
24
|
-
end
|
25
|
-
|
26
|
-
def create_permitted_params(params)
|
27
|
-
params.require(:ship).permit(:name, :registry, :class_name)
|
28
|
-
end
|
29
|
-
|
30
|
-
def new_scope
|
31
|
-
Ship.all
|
32
|
-
end
|
33
|
-
|
34
|
-
def new_schema
|
35
|
-
Super::Schema.new(Super::Form::SchemaTypes.new) do |fields, type|
|
36
|
-
fields[:name] = type.generic("form_generic_text")
|
37
|
-
fields[:registry] = type.generic("form_generic_text")
|
38
|
-
fields[:position] = type.generic("form_generic_text")
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def edit_scope
|
43
|
-
Ship.all
|
44
|
-
end
|
45
|
-
|
46
|
-
def edit_schema
|
47
|
-
Super::Schema.new(Super::Form::SchemaTypes.new) do |fields, type|
|
48
|
-
fields[:name] = type.generic("form_generic_text")
|
49
|
-
fields[:registry] = type.generic("form_generic_text")
|
50
|
-
fields[:position] = type.generic("form_generic_text")
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def show_scope
|
55
|
-
Ship.all
|
56
|
-
end
|
57
|
-
|
58
|
-
def show_schema
|
59
|
-
Super::Schema.new(Super::Display::SchemaTypes.new) do |fields, type|
|
60
|
-
fields[:name] = type.dynamic { |name| name }
|
61
|
-
fields[:registry] = type.dynamic { |registry| registry }
|
62
|
-
fields[:class_name] = type.dynamic { |class_name| class_name }
|
63
|
-
fields[:created_at] = type.dynamic(&:iso8601)
|
64
|
-
fields[:updated_at] = type.dynamic(&:iso8601)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def update_scope
|
69
|
-
Ship.all
|
70
|
-
end
|
71
|
-
|
72
|
-
def update_permitted_params(params)
|
73
|
-
params.require(:ship).permit(:name, :registry, :class_name)
|
74
|
-
end
|
75
|
-
|
76
|
-
def destroy_scope
|
77
|
-
Ship.all
|
78
|
-
end
|
79
|
-
end
|
data/config/routes.rb
DELETED
@@ -1,108 +0,0 @@
|
|
1
|
-
require "fileutils"
|
2
|
-
require "tmpdir"
|
3
|
-
|
4
|
-
require "rails"
|
5
|
-
require "rails/generators/rails/app/app_generator"
|
6
|
-
require "rails/generators/rails/plugin/plugin_generator"
|
7
|
-
require "generators/super/install/install_generator"
|
8
|
-
|
9
|
-
Rails::Generators::AppGenerator
|
10
|
-
|
11
|
-
module Rails
|
12
|
-
module Generators
|
13
|
-
class AppGenerator
|
14
|
-
def valid_const?
|
15
|
-
true
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
class PluginGenerator
|
20
|
-
def valid_const?
|
21
|
-
true
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
module SuperTestEngine
|
28
|
-
class DummyGenerator < Rails::Generators::Base
|
29
|
-
source_root(File.expand_path("templates", __dir__))
|
30
|
-
|
31
|
-
def create_new_plugin
|
32
|
-
if plugin_name.blank?
|
33
|
-
warn "Not currently in a plugin directory"
|
34
|
-
exit
|
35
|
-
end
|
36
|
-
|
37
|
-
opts = {
|
38
|
-
force: true,
|
39
|
-
skip_active_storage: true,
|
40
|
-
skip_action_mailer: true,
|
41
|
-
skip_action_cable: true,
|
42
|
-
skip_puma: true,
|
43
|
-
skip_coffee: true,
|
44
|
-
database: "sqlite3",
|
45
|
-
}
|
46
|
-
|
47
|
-
Dir.mktmpdir do |dir|
|
48
|
-
plugin_path = File.join(dir, plugin_name)
|
49
|
-
new_dummy_path = File.join(plugin_path, "test/dummy")
|
50
|
-
|
51
|
-
invoke(Rails::Generators::PluginGenerator, [plugin_path], opts)
|
52
|
-
|
53
|
-
inside(new_dummy_path) do
|
54
|
-
remove_file(".ruby-version")
|
55
|
-
end
|
56
|
-
|
57
|
-
FileUtils.rm_rf(dummy_path)
|
58
|
-
FileUtils.mv(new_dummy_path, dummy_path)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def delete_unnecessary_files
|
63
|
-
inside(dummy_path) do
|
64
|
-
remove_file("app/assets/javascripts/cable.js")
|
65
|
-
remove_file("app/channels/")
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def apply_required_changes
|
70
|
-
template("db_seeds.rb.tt", File.join(dummy_path, "db/seeds.rb"))
|
71
|
-
|
72
|
-
insert_into_file(
|
73
|
-
File.join(dummy_path, "config/application.rb"),
|
74
|
-
%(require "super_test_engine"\n),
|
75
|
-
before: "\nmodule Dummy\n"
|
76
|
-
)
|
77
|
-
|
78
|
-
inside(dummy_path) do
|
79
|
-
invoke(Super::InstallGenerator, [], {})
|
80
|
-
remove_file("app/controllers/admin/")
|
81
|
-
remove_file("app/controllers/admin_controller.rb")
|
82
|
-
remove_file("app/super/")
|
83
|
-
end
|
84
|
-
|
85
|
-
rake("db:create")
|
86
|
-
rake("db:migrate")
|
87
|
-
end
|
88
|
-
|
89
|
-
private
|
90
|
-
|
91
|
-
def dummy_path
|
92
|
-
@dummy_path ||= File.expand_path("test/dummy", destination_root)
|
93
|
-
end
|
94
|
-
|
95
|
-
def plugin_name
|
96
|
-
@plugin_name ||=
|
97
|
-
begin
|
98
|
-
filename = Dir.glob("*.gemspec").first
|
99
|
-
|
100
|
-
if filename.present?
|
101
|
-
File.basename(filename, ".gemspec")
|
102
|
-
else
|
103
|
-
""
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
SuperTestEngine::Engine.load_seed
|