hot-glue 0.5.1 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +16 -0
- data/.gitignore +3 -1
- data/.ruby-version +1 -0
- data/.travis.yml +2 -2
- data/Gemfile +18 -7
- data/LICENSE +2 -16
- data/README.md +110 -73
- data/README2.md +0 -2
- data/app/helpers/hot_glue/controller_helper.rb +34 -26
- data/config/database.yml +21 -7
- data/db/schema.rb +149 -0
- data/lib/generators/hot_glue/install_generator.rb +1 -55
- data/lib/generators/hot_glue/markup_templates/erb.rb +15 -10
- data/lib/generators/hot_glue/scaffold_generator.rb +219 -138
- data/lib/generators/hot_glue/templates/capybara_login.rb +1 -1
- data/lib/generators/hot_glue/templates/controller.rb.erb +22 -21
- data/lib/generators/hot_glue/templates/erb/_new_button.erb +1 -1
- data/lib/generators/hot_glue/templates/erb/_show.erb +1 -1
- data/lib/generators/hot_glue/templates/system_spec.rb.erb +8 -123
- data/lib/hotglue/version.rb +1 -1
- data/script/clean_generated_code +20 -0
- data/script/test +47 -0
- metadata +10 -8
- data/.circleci/config.yml +0 -71
- data/Gemfile.lock +0 -230
- data/Rakefile +0 -42
- data/bin/rails +0 -14
- data/db/schema.rb +0 -1
data/db/schema.rb
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# This file is the source Rails uses to define your schema when running `bin/rails
|
6
|
+
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
7
|
+
# be faster and is potentially less error prone than running all of your
|
8
|
+
# migrations from scratch. Old migrations may fail to apply correctly if those
|
9
|
+
# migrations use external dependencies or application code.
|
10
|
+
#
|
11
|
+
# It's strongly recommended that you check this file into your version control system.
|
12
|
+
|
13
|
+
ActiveRecord::Schema[7.0].define(version: 2022_03_23_000410) do
|
14
|
+
create_table "abcs", force: :cascade do |t|
|
15
|
+
t.string "name"
|
16
|
+
t.datetime "created_at", null: false
|
17
|
+
t.datetime "updated_at", null: false
|
18
|
+
end
|
19
|
+
|
20
|
+
create_table "appointments", force: :cascade do |t|
|
21
|
+
t.integer "pet_id"
|
22
|
+
t.datetime "created_at", null: false
|
23
|
+
t.datetime "updated_at", null: false
|
24
|
+
end
|
25
|
+
|
26
|
+
create_table "atw_display_names", force: :cascade do |t|
|
27
|
+
t.string "display_name"
|
28
|
+
t.integer "xyz_id"
|
29
|
+
t.datetime "created_at", null: false
|
30
|
+
t.datetime "updated_at", null: false
|
31
|
+
end
|
32
|
+
|
33
|
+
create_table "atw_full_names", force: :cascade do |t|
|
34
|
+
t.string "full_name"
|
35
|
+
t.integer "xyz_id"
|
36
|
+
t.datetime "created_at", null: false
|
37
|
+
t.datetime "updated_at", null: false
|
38
|
+
end
|
39
|
+
|
40
|
+
create_table "atw_to_labels", force: :cascade do |t|
|
41
|
+
t.string "to_label"
|
42
|
+
t.integer "xyz_id"
|
43
|
+
t.datetime "created_at", null: false
|
44
|
+
t.datetime "updated_at", null: false
|
45
|
+
end
|
46
|
+
|
47
|
+
create_table "borkeds", force: :cascade do |t|
|
48
|
+
t.integer "xyz_id"
|
49
|
+
t.integer "missing_label_table_id"
|
50
|
+
t.datetime "created_at", null: false
|
51
|
+
t.datetime "updated_at", null: false
|
52
|
+
end
|
53
|
+
|
54
|
+
create_table "cantelopes", force: :cascade do |t|
|
55
|
+
t.string "name"
|
56
|
+
t.string "_a_show_only_field"
|
57
|
+
t.datetime "created_at", null: false
|
58
|
+
t.datetime "updated_at", null: false
|
59
|
+
end
|
60
|
+
|
61
|
+
create_table "dfgs", force: :cascade do |t|
|
62
|
+
t.integer "user_id"
|
63
|
+
t.string "name"
|
64
|
+
t.datetime "created_at", null: false
|
65
|
+
t.datetime "updated_at", null: false
|
66
|
+
t.integer "cantelope_id"
|
67
|
+
end
|
68
|
+
|
69
|
+
create_table "families", force: :cascade do |t|
|
70
|
+
t.string "name"
|
71
|
+
t.datetime "created_at", null: false
|
72
|
+
t.datetime "updated_at", null: false
|
73
|
+
end
|
74
|
+
|
75
|
+
create_table "ghis", force: :cascade do |t|
|
76
|
+
t.integer "dfg_id"
|
77
|
+
t.integer "xyz_id"
|
78
|
+
t.datetime "created_at", null: false
|
79
|
+
t.datetime "updated_at", null: false
|
80
|
+
end
|
81
|
+
|
82
|
+
create_table "hgis", force: :cascade do |t|
|
83
|
+
t.string "name"
|
84
|
+
t.integer "how_many"
|
85
|
+
t.text "hello"
|
86
|
+
t.datetime "created_at", null: false
|
87
|
+
t.datetime "updated_at", null: false
|
88
|
+
end
|
89
|
+
|
90
|
+
create_table "humen", force: :cascade do |t|
|
91
|
+
t.string "name"
|
92
|
+
t.datetime "created_at", null: false
|
93
|
+
t.datetime "updated_at", null: false
|
94
|
+
end
|
95
|
+
|
96
|
+
create_table "jkls", force: :cascade do |t|
|
97
|
+
t.integer "hgi_id"
|
98
|
+
t.string "name"
|
99
|
+
t.string "blurb"
|
100
|
+
t.text "long_description"
|
101
|
+
t.float "cost"
|
102
|
+
t.integer "how_many_printed"
|
103
|
+
t.datetime "approved_at", precision: nil
|
104
|
+
t.date "release_on"
|
105
|
+
t.time "time_of_day"
|
106
|
+
t.boolean "selected"
|
107
|
+
t.integer "genre"
|
108
|
+
t.datetime "created_at", null: false
|
109
|
+
t.datetime "updated_at", null: false
|
110
|
+
end
|
111
|
+
|
112
|
+
create_table "missing_label_tables", force: :cascade do |t|
|
113
|
+
t.datetime "created_at", null: false
|
114
|
+
t.datetime "updated_at", null: false
|
115
|
+
end
|
116
|
+
|
117
|
+
create_table "pets", force: :cascade do |t|
|
118
|
+
t.string "name"
|
119
|
+
t.integer "human_id"
|
120
|
+
t.datetime "created_at", null: false
|
121
|
+
t.datetime "updated_at", null: false
|
122
|
+
end
|
123
|
+
|
124
|
+
create_table "users", force: :cascade do |t|
|
125
|
+
t.string "email", default: "", null: false
|
126
|
+
t.string "encrypted_password", default: "", null: false
|
127
|
+
t.string "reset_password_token"
|
128
|
+
t.datetime "reset_password_sent_at", precision: nil
|
129
|
+
t.datetime "remember_created_at", precision: nil
|
130
|
+
t.integer "family_id"
|
131
|
+
t.datetime "created_at", null: false
|
132
|
+
t.datetime "updated_at", null: false
|
133
|
+
t.index ["email"], name: "index_users_on_email", unique: true
|
134
|
+
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
135
|
+
end
|
136
|
+
|
137
|
+
create_table "visits", force: :cascade do |t|
|
138
|
+
t.string "name"
|
139
|
+
t.integer "user_id"
|
140
|
+
t.datetime "created_at", null: false
|
141
|
+
t.datetime "updated_at", null: false
|
142
|
+
end
|
143
|
+
|
144
|
+
create_table "xyzs", force: :cascade do |t|
|
145
|
+
t.integer "nothing_id"
|
146
|
+
t.datetime "created_at", null: false
|
147
|
+
t.datetime "updated_at", null: false
|
148
|
+
end
|
149
|
+
end
|
@@ -26,58 +26,6 @@ module HotGlue
|
|
26
26
|
puts "IMPORTANT: You have selected to install Hot Glue with Bootstrap layout (legacy). Be sure to always use ``--layout=bootstrap` when building your scaffold. No Hot Glue theme will be installed at this time.` "
|
27
27
|
end
|
28
28
|
|
29
|
-
### INTERACTIVE LICENSING
|
30
|
-
|
31
|
-
|
32
|
-
print "Do you have a license key (y/N)? "
|
33
|
-
do_you_have_a_license = STDIN.gets.strip || "N"
|
34
|
-
|
35
|
-
if do_you_have_a_license.downcase == "y"
|
36
|
-
print "Please enter the EMAIL you used to purchase a Hot Glue license, \nTeachable tutorial, or Helios Merch Shop product: "
|
37
|
-
license_email = STDIN.gets.strip
|
38
|
-
require 'open-uri'
|
39
|
-
|
40
|
-
# ask HeliosDev.shop if this email is good
|
41
|
-
stream = URI.open("https://heliosdev.shop/check_licenses/hot-glue?email=#{license_email}")
|
42
|
-
resp = JSON.parse(stream.read)
|
43
|
-
|
44
|
-
if resp['status'] == 'success'
|
45
|
-
if resp['redirect']
|
46
|
-
HotGlue::Helpers.open_page(resp['redirect'])
|
47
|
-
end
|
48
|
-
puts "\n" + " * " + resp['response'] + " * \n\n"
|
49
|
-
else
|
50
|
-
puts "\n" + " * " + resp['response'] + " * \n\n"
|
51
|
-
|
52
|
-
print "You can get a license in one of the follow ways: \n"
|
53
|
-
print "https://heliosdev.shop/hot-glue-license \n"
|
54
|
-
print "https://jfb.teachable.com/p/hot-glue-in-depth-tutorial \n"
|
55
|
-
print "https://shop.heliosdev.shop/ \n"
|
56
|
-
print "All purchases come with a Hot Glue lifetime license for individuals and hobbyists\n"
|
57
|
-
return
|
58
|
-
end
|
59
|
-
else
|
60
|
-
print "Please pick an option to get a Hot Glue license: \n"
|
61
|
-
print "1) Professional/Business with support (see heliosdev.shop/hot-glue-license for prices) \n"
|
62
|
-
print "2) Individual/hobbyist: Get the tutorial on Teachable ($60) \n"
|
63
|
-
print "3) Individual/hobbyist: Get some merchandise ($5 and up) \n"
|
64
|
-
print "Please type 1, 2, or 3: "
|
65
|
-
choice = STDIN.gets.strip
|
66
|
-
|
67
|
-
if choice == "1"
|
68
|
-
HotGlue::Helpers.open_page("https://heliosdev.shop/hot-glue-license?utm_campaing=hotglue-installer")
|
69
|
-
elsif choice == "2"
|
70
|
-
HotGlue::Helpers.open_page("https://jfb.teachable.com/p/hot-glue-in-depth-tutorial?utm_source=hotglue-installer")
|
71
|
-
print "All purchases come with a Hot Glue lifetime license for individuals and hobbyists\n"
|
72
|
-
|
73
|
-
else
|
74
|
-
HotGlue::Helpers.open_page("https://shop.heliosdev.shop/?utm_source=hotglue-installer")
|
75
|
-
print "ALSO check out the HOT GLUE TUTORIAL here: \n"
|
76
|
-
print "https://jfb.teachable.com/p/hot-glue-in-depth-tutorial \n"
|
77
|
-
print "All purchases come with a Hot Glue lifetime license for individuals and hobbyists\n"
|
78
|
-
end
|
79
|
-
return
|
80
|
-
end
|
81
29
|
|
82
30
|
@markup = options['markup']
|
83
31
|
if @markup == "haml"
|
@@ -171,11 +119,9 @@ module HotGlue
|
|
171
119
|
|
172
120
|
|
173
121
|
begin
|
174
|
-
|
175
122
|
if !File.exists?("config/hot_glue.yml")
|
176
123
|
yaml = {layout: @layout,
|
177
|
-
markup: @markup
|
178
|
-
license_email: license_email}.to_yaml
|
124
|
+
markup: @markup}.to_yaml
|
179
125
|
File.write("#{'spec/dummy/' if Rails.env.test?}config/hot_glue.yml", yaml)
|
180
126
|
|
181
127
|
end
|
@@ -7,7 +7,9 @@ module HotGlue
|
|
7
7
|
:ownership_field, :form_labels_position,
|
8
8
|
:inline_list_labels,
|
9
9
|
:columns, :column_width, :col_identifier, :singular,
|
10
|
-
:form_placeholder_labels
|
10
|
+
:form_placeholder_labels, :hawk_keys
|
11
|
+
|
12
|
+
|
11
13
|
|
12
14
|
def add_spaces_each_line(text, num_spaces)
|
13
15
|
add_spaces = " " * num_spaces
|
@@ -30,8 +32,6 @@ module HotGlue
|
|
30
32
|
}.join("\n")
|
31
33
|
end
|
32
34
|
|
33
|
-
|
34
|
-
|
35
35
|
def list_column_headings(*args)
|
36
36
|
@columns = args[0][:columns]
|
37
37
|
@column_width = args[0][:column_width]
|
@@ -63,6 +63,7 @@ module HotGlue
|
|
63
63
|
@ownership_field = args[0][:ownership_field]
|
64
64
|
@form_labels_position = args[0][:form_labels_position]
|
65
65
|
@form_placeholder_labels = args[0][:form_placeholder_labels]
|
66
|
+
@hawk_keys = args[0][:hawk_keys]
|
66
67
|
|
67
68
|
@singular = args[0][:singular]
|
68
69
|
singular = @singular
|
@@ -71,7 +72,7 @@ module HotGlue
|
|
71
72
|
column.map { |col|
|
72
73
|
field_result =
|
73
74
|
if show_only.include?(col.to_sym)
|
74
|
-
"<%=
|
75
|
+
"<%= #{singular}.#{col} %>"
|
75
76
|
else
|
76
77
|
type = eval("#{singular_class}.columns_hash['#{col}']").type
|
77
78
|
limit = eval("#{singular_class}.columns_hash['#{col}']").limit
|
@@ -132,18 +133,22 @@ module HotGlue
|
|
132
133
|
assoc_class_name = assoc.active_record.name
|
133
134
|
display_column = HotGlue.derrive_reference_name(assoc_class_name)
|
134
135
|
|
136
|
+
if @hawk_keys[assoc.foreign_key.to_sym]
|
137
|
+
hawk_definition = @hawk_keys[assoc.foreign_key.to_sym]
|
138
|
+
hawk_root = hawk_definition[0]
|
139
|
+
hawk_scope = hawk_definition[1]
|
140
|
+
hawked_association = "#{hawk_root}.#{hawk_scope}"
|
141
|
+
else
|
142
|
+
hawked_association = "#{assoc.class_name}.all"
|
143
|
+
end
|
144
|
+
|
135
145
|
(is_owner ? "<% unless @#{assoc_name} %>\n" : "") +
|
136
|
-
" <%= f.collection_select(:#{col}, #{
|
146
|
+
" <%= f.collection_select(:#{col}, #{hawked_association}, :id, :#{display_column}, {prompt: true, selected: @#{singular}.#{col} }, class: 'form-control') %>\n" +
|
137
147
|
(is_owner ? "<% else %>\n <%= @#{assoc_name}.#{display_column} %>" : "") +
|
138
148
|
(is_owner ? "\n<% end %>" : "")
|
139
149
|
|
140
150
|
else
|
141
151
|
" <%= f.text_field :#{col}, value: #{@singular}.#{col}, autocomplete: 'off', size: 4, class: 'form-control', type: 'number'" + (@form_placeholder_labels ? ", placeholder: '#{col.to_s.humanize}'" : "") + " %>\n " + "\n"
|
142
|
-
|
143
|
-
# field_output(col, nil, 4, col_identifier)
|
144
|
-
#
|
145
|
-
# # "<%= f.text_field :#{col}, value: #{singular}.#{col}, class: 'form-control', size: 4, type: 'number' %>"
|
146
|
-
|
147
152
|
end
|
148
153
|
end
|
149
154
|
|