bullet_train 1.2.21 → 1.2.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concerns/invitations/base.rb +2 -5
- data/app/models/concerns/memberships/base.rb +1 -1
- data/app/views/devise/sessions/new.html.erb +1 -5
- data/docs/application-options.md +2 -0
- data/docs/field-partials.md +1 -1
- data/docs/super-scaffolding/sortable.md +2 -2
- data/lib/bullet_train/resolver.rb +10 -7
- data/lib/bullet_train/version.rb +1 -1
- data/lib/bullet_train.rb +9 -0
- data/lib/tasks/bullet_train_tasks.rake +25 -7
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d03b4bc2028c88dac20f3223cd1cd6ef395cae53b6cf84377360b0b068a0c0e8
|
4
|
+
data.tar.gz: 3524f24af8fd64c3be1ae14ddf99562fd9ba251faed18e88f35800ff11c3a7f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7da1cc8e9a9acaef9fa0eeeab6c135f7d3c7d6261c2518c4b29c572711fe2e347ce3da8e7476a6fd2f8515af6d6c442df77f1d7566b7d9ba95c9dc0f59026078
|
7
|
+
data.tar.gz: 622671f75556fe2358107f3acdba1f917da32347df64b325514ad670c09044b85baad4e56ed3d7edc45ae761e4bf07cac91170cbeb5ea73254e3d0f124bb3985
|
@@ -11,9 +11,10 @@ module Invitations::Base
|
|
11
11
|
|
12
12
|
validates :email, presence: true
|
13
13
|
|
14
|
-
before_create :generate_uuid
|
15
14
|
after_create :set_added_by_membership
|
16
15
|
after_create :send_invitation_email
|
16
|
+
|
17
|
+
attribute :uuid, default: -> { SecureRandom.hex }
|
17
18
|
end
|
18
19
|
|
19
20
|
def set_added_by_membership
|
@@ -24,10 +25,6 @@ module Invitations::Base
|
|
24
25
|
UserMailer.invited(uuid).deliver_later
|
25
26
|
end
|
26
27
|
|
27
|
-
def generate_uuid
|
28
|
-
self.uuid = SecureRandom.hex
|
29
|
-
end
|
30
|
-
|
31
28
|
def accept_for(user)
|
32
29
|
User.transaction do
|
33
30
|
user.memberships << membership
|
@@ -44,11 +44,7 @@
|
|
44
44
|
</div>
|
45
45
|
|
46
46
|
<% if devise_mapping.rememberable? %>
|
47
|
-
|
48
|
-
<div class="flex items-center">
|
49
|
-
<%= form.check_box :remember_me, class: "h-4 w-4 text-blue focus:ring-blue-800 border-slate-300 rounded dark:bg-slate-800 dark:border-slate-900" %>
|
50
|
-
<%= form.label :remember_me, class: "ml-2 block" %>
|
51
|
-
</div>
|
47
|
+
<%= render 'shared/fields/option', method: :remember_me, form: form, single_check_box: true %>
|
52
48
|
<% end %>
|
53
49
|
<% end %>
|
54
50
|
<% end %>
|
data/docs/application-options.md
CHANGED
@@ -15,6 +15,7 @@ The helper methods below can also be directly invoked in your application if you
|
|
15
15
|
| FONTAWESOME_NPM_AUTH_TOKEN | String | `"your_font_awesome_token"` | `font_awesome?` |
|
16
16
|
| SILENCE_LOGS | Boolean | `"true"` | `silence_logs?` |
|
17
17
|
| TESTING_PROVISION_KEY | String | `"asdf123"` | N/A |
|
18
|
+
| OPENAI_ACCESS_TOKEN | String |`your_openai_token`| `openai_enabled?` |
|
18
19
|
|
19
20
|
| Option | Description |
|
20
21
|
| --- | --- |
|
@@ -27,3 +28,4 @@ The helper methods below can also be directly invoked in your application if you
|
|
27
28
|
| FONTAWESOME_NPM_AUTH_TOKEN | Enables use of Font Awesome. |
|
28
29
|
| SILENCE_LOGS | Silences Super Scaffolding logs. |
|
29
30
|
| TESTING_PROVISION_KEY | Creates a test `Platform::Application` by accessing `/testing/provision?key=your_provision_key` |
|
31
|
+
| OPENAI_ACCESS_TOKEN | Enables use [OpenAI](https://openai.com/) with the [ruby-openai](https://github.com/alexrudall/ruby-openai) gem. |
|
data/docs/field-partials.md
CHANGED
@@ -114,7 +114,7 @@ Certain form field partials like `buttons` and `super_select` can also have thei
|
|
114
114
|
| `boolean` | `boolean` | | `assign_boolean` | | |
|
115
115
|
| [`buttons`](/docs/field-partials/buttons.md) | `string` | Optionally | `assign_checkboxes` | | |
|
116
116
|
| `cloudinary_image` | `string` | | | | |
|
117
|
-
| `color_picker` |
|
117
|
+
| `color_picker` | `string` | | | [pickr](https://simonwep.github.io/pickr/) | |
|
118
118
|
| `date_and_time_field` | `datetime` | | `assign_date_and_time` | [Date Range Picker](https://www.daterangepicker.com) | |
|
119
119
|
| `date_field` | `date` | | `assign_date` | [Date Range Picker](https://www.daterangepicker.com) | |
|
120
120
|
| `email_field` | `string` | | | | |
|
@@ -12,7 +12,7 @@ The `--sortable` option:
|
|
12
12
|
|
13
13
|
1. Wraps the table's body in a `sortable` Stimulus controller, providing drag-and-drop re-ordering;
|
14
14
|
2. Adds a `reorder` action to your resource via `include SortableActions`, triggered automatically on re-order;
|
15
|
-
3. Adds a
|
15
|
+
3. Adds a `sort_order` attribute to your model to store the ordering;
|
16
16
|
4. Adds a `default_scope` which orders by `sort_order` and auto increments `sort_order` on create via `include Sortable` on the model.
|
17
17
|
|
18
18
|
## Disabling Saving on Re-order
|
@@ -134,4 +134,4 @@ And on the `sortable` element, catch the `sortable:drop`, `sortable:drag` (for c
|
|
134
134
|
data-confirm-reorder-target="sortable"
|
135
135
|
...
|
136
136
|
>
|
137
|
-
```
|
137
|
+
```
|
@@ -72,7 +72,10 @@ module BulletTrain
|
|
72
72
|
if open
|
73
73
|
path = source_file[:package_name] ? source_file[:absolute_path] : (source_file[:project_path]).to_s
|
74
74
|
puts "Opening `#{path}`.\n".green
|
75
|
-
|
75
|
+
|
76
|
+
# TODO: Use TerminalCommands to open this file
|
77
|
+
open_command = `which open`.present? ? "open" : "xdg-open"
|
78
|
+
exec "#{open_command} #{path}"
|
76
79
|
end
|
77
80
|
else
|
78
81
|
puts "Couldn't resolve `#{@needle}`.".red
|
@@ -101,7 +104,8 @@ module BulletTrain
|
|
101
104
|
|
102
105
|
if result[:absolute_path]
|
103
106
|
if result[:absolute_path].include?("/bullet_train")
|
104
|
-
|
107
|
+
regex = /#{"bullet_train-core" if result[:absolute_path].include?("bullet_train-core")}\/bullet_train[.\-_a-z|0-9]*.*/
|
108
|
+
base_path = result[:absolute_path].scan(regex).pop
|
105
109
|
|
106
110
|
# Try to calculate which package the file is from, and what it's path is within that project.
|
107
111
|
["app", "config", "lib"].each do |directory|
|
@@ -146,14 +150,13 @@ module BulletTrain
|
|
146
150
|
# all we need to do is change it to "shared/attributes/code"
|
147
151
|
partial_parts.last.gsub!(/(_)|(\.html\.erb)/, "")
|
148
152
|
@needle = partial_parts.join("/")
|
149
|
-
elsif @needle.match?(/bullet_train
|
153
|
+
elsif @needle.match?(/bullet_train/)
|
150
154
|
# If it's a full path, we need to make sure we're getting it from the right package.
|
151
|
-
_, partial_view_package, partial_path_without_package = @needle.partition(/bullet_train-[a-z|\-_0-9.]*/)
|
155
|
+
_, partial_view_package, partial_path_without_package = @needle.partition(/bullet_train-core\/bullet_train[a-z|\-_0-9.]*/)
|
152
156
|
|
153
|
-
# Pop off the version so we can call `bundle show` correctly.
|
154
|
-
|
157
|
+
# Pop off `bullet_train-core` and the gem's version so we can call `bundle show` correctly.
|
158
|
+
partial_view_package.gsub!(/bullet_train-core\//, "")
|
155
159
|
partial_view_package.gsub!(/[-|.0-9]*$/, "") if partial_view_package.match?(/[-|.0-9]*$/)
|
156
|
-
partial_view_package.gsub!("-base", "") if /base/.match?(@needle)
|
157
160
|
|
158
161
|
local_package_path = `bundle show #{partial_view_package}`.chomp
|
159
162
|
return local_package_path + partial_path_without_package
|
data/lib/bullet_train/version.rb
CHANGED
data/lib/bullet_train.rb
CHANGED
@@ -33,6 +33,7 @@ require "commonmarker"
|
|
33
33
|
require "extended_email_reply_parser"
|
34
34
|
require "pagy"
|
35
35
|
require "devise/pwned_password"
|
36
|
+
require "openai"
|
36
37
|
|
37
38
|
module BulletTrain
|
38
39
|
mattr_accessor :routing_concerns, default: []
|
@@ -152,3 +153,11 @@ end
|
|
152
153
|
def silence_logs?
|
153
154
|
ENV["SILENCE_LOGS"].present?
|
154
155
|
end
|
156
|
+
|
157
|
+
def openai_enabled?
|
158
|
+
ENV["OPENAI_ACCESS_TOKEN"].present?
|
159
|
+
end
|
160
|
+
|
161
|
+
def openai_organization_exists?
|
162
|
+
ENV["OPENAI_ORGANIZATION_ID"]
|
163
|
+
end
|
@@ -112,15 +112,23 @@ namespace :bullet_train do
|
|
112
112
|
puts ""
|
113
113
|
puts "bin/hack: " + "Clone bullet_train-core and link up gems (will only link up gems if already cloned).".blue
|
114
114
|
puts "bin/hack --link: " + "Link all of your Bullet Train gems to `local/bullet_train-core`.".blue
|
115
|
+
puts "bin/hack --link github: " + "Link all of your Bullet Train gems to the public repositories on GitHub".blue
|
115
116
|
puts "bin/hack --link (version-number): " + "Link all of your Bullet Train gems to the version number passed.".blue
|
116
117
|
puts "bin/hack --reset: " + "Resets all of your gems to their original definition.".blue
|
117
118
|
puts "bin/hack --watch-js: " + "Watches for any changes in JavaScript files gems that have an npm package.".blue
|
118
119
|
puts "bin/hack --clean-js: " + "Resets all of your npm packages from `local/bullet_train-core` to their original definition.".blue
|
119
120
|
exit
|
120
121
|
when "--link", "--reset"
|
121
|
-
|
122
|
-
set_core_gems(process[:flag],
|
123
|
-
|
122
|
+
link_flag_value = process[:values].pop
|
123
|
+
set_core_gems(process[:flag], link_flag_value, framework_packages)
|
124
|
+
|
125
|
+
# Bundler will throw an error if we try to `bundle install` right after adding the GitHub link to the Gemfile.
|
126
|
+
if link_flag_value == "github"
|
127
|
+
puts ""
|
128
|
+
puts "Now you can run `bundle install` to check out the public repositories on GitHub."
|
129
|
+
else
|
130
|
+
stream "bundle install"
|
131
|
+
end
|
124
132
|
when "--watch-js", "--clean-js"
|
125
133
|
package_name = process[:values].pop
|
126
134
|
framework_package = framework_packages.select { |k, v| k.to_s == package_name }
|
@@ -218,9 +226,10 @@ namespace :bullet_train do
|
|
218
226
|
end
|
219
227
|
|
220
228
|
# Pass "--link" or "--reset" as a flag to set the gems.
|
221
|
-
def set_core_gems(flag,
|
229
|
+
def set_core_gems(flag, link_flag_value, framework_packages)
|
222
230
|
packages = framework_packages.keys
|
223
231
|
gemfile_lines = File.readlines("./Gemfile")
|
232
|
+
version_regexp = /[\d|.]/
|
224
233
|
|
225
234
|
packages.each do |package|
|
226
235
|
original_path = "gem \"#{package}\""
|
@@ -241,7 +250,14 @@ namespace :bullet_train do
|
|
241
250
|
puts "We can't do anything with this. Sorry! We'll proceed, but you have to link this package yourself.".red
|
242
251
|
elsif `cat Gemfile | grep "gem \\\"#{package}\\\""`.chomp.present?
|
243
252
|
puts "#{package} is directly present in the `Gemfile`, so we'll update that line.".green
|
244
|
-
|
253
|
+
|
254
|
+
line = if link_flag_value == "github"
|
255
|
+
"#{line.chomp}, git: 'http://github.com/bullet-train-co/bullet_train-core.git'\n"
|
256
|
+
elsif link_flag_value&.match?(version_regexp)
|
257
|
+
"#{line.chomp}, \"#{link_flag_value}\"\n"
|
258
|
+
else
|
259
|
+
line.gsub(original_path, local_path)
|
260
|
+
end
|
245
261
|
end
|
246
262
|
elsif flag == "--reset"
|
247
263
|
if line.match?(/bullet_train/)
|
@@ -258,8 +274,10 @@ namespace :bullet_train do
|
|
258
274
|
if flag == "--link"
|
259
275
|
unless match_found
|
260
276
|
puts "Could not find #{package}. Adding to the end of the Gemfile.".blue
|
261
|
-
new_lines << if
|
262
|
-
"#{original_path.chomp}, \
|
277
|
+
new_lines << if link_flag_value == "github"
|
278
|
+
"#{original_path.chomp}, git: 'http://github.com/bullet-train-co/bullet_train-core.git'\n"
|
279
|
+
elsif link_flag_value&.match?(version_regexp)
|
280
|
+
"#{original_path.chomp}, \"#{link_flag_value}\"\n"
|
263
281
|
else
|
264
282
|
"#{local_path}\n"
|
265
283
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet_train
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|
@@ -388,6 +388,20 @@ dependencies:
|
|
388
388
|
- - ">="
|
389
389
|
- !ruby/object:Gem::Version
|
390
390
|
version: '0'
|
391
|
+
- !ruby/object:Gem::Dependency
|
392
|
+
name: ruby-openai
|
393
|
+
requirement: !ruby/object:Gem::Requirement
|
394
|
+
requirements:
|
395
|
+
- - ">="
|
396
|
+
- !ruby/object:Gem::Version
|
397
|
+
version: '0'
|
398
|
+
type: :runtime
|
399
|
+
prerelease: false
|
400
|
+
version_requirements: !ruby/object:Gem::Requirement
|
401
|
+
requirements:
|
402
|
+
- - ">="
|
403
|
+
- !ruby/object:Gem::Version
|
404
|
+
version: '0'
|
391
405
|
- !ruby/object:Gem::Dependency
|
392
406
|
name: unicode-emoji
|
393
407
|
requirement: !ruby/object:Gem::Requirement
|
@@ -722,7 +736,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
722
736
|
- !ruby/object:Gem::Version
|
723
737
|
version: '0'
|
724
738
|
requirements: []
|
725
|
-
rubygems_version: 3.
|
739
|
+
rubygems_version: 3.3.7
|
726
740
|
signing_key:
|
727
741
|
specification_version: 4
|
728
742
|
summary: Bullet Train
|