super 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +10 -0
- data/README.md +9 -64
- data/app/assets/stylesheets/super/application.css +53890 -25613
- data/app/controllers/super/application_controller.rb +9 -28
- data/app/views/super/application/_form_field__destroy.html.erb +6 -2
- data/app/views/super/application/_form_field_select.html.erb +10 -4
- data/app/views/super/application/_form_field_text.html.erb +13 -5
- data/app/views/super/application/_form_has_many.html.erb +2 -2
- data/app/views/super/application/_form_inline_errors.html.erb +1 -1
- data/app/views/super/application/_index.html.erb +2 -2
- data/app/views/super/application/edit.html.erb +6 -1
- data/app/views/super/application/index.html.erb +6 -1
- data/app/views/super/application/new.html.erb +6 -1
- data/app/views/super/application/show.html.erb +6 -1
- data/docs/README.md +6 -0
- data/docs/controls.md +39 -0
- data/docs/faq.md +44 -0
- data/docs/quick_start.md +45 -0
- data/docs/webpacker.md +17 -0
- data/docs/yard_customizations.rb +41 -0
- data/frontend/super-frontend/dist/application.css +53890 -25613
- data/frontend/super-frontend/tailwind.config.js +1 -1
- data/frontend/super-frontend/yarn.lock +1048 -974
- data/lib/generators/super/webpacker/webpacker_generator.rb +8 -0
- data/lib/super.rb +5 -5
- data/lib/super/compatibility.rb +13 -0
- data/lib/super/controls.rb +0 -141
- data/lib/super/step.rb +36 -0
- data/lib/super/version.rb +1 -1
- data/lib/super/view_helper.rb +43 -0
- metadata +56 -25
- data/lib/super/action.rb +0 -22
- data/lib/super/action/step.rb +0 -36
- data/lib/super/test_support/copy_app_templates/controllers/favorite_things_controller.rb +0 -50
- data/lib/super/test_support/copy_app_templates/controllers/members_controller.rb +0 -74
- data/lib/super/test_support/copy_app_templates/controllers/ships_controller.rb +0 -47
- data/lib/super/test_support/copy_app_templates/migrations/20190216224956_create_members.rb +0 -11
- data/lib/super/test_support/copy_app_templates/migrations/20190803143320_create_ships.rb +0 -11
- data/lib/super/test_support/copy_app_templates/migrations/20190806014121_add_ship_to_members.rb +0 -5
- data/lib/super/test_support/copy_app_templates/migrations/20191126050453_create_favorite_things.rb +0 -10
- data/lib/super/test_support/copy_app_templates/models/favorite_thing.rb +0 -7
- data/lib/super/test_support/copy_app_templates/models/member.rb +0 -23
- data/lib/super/test_support/copy_app_templates/models/ship.rb +0 -3
- data/lib/super/test_support/copy_app_templates/routes.rb +0 -11
- data/lib/super/test_support/copy_app_templates/seeds.rb +0 -2
- data/lib/super/test_support/copy_app_templates/views/members/_favorite_things.html.erb +0 -11
- data/lib/super/test_support/fixtures/favorite_things.yml +0 -9
- data/lib/super/test_support/fixtures/members.yml +0 -336
- data/lib/super/test_support/fixtures/ships.yml +0 -10
- data/lib/super/test_support/generate_copy_app.rb +0 -42
- data/lib/super/test_support/generate_dummy.rb +0 -93
- data/lib/super/test_support/starfleet_seeder.rb +0 -50
@@ -1,42 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "rails/generators"
|
4
|
-
require_relative "../../generators/super/install/install_generator"
|
5
|
-
|
6
|
-
class SuperCopyAppGenerator < Rails::Generators::Base
|
7
|
-
source_root(File.expand_path("copy_app_templates", __dir__))
|
8
|
-
|
9
|
-
class_option :destination, required: true
|
10
|
-
|
11
|
-
def set_destination_root
|
12
|
-
self.destination_root = options[:destination]
|
13
|
-
end
|
14
|
-
|
15
|
-
def ensure_reasonable_directory
|
16
|
-
app_path = File.join(destination_root, "app")
|
17
|
-
if !File.directory?(app_path)
|
18
|
-
raise "Can't find dir: #{app_path}"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def install_super
|
23
|
-
Super::InstallGenerator.start([], destination_root: destination_root)
|
24
|
-
end
|
25
|
-
|
26
|
-
def copy_app
|
27
|
-
directory "models", "app/models"
|
28
|
-
directory "controllers", "app/controllers/admin"
|
29
|
-
directory "views/members", "app/views/admin/members"
|
30
|
-
end
|
31
|
-
|
32
|
-
def copy_db
|
33
|
-
directory "migrations", "db/migrate"
|
34
|
-
copy_file "seeds.rb", "db/seeds.rb"
|
35
|
-
end
|
36
|
-
|
37
|
-
def copy_config
|
38
|
-
copy_file "routes.rb", "config/routes.rb"
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
SuperCopyAppGenerator.start
|
@@ -1,93 +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
|
-
module Rails
|
10
|
-
module Generators
|
11
|
-
class AppGenerator
|
12
|
-
def valid_const?
|
13
|
-
true
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
class PluginGenerator
|
18
|
-
def valid_const?
|
19
|
-
true
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
class SuperDummyGenerator < Rails::Generators::Base
|
26
|
-
source_root(File.expand_path("templates", __dir__))
|
27
|
-
|
28
|
-
class_option :destination, required: true
|
29
|
-
|
30
|
-
def create_new_plugin
|
31
|
-
if plugin_name.blank?
|
32
|
-
warn "Not currently in a plugin directory"
|
33
|
-
exit
|
34
|
-
end
|
35
|
-
|
36
|
-
opts = {
|
37
|
-
force: true,
|
38
|
-
skip_active_storage: true,
|
39
|
-
skip_action_mailer: true,
|
40
|
-
skip_action_mailbox: true,
|
41
|
-
skip_action_text: true,
|
42
|
-
skip_active_storage: true,
|
43
|
-
skip_action_cable: true,
|
44
|
-
skip_puma: true,
|
45
|
-
skip_coffee: true,
|
46
|
-
database: "sqlite3",
|
47
|
-
}
|
48
|
-
|
49
|
-
Dir.mktmpdir do |dir|
|
50
|
-
plugin_path = File.join(dir, plugin_name)
|
51
|
-
generated_dummy_path = File.join(plugin_path, "test/dummy")
|
52
|
-
|
53
|
-
invoke(Rails::Generators::PluginGenerator, [plugin_path], opts)
|
54
|
-
|
55
|
-
inside(generated_dummy_path) do
|
56
|
-
remove_file(".ruby-version")
|
57
|
-
end
|
58
|
-
|
59
|
-
FileUtils.rm_rf(dummy_path)
|
60
|
-
FileUtils.mv(generated_dummy_path, dummy_path)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def delete_unnecessary_files
|
65
|
-
inside(dummy_path) do
|
66
|
-
remove_file("app/assets/javascripts/cable.js")
|
67
|
-
remove_file("app/channels/")
|
68
|
-
remove_file("public/apple-touch-icon-precomposed.png")
|
69
|
-
remove_file("public/apple-touch-icon.png")
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
private
|
74
|
-
|
75
|
-
def dummy_path
|
76
|
-
@dummy_path ||= File.expand_path(options[:destination], destination_root)
|
77
|
-
end
|
78
|
-
|
79
|
-
def plugin_name
|
80
|
-
@plugin_name ||=
|
81
|
-
begin
|
82
|
-
filename = Dir.glob("*.gemspec").first
|
83
|
-
|
84
|
-
if filename.present?
|
85
|
-
File.basename(filename, ".gemspec")
|
86
|
-
else
|
87
|
-
""
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
SuperDummyGenerator.start
|
@@ -1,50 +0,0 @@
|
|
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
|
-
|
9
|
-
def initialize
|
10
|
-
@seeded = {}
|
11
|
-
@association_reflections = {}
|
12
|
-
end
|
13
|
-
|
14
|
-
def seed(basename, key, klass, value)
|
15
|
-
@seeded[basename] ||= {}
|
16
|
-
puts "--> #{key} (#{value})"
|
17
|
-
@association_reflections[klass] ||= klass.reflect_on_all_associations
|
18
|
-
|
19
|
-
@association_reflections[klass].each do |ar|
|
20
|
-
ar_name = ar.name.to_s
|
21
|
-
ar_plural_name = ar.plural_name.to_s
|
22
|
-
|
23
|
-
if value.key?(ar_name)
|
24
|
-
value[ar_name] = @seeded.fetch(ar_plural_name).fetch(value[ar_name])
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
@seeded[basename][key] = klass.find_or_create_by(value)
|
29
|
-
puts " success!"
|
30
|
-
rescue => e
|
31
|
-
puts " failure (#{e.message})"
|
32
|
-
end
|
33
|
-
|
34
|
-
def seed_from_fixture(basename, klass)
|
35
|
-
puts "==> #{basename}"
|
36
|
-
fixtures(basename).each do |key, value|
|
37
|
-
seed(basename, key, klass, value)
|
38
|
-
end
|
39
|
-
|
40
|
-
nil
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
def fixtures(basename)
|
46
|
-
@fixtures_dir ||= Pathname.new("./fixtures").expand_path(__dir__)
|
47
|
-
|
48
|
-
YAML.load_file(@fixtures_dir.join("#{basename}.yml"))
|
49
|
-
end
|
50
|
-
end
|