super 0.0.2 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +11 -0
- data/README.md +68 -76
- data/app/assets/javascripts/super/application.js +1252 -316
- data/app/assets/stylesheets/super/application.css +102704 -17321
- data/app/controllers/super/application_controller.rb +49 -71
- data/app/views/layouts/super/application.html.erb +10 -8
- data/app/views/super/application/_collection_header.html.erb +15 -0
- data/app/views/super/application/_filter.html.erb +14 -0
- data/app/views/super/application/_filter_type_select.html.erb +31 -0
- data/app/views/super/application/_filter_type_text.html.erb +22 -0
- data/app/views/super/application/_filter_type_timestamp.html.erb +35 -0
- data/app/views/super/application/_flash.html.erb +13 -13
- data/app/views/super/application/_form_field__destroy.html.erb +9 -0
- data/app/views/super/application/_form_field_select.html.erb +23 -0
- data/app/views/super/application/_form_field_text.html.erb +13 -0
- data/app/views/super/application/_form_fieldset.html.erb +8 -0
- data/app/views/super/application/_form_has_many.html.erb +21 -0
- data/app/views/super/application/_form_has_one.html.erb +11 -0
- data/app/views/super/application/_form_inline_errors.html.erb +10 -0
- data/app/views/super/application/_member_header.html.erb +16 -0
- data/app/views/super/application/_super_layout.html.erb +29 -0
- data/app/views/super/application/_super_pagination.html.erb +16 -0
- data/app/views/super/application/_super_panel.html.erb +7 -0
- data/app/views/super/application/_super_schema_display_actions.html.erb +5 -0
- data/app/views/super/application/_super_schema_display_index.html.erb +24 -0
- data/app/views/super/application/_super_schema_display_show.html.erb +8 -0
- data/app/views/super/application/_super_schema_form.html.erb +15 -0
- data/app/views/super/application/edit.html.erb +1 -6
- data/app/views/super/application/index.html.erb +1 -1
- data/app/views/super/application/new.html.erb +1 -6
- data/app/views/super/application/show.html.erb +1 -1
- data/app/views/super/feather/{_chevron_down.svg → _chevron_down.html} +0 -0
- data/config/locales/en.yml +5 -0
- data/docs/README.md +6 -0
- data/docs/cheat.md +41 -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/build.js +14 -12
- data/frontend/super-frontend/dist/application.css +102704 -17321
- data/frontend/super-frontend/dist/application.js +1252 -316
- data/frontend/super-frontend/package.json +11 -4
- data/frontend/super-frontend/postcss.config.js +4 -4
- data/frontend/super-frontend/src/javascripts/super/application.ts +18 -0
- data/frontend/super-frontend/src/javascripts/super/apply_template_controller.ts +19 -0
- data/frontend/super-frontend/src/javascripts/super/rails__ujs.d.ts +1 -0
- data/frontend/super-frontend/src/javascripts/super/toggle_pending_destruction_controller.ts +15 -0
- data/frontend/super-frontend/src/stylesheets/super/application.css +63 -0
- data/frontend/super-frontend/tailwind.config.js +12 -4
- data/frontend/super-frontend/tsconfig.json +13 -0
- data/frontend/super-frontend/yarn.lock +1891 -1798
- data/lib/generators/super/install/install_generator.rb +16 -0
- data/lib/generators/super/webpacker/webpacker_generator.rb +8 -0
- data/lib/super.rb +16 -6
- data/lib/super/action_inquirer.rb +14 -1
- data/lib/super/assets.rb +1 -0
- data/lib/super/client_error.rb +43 -0
- data/lib/super/compatibility.rb +25 -0
- data/lib/super/configuration.rb +66 -44
- data/lib/super/controls.rb +26 -15
- data/lib/super/controls/optional.rb +54 -0
- data/lib/super/controls/required.rb +41 -0
- data/lib/super/controls/steps.rb +128 -0
- data/lib/super/display/schema_types.rb +90 -18
- data/lib/super/engine.rb +7 -0
- data/lib/super/error.rb +9 -8
- data/lib/super/filter.rb +137 -0
- data/lib/super/filter/operator.rb +103 -0
- data/lib/super/filter/schema_types.rb +118 -0
- data/lib/super/form.rb +48 -0
- data/lib/super/form/schema_types.rb +96 -21
- data/lib/super/layout.rb +47 -0
- data/lib/super/link.rb +110 -0
- data/lib/super/navigation/automatic.rb +2 -0
- data/lib/super/pagination.rb +80 -8
- data/lib/super/panel.rb +30 -0
- data/lib/super/partial.rb +23 -0
- data/lib/super/partial/resolving.rb +24 -0
- data/lib/super/plugin.rb +34 -63
- data/lib/super/schema.rb +65 -1
- data/lib/super/version.rb +1 -1
- data/lib/super/view_helper.rb +43 -0
- metadata +132 -33
- data/app/views/super/application/_form.html.erb +0 -15
- data/app/views/super/application/_form_field.html.erb +0 -7
- data/app/views/super/application/_form_generic_select.html.erb +0 -19
- data/app/views/super/application/_form_generic_text.html.erb +0 -7
- data/app/views/super/application/_index.html.erb +0 -60
- data/app/views/super/application/_show.html.erb +0 -12
- data/frontend/super-frontend/src/javascripts/super/application.js +0 -11
- data/lib/super/display.rb +0 -9
- data/lib/super/inline_callback.rb +0 -82
- data/lib/super/test_support/copy_app_templates/20190216224956_create_members.rb +0 -11
- data/lib/super/test_support/copy_app_templates/20190803143320_create_ships.rb +0 -11
- data/lib/super/test_support/copy_app_templates/20190806014121_add_ship_to_members.rb +0 -5
- data/lib/super/test_support/copy_app_templates/member.rb +0 -16
- data/lib/super/test_support/copy_app_templates/members_controller.rb +0 -52
- data/lib/super/test_support/copy_app_templates/routes.rb +0 -10
- data/lib/super/test_support/copy_app_templates/seeds.rb +0 -2
- data/lib/super/test_support/copy_app_templates/ship.rb +0 -3
- data/lib/super/test_support/copy_app_templates/ships_controller.rb +0 -47
- 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 -52
- data/lib/super/test_support/generate_dummy.rb +0 -94
- data/lib/super/test_support/starfleet_seeder.rb +0 -49
- data/lib/super/view.rb +0 -25
- data/lib/tasks/super_tasks.rake +0 -4
@@ -1,52 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "rails/generators"
|
4
|
-
|
5
|
-
class SuperCopyAppGenerator < Rails::Generators::Base
|
6
|
-
source_root(File.expand_path("copy_app_templates", __dir__))
|
7
|
-
|
8
|
-
class_option :destination, required: true
|
9
|
-
|
10
|
-
def set_destination_root
|
11
|
-
self.destination_root = options[:destination]
|
12
|
-
end
|
13
|
-
|
14
|
-
def ensure_reasonable_directory
|
15
|
-
app_path = File.join(destination_root, "app")
|
16
|
-
if !File.directory?(app_path)
|
17
|
-
raise "Can't find dir: #{app_path}"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def install_super
|
22
|
-
Rails::Generators.invoke("super:install", [], destination_root: destination_root)
|
23
|
-
end
|
24
|
-
|
25
|
-
def copy_app
|
26
|
-
copy_file "member.rb", "app/models/member.rb"
|
27
|
-
copy_file "ship.rb", "app/models/ship.rb"
|
28
|
-
|
29
|
-
copy_file "ships_controller.rb", "app/controllers/admin/ships_controller.rb"
|
30
|
-
copy_file "members_controller.rb", "app/controllers/admin/members_controller.rb"
|
31
|
-
end
|
32
|
-
|
33
|
-
def copy_db
|
34
|
-
migrations = [
|
35
|
-
"20190216224956_create_members.rb",
|
36
|
-
"20190803143320_create_ships.rb",
|
37
|
-
"20190806014121_add_ship_to_members.rb",
|
38
|
-
]
|
39
|
-
|
40
|
-
migrations.each do |migration|
|
41
|
-
copy_file migration, "db/migrate/#{migration}"
|
42
|
-
end
|
43
|
-
|
44
|
-
copy_file "seeds.rb", "db/seeds.rb"
|
45
|
-
end
|
46
|
-
|
47
|
-
def copy_config
|
48
|
-
copy_file "routes.rb", "config/routes.rb"
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
SuperCopyAppGenerator.start
|
@@ -1,94 +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
|
-
remove_file("public/favicon.ico")
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
private
|
75
|
-
|
76
|
-
def dummy_path
|
77
|
-
@dummy_path ||= File.expand_path(options[:destination], destination_root)
|
78
|
-
end
|
79
|
-
|
80
|
-
def plugin_name
|
81
|
-
@plugin_name ||=
|
82
|
-
begin
|
83
|
-
filename = Dir.glob("*.gemspec").first
|
84
|
-
|
85
|
-
if filename.present?
|
86
|
-
File.basename(filename, ".gemspec")
|
87
|
-
else
|
88
|
-
""
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
SuperDummyGenerator.start
|
@@ -1,49 +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
|
-
end
|
7
|
-
|
8
|
-
def initialize
|
9
|
-
@seeded = {}
|
10
|
-
@association_reflections = {}
|
11
|
-
end
|
12
|
-
|
13
|
-
def seed(basename, key, klass, value)
|
14
|
-
@seeded[basename] ||= {}
|
15
|
-
puts "--> #{key} (#{value})"
|
16
|
-
@association_reflections[klass] ||= klass.reflect_on_all_associations
|
17
|
-
|
18
|
-
@association_reflections[klass].each do |ar|
|
19
|
-
ar_name = ar.name.to_s
|
20
|
-
ar_plural_name = ar.plural_name.to_s
|
21
|
-
|
22
|
-
if value.key?(ar_name)
|
23
|
-
value[ar_name] = @seeded.fetch(ar_plural_name).fetch(value[ar_name])
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
@seeded[basename][key] = klass.find_or_create_by(value)
|
28
|
-
puts " success!"
|
29
|
-
rescue => e
|
30
|
-
puts " failure (#{e.message})"
|
31
|
-
end
|
32
|
-
|
33
|
-
def seed_from_fixture(basename, klass)
|
34
|
-
puts "==> #{basename}"
|
35
|
-
fixtures(basename).each do |key, value|
|
36
|
-
seed(basename, key, klass, value)
|
37
|
-
end
|
38
|
-
|
39
|
-
nil
|
40
|
-
end
|
41
|
-
|
42
|
-
private
|
43
|
-
|
44
|
-
def fixtures(basename)
|
45
|
-
@fixtures_dir ||= Pathname.new("./fixtures").expand_path(__dir__)
|
46
|
-
|
47
|
-
YAML.load_file(@fixtures_dir.join("#{basename}.yml"))
|
48
|
-
end
|
49
|
-
end
|
data/lib/super/view.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
module Super
|
2
|
-
module View
|
3
|
-
module_function
|
4
|
-
|
5
|
-
def gutter_h(pm, positive = true)
|
6
|
-
if pm == :p
|
7
|
-
if positive
|
8
|
-
"px-2"
|
9
|
-
else
|
10
|
-
raise Error::InvalidStyle, "invalid style: -px-2"
|
11
|
-
end
|
12
|
-
else
|
13
|
-
if positive
|
14
|
-
"mx-2"
|
15
|
-
else
|
16
|
-
"-mx-2"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def classes(*list)
|
22
|
-
list.flatten.select(&:present?).join(" ")
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/lib/tasks/super_tasks.rake
DELETED