script_core 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/.gitattributes +1 -1
- data/.gitignore +15 -1
- data/.rubocop.yml +10 -2
- data/.ruby-version +1 -1
- data/.travis.yml +6 -0
- data/Gemfile +32 -0
- data/README.md +169 -6
- data/Rakefile +11 -0
- data/Vagrantfile +1 -1
- data/bin/rails +25 -0
- data/bootstrap.sh +2 -3
- data/dev.yml +4 -4
- data/ext/enterprise_script_service/Rakefile +5 -4
- data/ext/enterprise_script_service/mruby_config.rb +1 -0
- data/lib/script_core.rb +17 -15
- data/lib/script_core/engine.rb +1 -0
- data/lib/script_core/executable.rb +1 -1
- data/lib/script_core/railtie.rb +8 -0
- data/lib/script_core/spawner.rb +1 -0
- data/lib/script_core/version.rb +1 -1
- data/lib/tasks/mruby/engine.gembox.example +19 -0
- data/lib/tasks/mruby/lib/.keep +0 -0
- data/lib/tasks/script_core.rake +111 -0
- data/script/regression +7 -5
- data/script_core.gemspec +2 -2
- data/spec/dummy/Rakefile +8 -0
- data/spec/dummy/app/assets/config/manifest.js +3 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.es6 +56 -0
- data/spec/dummy/app/assets/stylesheets/application.scss +65 -0
- data/spec/dummy/app/controllers/application_controller.rb +4 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/controllers/fields/application_controller.rb +25 -0
- data/spec/dummy/app/controllers/fields/options_controller.rb +26 -0
- data/spec/dummy/app/controllers/fields/validations_controller.rb +26 -0
- data/spec/dummy/app/controllers/forms/application_controller.rb +14 -0
- data/spec/dummy/app/controllers/forms/fields_controller.rb +56 -0
- data/spec/dummy/app/controllers/forms/formulas/application_controller.rb +19 -0
- data/spec/dummy/app/controllers/forms/formulas/playgrounds_controller.rb +29 -0
- data/spec/dummy/app/controllers/forms/formulas_controller.rb +56 -0
- data/spec/dummy/app/controllers/forms_controller.rb +58 -0
- data/spec/dummy/app/controllers/home_controller.rb +7 -0
- data/spec/dummy/app/controllers/nested_forms/application_controller.rb +12 -0
- data/spec/dummy/app/controllers/nested_forms/fields_controller.rb +50 -0
- data/spec/dummy/app/controllers/playgrounds_controller.rb +29 -0
- data/spec/dummy/app/decorators/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +21 -0
- data/spec/dummy/app/helpers/fields_helper.rb +32 -0
- data/spec/dummy/app/helpers/forms_helper.rb +14 -0
- data/spec/dummy/app/jobs/application_job.rb +4 -0
- data/spec/dummy/app/lib/script_engine.rb +22 -0
- data/spec/dummy/app/models/application_record.rb +8 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/concerns/acts_as_default_value.rb +152 -0
- data/spec/dummy/app/models/concerns/enum_attribute_localizable.rb +32 -0
- data/spec/dummy/app/models/concerns/fields/validations/acceptance.rb +18 -0
- data/spec/dummy/app/models/concerns/fields/validations/confirmation.rb +18 -0
- data/spec/dummy/app/models/concerns/fields/validations/exclusion.rb +35 -0
- data/spec/dummy/app/models/concerns/fields/validations/format.rb +45 -0
- data/spec/dummy/app/models/concerns/fields/validations/inclusion.rb +35 -0
- data/spec/dummy/app/models/concerns/fields/validations/length.rb +59 -0
- data/spec/dummy/app/models/concerns/fields/validations/numericality.rb +56 -0
- data/spec/dummy/app/models/concerns/fields/validations/presence.rb +18 -0
- data/spec/dummy/app/models/concerns/form_core/acts_as_default_value.rb +143 -0
- data/spec/dummy/app/models/field.rb +67 -0
- data/spec/dummy/app/models/field_options.rb +90 -0
- data/spec/dummy/app/models/fields.rb +10 -0
- data/spec/dummy/app/models/fields/boolean_field.rb +12 -0
- data/spec/dummy/app/models/fields/decimal_field.rb +12 -0
- data/spec/dummy/app/models/fields/integer_field.rb +20 -0
- data/spec/dummy/app/models/fields/multiple_nested_form_field.rb +35 -0
- data/spec/dummy/app/models/fields/nested_form_field.rb +37 -0
- data/spec/dummy/app/models/fields/options/boolean_field.rb +6 -0
- data/spec/dummy/app/models/fields/options/decimal_field.rb +12 -0
- data/spec/dummy/app/models/fields/options/integer_field.rb +13 -0
- data/spec/dummy/app/models/fields/options/multiple_nested_form_field.rb +6 -0
- data/spec/dummy/app/models/fields/options/nested_form_field.rb +6 -0
- data/spec/dummy/app/models/fields/options/text_field.rb +7 -0
- data/spec/dummy/app/models/fields/text_field.rb +12 -0
- data/spec/dummy/app/models/fields/validations/boolean_field.rb +7 -0
- data/spec/dummy/app/models/fields/validations/decimal_field.rb +8 -0
- data/spec/dummy/app/models/fields/validations/integer_field.rb +8 -0
- data/spec/dummy/app/models/fields/validations/multiple_nested_form_field.rb +8 -0
- data/spec/dummy/app/models/fields/validations/nested_form_field.rb +7 -0
- data/spec/dummy/app/models/fields/validations/text_field.rb +9 -0
- data/spec/dummy/app/models/form.rb +8 -0
- data/spec/dummy/app/models/formula.rb +8 -0
- data/spec/dummy/app/models/metal_form.rb +9 -0
- data/spec/dummy/app/models/nested_form.rb +5 -0
- data/spec/dummy/app/models/virtual_model.rb +23 -0
- data/spec/dummy/app/presenters/application_presenter.rb +11 -0
- data/spec/dummy/app/presenters/concerns/fields/presenter_for_number_field.rb +36 -0
- data/spec/dummy/app/presenters/fields/boolean_field_presenter.rb +13 -0
- data/spec/dummy/app/presenters/fields/composite_field_presenter.rb +13 -0
- data/spec/dummy/app/presenters/fields/decimal_field_presenter.rb +7 -0
- data/spec/dummy/app/presenters/fields/field_presenter.rb +44 -0
- data/spec/dummy/app/presenters/fields/integer_field_presenter.rb +11 -0
- data/spec/dummy/app/presenters/fields/multiple_nested_form_field_presenter.rb +9 -0
- data/spec/dummy/app/presenters/fields/nested_form_field_presenter.rb +9 -0
- data/spec/dummy/app/presenters/fields/text_field_presenter.rb +10 -0
- data/spec/dummy/app/views/_form_core/field_options/_decimal_field.html.erb +9 -0
- data/spec/dummy/app/views/_form_core/field_options/_integer_field.html.erb +10 -0
- data/spec/dummy/app/views/_form_core/field_options/_text_field.html.erb +12 -0
- data/spec/dummy/app/views/_form_core/fields/_boolean_field.html.erb +11 -0
- data/spec/dummy/app/views/_form_core/fields/_decimal_field.html.erb +9 -0
- data/spec/dummy/app/views/_form_core/fields/_integer_field.html.erb +9 -0
- data/spec/dummy/app/views/_form_core/fields/_multiple_nested_form_field.html.erb +23 -0
- data/spec/dummy/app/views/_form_core/fields/_nested_form.html.erb +37 -0
- data/spec/dummy/app/views/_form_core/fields/_nested_form_field.html.erb +42 -0
- data/spec/dummy/app/views/_form_core/fields/_text_field.html.erb +13 -0
- data/spec/dummy/app/views/_form_core/preview/_form.html.erb +17 -0
- data/spec/dummy/app/views/_form_core/preview/_nested_form.html.erb +22 -0
- data/spec/dummy/app/views/_form_core/render/_form.html.erb +39 -0
- data/spec/dummy/app/views/_form_core/validations/_acceptance.html.erb +12 -0
- data/spec/dummy/app/views/_form_core/validations/_confirmation.html.erb +12 -0
- data/spec/dummy/app/views/_form_core/validations/_exclusion.html.erb +2 -0
- data/spec/dummy/app/views/_form_core/validations/_format.html.erb +37 -0
- data/spec/dummy/app/views/_form_core/validations/_inclusion.html.erb +2 -0
- data/spec/dummy/app/views/_form_core/validations/_length.html.erb +44 -0
- data/spec/dummy/app/views/_form_core/validations/_numericality.html.erb +45 -0
- data/spec/dummy/app/views/_form_core/validations/_presence.html.erb +12 -0
- data/spec/dummy/app/views/fields/options/_form.html.erb +29 -0
- data/spec/dummy/app/views/fields/options/edit.html.erb +6 -0
- data/spec/dummy/app/views/fields/validations/_form.html.erb +34 -0
- data/spec/dummy/app/views/fields/validations/edit.html.erb +6 -0
- data/spec/dummy/app/views/forms/_form.html.erb +41 -0
- data/spec/dummy/app/views/forms/edit.html.erb +6 -0
- data/spec/dummy/app/views/forms/fields/_form.html.erb +71 -0
- data/spec/dummy/app/views/forms/fields/edit.html.erb +6 -0
- data/spec/dummy/app/views/forms/fields/index.html.erb +42 -0
- data/spec/dummy/app/views/forms/fields/new.html.erb +6 -0
- data/spec/dummy/app/views/forms/formulas/_form.html.erb +41 -0
- data/spec/dummy/app/views/forms/formulas/edit.html.erb +6 -0
- data/spec/dummy/app/views/forms/formulas/index.html.erb +28 -0
- data/spec/dummy/app/views/forms/formulas/new.html.erb +6 -0
- data/spec/dummy/app/views/forms/formulas/playgrounds/create.html.erb +48 -0
- data/spec/dummy/app/views/forms/formulas/playgrounds/show.html.erb +14 -0
- data/spec/dummy/app/views/forms/index.html.erb +31 -0
- data/spec/dummy/app/views/forms/new.html.erb +6 -0
- data/spec/dummy/app/views/home/index.html.erb +5 -0
- data/spec/dummy/app/views/layouts/_alert.html.erb +4 -0
- data/spec/dummy/app/views/layouts/_footer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/_nav.html.erb +11 -0
- data/spec/dummy/app/views/layouts/_notice.html.erb +4 -0
- data/spec/dummy/app/views/layouts/application.html.erb +25 -0
- data/spec/dummy/app/views/layouts/forms.html.erb +33 -0
- data/spec/dummy/app/views/nested_forms/fields/_form.html.erb +68 -0
- data/spec/dummy/app/views/nested_forms/fields/edit.html.erb +6 -0
- data/spec/dummy/app/views/nested_forms/fields/index.html.erb +39 -0
- data/spec/dummy/app/views/nested_forms/fields/new.html.erb +6 -0
- data/spec/dummy/app/views/playgrounds/_form.html.erb +13 -0
- data/spec/dummy/app/views/playgrounds/create.html.erb +51 -0
- data/spec/dummy/app/views/playgrounds/show.html.erb +7 -0
- data/spec/dummy/bin/bundle +5 -0
- data/spec/dummy/bin/rails +6 -0
- data/spec/dummy/bin/rake +6 -0
- data/spec/dummy/bin/setup +40 -0
- data/spec/dummy/bin/update +35 -0
- data/spec/dummy/bin/yarn +13 -0
- data/spec/dummy/config.ru +7 -0
- data/spec/dummy/config/application.rb +35 -0
- data/spec/dummy/config/boot.rb +7 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +7 -0
- data/spec/dummy/config/environments/development.rb +58 -0
- data/spec/dummy/config/environments/production.rb +85 -0
- data/spec/dummy/config/environments/test.rb +41 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +10 -0
- data/spec/dummy/config/initializers/assets.rb +16 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +9 -0
- data/spec/dummy/config/initializers/content_security_policy.rb +27 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -0
- data/spec/dummy/config/initializers/form_core.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +18 -0
- data/spec/dummy/config/initializers/mime_types.rb +6 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +16 -0
- data/spec/dummy/config/locales/en.yml +33 -0
- data/spec/dummy/config/puma.rb +36 -0
- data/spec/dummy/config/routes.rb +31 -0
- data/spec/dummy/config/spring.rb +8 -0
- data/spec/dummy/config/storage.yml +34 -0
- data/spec/dummy/db/migrate/20180916202025_create_forms.form_core.rb +12 -0
- data/spec/dummy/db/migrate/20180916202026_add_columns_to_forms.rb +10 -0
- data/spec/dummy/db/migrate/20180916202027_add_attachable_to_forms.rb +9 -0
- data/spec/dummy/db/migrate/20180916202030_create_fields.form_core.rb +17 -0
- data/spec/dummy/db/migrate/20180916202121_add_columns_to_fields.rb +10 -0
- data/spec/dummy/db/migrate/20180916202124_add_position_to_fields.rb +9 -0
- data/spec/dummy/db/migrate/20181111111412_create_formulas.rb +13 -0
- data/spec/dummy/db/schema.rb +52 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/lib/monkey_patches/active_support.rb +3 -0
- data/spec/dummy/lib/monkey_patches/active_support/concern+prependable.rb +28 -0
- data/spec/dummy/lib/monkey_patches/big_decimal.rb +8 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/mruby/engine.gembox +19 -0
- data/spec/dummy/mruby/lib/.keep +0 -0
- data/spec/dummy/mruby/lib/core_ext.rb +62 -0
- data/spec/dummy/mruby/lib/harden.rb +1 -0
- data/spec/dummy/mruby/lib/input.rb +20 -0
- data/spec/dummy/mruby/lib/io.rb +19 -0
- data/spec/dummy/mruby/lib/output.rb +35 -0
- data/spec/dummy/mruby/lib/script_kernel.rb +12 -0
- data/spec/dummy/package.json +5 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/storage/.keep +0 -0
- data/spec/dummy/test/controllers/.keep +0 -0
- data/spec/dummy/test/fixtures/.keep +0 -0
- data/spec/dummy/test/models/.keep +0 -0
- data/spec/script_core_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -2
- metadata +199 -5
- data/circle.yml +0 -9
@@ -0,0 +1,11 @@
|
|
1
|
+
<nav class="navbar has-shadow" role="navigation" aria-label="main navigation">
|
2
|
+
<div class="container">
|
3
|
+
<div class="navbar-brand">
|
4
|
+
<%= link_to "Script Core", root_path, class: "navbar-item" %>
|
5
|
+
</div>
|
6
|
+
<div class="navbar-end">
|
7
|
+
<%= link_to "Playground", playground_path, class: "navbar-item #{"is-active" if controller_name == "playgrounds"}" %>
|
8
|
+
<%= link_to "Forms", forms_path, class: "navbar-item #{"is-active" if controller.class.to_s.split("::").first =~ /\A(FormsController|Forms)\z/}" %>
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
</nav>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<title>Script Core</title>
|
5
|
+
|
6
|
+
<%= csrf_meta_tags %>
|
7
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
8
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/>
|
10
|
+
|
11
|
+
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track": "reload" %>
|
12
|
+
<%= javascript_include_tag "application", "data-turbolinks-track": "reload" %>
|
13
|
+
</head>
|
14
|
+
<body>
|
15
|
+
<%= render "layouts/notice" %>
|
16
|
+
<%= render "layouts/alert" %>
|
17
|
+
<%= render "layouts/nav" %>
|
18
|
+
|
19
|
+
<main class="main">
|
20
|
+
<%= content_for?(:content) ? yield(:content) : yield %>
|
21
|
+
</main>
|
22
|
+
|
23
|
+
<%= render "layouts/footer" %>
|
24
|
+
</body>
|
25
|
+
</html>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<% content_for :content do %>
|
2
|
+
<section class="hero is-primary">
|
3
|
+
<div class="hero-body">
|
4
|
+
<div class="container">
|
5
|
+
<p class="title">
|
6
|
+
<%= @form.title %>
|
7
|
+
</p>
|
8
|
+
<p class="subtitle">
|
9
|
+
<%= @form.description %>
|
10
|
+
</p>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<div class="hero-foot">
|
15
|
+
<div class="container">
|
16
|
+
<nav class="tabs is-boxed">
|
17
|
+
<ul>
|
18
|
+
<%= content_tag(:li, class: "#{"is-active" if controller_name == "fields"}") do %>
|
19
|
+
<%= link_to "Fields", form_fields_path(@form) %>
|
20
|
+
<% end %>
|
21
|
+
<%= content_tag(:li, class: "#{"is-active" if controller.class.to_s.start_with?("Forms::Formulas")}") do %>
|
22
|
+
<%= link_to "Formulas", form_formulas_path(@form) %>
|
23
|
+
<% end %>
|
24
|
+
</ul>
|
25
|
+
</nav>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
</section>
|
29
|
+
|
30
|
+
<%= yield %>
|
31
|
+
<% end %>
|
32
|
+
|
33
|
+
<%= render template: "layouts/application" %>
|
@@ -0,0 +1,68 @@
|
|
1
|
+
<%= form_with(model: [form, field.becomes(Field)], scope: :field, local: true) do |f| %>
|
2
|
+
<% if field.errors.any? %>
|
3
|
+
<article class="message is-danger">
|
4
|
+
<div class="message-header">
|
5
|
+
<p>
|
6
|
+
<%= pluralize(field.errors.count, "error") %> prohibited this form from being saved:
|
7
|
+
</p>
|
8
|
+
</div>
|
9
|
+
<div class="message-body content">
|
10
|
+
<ul>
|
11
|
+
<% field.errors.full_messages.each do |message| %>
|
12
|
+
<li><%= message %></li>
|
13
|
+
<% end %>
|
14
|
+
</ul>
|
15
|
+
</div>
|
16
|
+
</article>
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<div class="field">
|
20
|
+
<%= f.label :name, class: "label" %>
|
21
|
+
<div class="control">
|
22
|
+
<%= f.text_field :name, class: "input", placeholder: "Name" %>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<div class="field">
|
27
|
+
<%= f.label :label, class: "label" %>
|
28
|
+
<div class="control">
|
29
|
+
<%= f.text_field :label, class: "input", placeholder: "Label" %>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
<div class="field">
|
34
|
+
<%= f.label :hint, class: "label" %>
|
35
|
+
<div class="control">
|
36
|
+
<%= f.text_field :hint, class: "input", placeholder: "Hint" %>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<div class="field">
|
41
|
+
<%= f.label :type, class: "label" %>
|
42
|
+
<div class="control">
|
43
|
+
<span class="select">
|
44
|
+
<%= f.select :type, options_for_field_types(selected: field.class.to_s) %>
|
45
|
+
</span>
|
46
|
+
</div>
|
47
|
+
</div>
|
48
|
+
|
49
|
+
<div class="field">
|
50
|
+
<div class="control">
|
51
|
+
<% Field.accessibilities.each do |k, _| %>
|
52
|
+
<label class="radio">
|
53
|
+
<%= f.radio_button :accessibility, k %>
|
54
|
+
<%= Field.human_enum_value :accessibility, k %>
|
55
|
+
</label>
|
56
|
+
<% end %>
|
57
|
+
</div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div class="field is-grouped">
|
61
|
+
<div class="control">
|
62
|
+
<%= f.submit class: "button is-primary" %>
|
63
|
+
</div>
|
64
|
+
<div class="control">
|
65
|
+
<%= link_to "Back", url_for(:back), class: "button is-link" %>
|
66
|
+
</div>
|
67
|
+
</div>
|
68
|
+
<% end %>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<div class="section">
|
2
|
+
<div class="container">
|
3
|
+
<p content="content">
|
4
|
+
<%= link_to "New field", new_nested_form_field_path(@nested_form), class: "button is-primary" %>
|
5
|
+
<%= link_to "Back", smart_form_fields_path(@nested_form.attachable.form), class: "button is-link" %>
|
6
|
+
</p>
|
7
|
+
<table class="table is-fullwidth">
|
8
|
+
<thead>
|
9
|
+
<tr>
|
10
|
+
<th>Name</th>
|
11
|
+
<th>Label</th>
|
12
|
+
<th>Type</th>
|
13
|
+
<th>Accessibility</th>
|
14
|
+
<th></th>
|
15
|
+
</tr>
|
16
|
+
</thead>
|
17
|
+
<tbody>
|
18
|
+
<% @fields.each do |field| %>
|
19
|
+
<tr>
|
20
|
+
<td><%= field.name %></td>
|
21
|
+
<td><%= field.label %></td>
|
22
|
+
<td><%= field.class.model_name.human %></td>
|
23
|
+
<td><%= Field.human_enum_value(:accessibility, field.accessibility) %></td>
|
24
|
+
<td>
|
25
|
+
<%= link_to "Validations", edit_field_validations_path(field) %> |
|
26
|
+
<%= link_to "Options", edit_field_options_path(field) %> |
|
27
|
+
<% if nested_form_attached_field?(field) %>
|
28
|
+
<%= link_to "Fields", nested_form_fields_path(field.nested_form) %> |
|
29
|
+
<% end %>
|
30
|
+
<%= link_to "Edit", edit_nested_form_field_path(@nested_form, field) %> |
|
31
|
+
<%= link_to "Destroy", nested_form_field_path(@nested_form, field), method: :delete, data: {confirm: "Are you sure?"} %>
|
32
|
+
</td>
|
33
|
+
</tr>
|
34
|
+
<% end %>
|
35
|
+
</tbody>
|
36
|
+
</table>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= form_with url: playground_path, method: :post, local: true do |f| %>
|
2
|
+
<div class="field">
|
3
|
+
<div class="control">
|
4
|
+
<%= text_area_tag :source, source, class: "textarea", rows: 10, placeholder: "# Ruby code here" %>
|
5
|
+
</div>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div class="field is-grouped">
|
9
|
+
<div class="control">
|
10
|
+
<%= f.submit "Run", class: "button is-primary" %>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
@@ -0,0 +1,51 @@
|
|
1
|
+
<section class="section">
|
2
|
+
<div class="container">
|
3
|
+
<h2 class="title">Results</h2>
|
4
|
+
|
5
|
+
<% if @result.errors.any? %>
|
6
|
+
<div class="content">
|
7
|
+
<h3>Error</h3>
|
8
|
+
|
9
|
+
<ul>
|
10
|
+
<% @result.errors.each do |error| %>
|
11
|
+
<li><%= error.message %></li>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
14
|
+
</div>
|
15
|
+
<% else %>
|
16
|
+
<div class="content">
|
17
|
+
<h3>Output</h3>
|
18
|
+
|
19
|
+
<pre><%= @result.output %></pre>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<div class="content">
|
23
|
+
<h3>Stdout</h3>
|
24
|
+
|
25
|
+
<pre><%= @result.stdout %></pre>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<div class="content">
|
29
|
+
<h3>Stat</h3>
|
30
|
+
|
31
|
+
<dl>
|
32
|
+
<dt>Instructions</dt>
|
33
|
+
<dd><%= @result.stat.instructions %></dd>
|
34
|
+
<dt>Memory</dt>
|
35
|
+
<dd><%= @result.stat.memory %> B</dd>
|
36
|
+
<dt>Time</dt>
|
37
|
+
<dd><%= @result.measurements.values.reduce(&:+) %> µs</dd>
|
38
|
+
</dl>
|
39
|
+
</div>
|
40
|
+
<% end %>
|
41
|
+
</div>
|
42
|
+
</section>
|
43
|
+
|
44
|
+
<section class="section">
|
45
|
+
<div class="container">
|
46
|
+
<h2 class="title">Source</h2>
|
47
|
+
|
48
|
+
<%= render "form", source: @source %>
|
49
|
+
</div>
|
50
|
+
</section>
|
51
|
+
|
data/spec/dummy/bin/rake
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# rubocop:disable Style/MixinUsage
|
5
|
+
require "fileutils"
|
6
|
+
include FileUtils
|
7
|
+
# rubocop:enable Style/MixinUsage
|
8
|
+
|
9
|
+
# path to your application root.
|
10
|
+
APP_ROOT = File.expand_path("..", __dir__)
|
11
|
+
|
12
|
+
def system!(*args)
|
13
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
14
|
+
end
|
15
|
+
|
16
|
+
chdir APP_ROOT do
|
17
|
+
# This script is a starting point to setup your application.
|
18
|
+
# Add necessary setup steps to this file.
|
19
|
+
|
20
|
+
puts "== Installing dependencies =="
|
21
|
+
system! "gem install bundler --conservative"
|
22
|
+
system("bundle check") || system!("bundle install")
|
23
|
+
|
24
|
+
# Install JavaScript dependencies if using Yarn
|
25
|
+
# system('bin/yarn')
|
26
|
+
|
27
|
+
# puts "\n== Copying sample files =="
|
28
|
+
# unless File.exist?('config/database.yml')
|
29
|
+
# cp 'config/database.yml.sample', 'config/database.yml'
|
30
|
+
# end
|
31
|
+
|
32
|
+
puts "\n== Preparing database =="
|
33
|
+
system! "bin/rails db:setup"
|
34
|
+
|
35
|
+
puts "\n== Removing old logs and tempfiles =="
|
36
|
+
system! "bin/rails log:clear tmp:clear"
|
37
|
+
|
38
|
+
puts "\n== Restarting application server =="
|
39
|
+
system! "bin/rails restart"
|
40
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# rubocop:disable Style/MixinUsage
|
5
|
+
require "fileutils"
|
6
|
+
include FileUtils
|
7
|
+
# rubocop:enable Style/MixinUsage
|
8
|
+
|
9
|
+
# path to your application root.
|
10
|
+
APP_ROOT = File.expand_path("..", __dir__)
|
11
|
+
|
12
|
+
def system!(*args)
|
13
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
14
|
+
end
|
15
|
+
|
16
|
+
chdir APP_ROOT do
|
17
|
+
# This script is a way to update your development environment automatically.
|
18
|
+
# Add necessary update steps to this file.
|
19
|
+
|
20
|
+
puts "== Installing dependencies =="
|
21
|
+
system! "gem install bundler --conservative"
|
22
|
+
system("bundle check") || system!("bundle install")
|
23
|
+
|
24
|
+
# Install JavaScript dependencies if using Yarn
|
25
|
+
# system('bin/yarn')
|
26
|
+
|
27
|
+
puts "\n== Updating database =="
|
28
|
+
system! "bin/rails db:migrate"
|
29
|
+
|
30
|
+
puts "\n== Removing old logs and tempfiles =="
|
31
|
+
system! "bin/rails log:clear tmp:clear"
|
32
|
+
|
33
|
+
puts "\n== Restarting application server =="
|
34
|
+
system! "bin/rails restart"
|
35
|
+
end
|
data/spec/dummy/bin/yarn
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
APP_ROOT = File.expand_path("..", __dir__)
|
5
|
+
Dir.chdir(APP_ROOT) do
|
6
|
+
begin
|
7
|
+
exec "yarnpkg", *ARGV
|
8
|
+
rescue Errno::ENOENT
|
9
|
+
warn "Yarn executable was not detected in the system."
|
10
|
+
warn "Download Yarn at https://yarnpkg.com/en/docs/install"
|
11
|
+
exit 1
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "boot"
|
4
|
+
|
5
|
+
require "rails"
|
6
|
+
# Pick the frameworks you want:
|
7
|
+
require "active_model/railtie"
|
8
|
+
# require "active_job/railtie"
|
9
|
+
require "active_record/railtie"
|
10
|
+
# require "active_storage/engine"
|
11
|
+
require "action_controller/railtie"
|
12
|
+
# require "action_mailer/railtie"
|
13
|
+
require "action_view/railtie"
|
14
|
+
# require "action_cable/engine"
|
15
|
+
require "sprockets/railtie"
|
16
|
+
require "rails/test_unit/railtie"
|
17
|
+
|
18
|
+
Bundler.require(*Rails.groups)
|
19
|
+
require "script_core"
|
20
|
+
|
21
|
+
Dir[Pathname.new(File.dirname(__FILE__)).realpath.parent.join("lib", "monkey_patches", "*.rb")].map do |file|
|
22
|
+
require file
|
23
|
+
end
|
24
|
+
|
25
|
+
module Dummy
|
26
|
+
class Application < Rails::Application
|
27
|
+
# Initialize configuration defaults for originally generated Rails version.
|
28
|
+
config.load_defaults 5.2
|
29
|
+
|
30
|
+
# Settings in config/environments/* take precedence over those specified here.
|
31
|
+
# Application configuration can go into files in config/initializers
|
32
|
+
# -- all .rb files in that directory are automatically loaded after loading
|
33
|
+
# the framework and any gems in your application.
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Set up gems listed in the Gemfile.
|
4
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__)
|
5
|
+
|
6
|
+
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
|
7
|
+
$LOAD_PATH.unshift File.expand_path("../../../lib", __dir__)
|