localtower 0.4.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +37 -46
  3. data/app/controllers/localtower/pages_controller.rb +28 -42
  4. data/app/helpers/localtower/application_helper.rb +0 -18
  5. data/app/views/layouts/localtower/application.html.erb +20 -79
  6. data/app/views/localtower/pages/_alert_no_models.html.erb +3 -0
  7. data/app/views/localtower/pages/migrations.html.erb +50 -120
  8. data/app/views/localtower/pages/models.html.erb +53 -68
  9. data/app/views/localtower/pages/new_migration.html.erb +103 -0
  10. data/app/views/localtower/pages/new_model.html.erb +87 -0
  11. data/config/routes.rb +8 -17
  12. data/lib/localtower/generators/migration.rb +53 -181
  13. data/lib/localtower/generators/model.rb +53 -32
  14. data/lib/localtower/generators/service_objects/insert_array.rb +23 -0
  15. data/lib/localtower/generators/service_objects/insert_defaults.rb +15 -43
  16. data/lib/localtower/generators/service_objects/insert_indexes.rb +80 -0
  17. data/lib/localtower/generators/service_objects/insert_nullable.rb +23 -0
  18. data/lib/localtower/status.rb +12 -7
  19. data/lib/localtower/tools.rb +29 -24
  20. data/lib/localtower/version.rb +1 -1
  21. data/lib/localtower.rb +0 -1
  22. data/public/css/app.css +0 -49
  23. data/public/js/app.js +216 -86
  24. data/public/light-bootstrap-dashboard-master/assets/css/light-bootstrap-dashboard.css +9 -35
  25. data/public/screenshots/v1.0.0/migrations.png +0 -0
  26. data/public/screenshots/v1.0.0/models.png +0 -0
  27. data/public/screenshots/v1.0.0/new_migration.png +0 -0
  28. data/public/screenshots/v1.0.0/new_model.png +0 -0
  29. data/public/vendor/font-awesome.min.css +4 -0
  30. data/public/vendor/highlight-js-default.min.css +9 -0
  31. data/public/vendor/highlight.min.js +1198 -0
  32. data/public/{js → vendor}/masonry.pkgd.min.js +0 -0
  33. data/spec/dummy/Gemfile +0 -3
  34. data/spec/dummy/Gemfile.lock +78 -95
  35. data/spec/dummy/app/controllers/pages_controller.rb +0 -2
  36. data/spec/dummy/app/models/post.rb +3 -0
  37. data/spec/dummy/app/models/user.rb +3 -0
  38. data/spec/dummy/app/views/pages/home.html.erb +0 -1
  39. data/spec/dummy/config/database.yml +1 -1
  40. data/spec/dummy/config/environments/development.rb +3 -1
  41. data/spec/dummy/config/puma.rb +1 -1
  42. data/spec/dummy/db/migrate/20230119221452_create_users.rb +14 -0
  43. data/spec/dummy/db/migrate/20230119221751_change_users_at1674166670.rb +7 -0
  44. data/spec/dummy/db/migrate/20230119222054_create_posts.rb +11 -0
  45. data/spec/dummy/db/migrate/20230119222106_change_posts_at1674166865.rb +5 -0
  46. data/spec/dummy/db/schema.rb +41 -0
  47. data/spec/dummy/log/development.log +16030 -10038
  48. data/spec/dummy/log/localtower.log +1878 -439
  49. data/spec/dummy/log/test.log +0 -281
  50. data/spec/dummy/test/index.html +38 -0
  51. data/spec/dummy/tmp/pids/server.pid +1 -1
  52. data/spec/factories/migration.rb +25 -41
  53. data/spec/factories/model.rb +39 -25
  54. data/spec/lib/localtower/generators/migration_spec.rb +36 -63
  55. data/spec/lib/localtower/generators/model_spec.rb +43 -34
  56. data/spec/lib/localtower/generators/service_objects/insert_array_spec.rb +47 -0
  57. data/spec/lib/localtower/generators/service_objects/insert_defaults_spec.rb +30 -35
  58. data/spec/lib/localtower/generators/service_objects/insert_indexes_spec.rb +90 -0
  59. data/spec/lib/localtower/generators/service_objects/insert_nullable_spec.rb +61 -0
  60. data/spec/lib/localtower/tools_spec.rb +1 -11
  61. data/spec/spec_helper.rb +25 -5
  62. metadata +38 -30
  63. data/app/views/localtower/pages/dashboard.html.erb +0 -67
  64. data/app/views/localtower/pages/logs.html.erb +0 -84
  65. data/app/views/localtower/pages/relations.html.erb +0 -66
  66. data/app/views/localtower/pages/tasks.html.erb +0 -48
  67. data/lib/localtower/generators/relation.rb +0 -59
  68. data/lib/localtower/plugins/capture.rb +0 -197
  69. data/lib/tasks/localtower_tasks.rake +0 -4
  70. data/spec/dummy/lib/playground.rb +0 -0
  71. data/spec/dummy/log/localtower_capture_d8979d360722798f7b6eb1a2694a3791.json +0 -1
  72. data/spec/lib/localtower/generators/relation_spec.rb +0 -65
File without changes
data/spec/dummy/Gemfile CHANGED
@@ -1,11 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # gem 'rails', '5.2.0'
4
3
  gem "rails", "~> 7.0.1"
5
4
  gem 'pg'
6
5
  gem 'puma'
7
- gem 'jquery-rails'
8
- gem 'turbolinks', '~> 5'
9
6
 
10
7
  group :development, :test do
11
8
  localtower_path = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
@@ -1,56 +1,55 @@
1
1
  PATH
2
2
  remote: /Users/damln/Work/localtower
3
3
  specs:
4
- localtower (0.4.1)
4
+ localtower (0.5.0)
5
5
  active_link_to (>= 1.0.4)
6
6
  rails (>= 5.2.0)
7
- rubyzip (>= 1.2.1)
8
7
  thor (>= 0.18.1)
9
8
 
10
9
  GEM
11
10
  remote: https://rubygems.org/
12
11
  specs:
13
- actioncable (7.0.2.3)
14
- actionpack (= 7.0.2.3)
15
- activesupport (= 7.0.2.3)
12
+ actioncable (7.0.4)
13
+ actionpack (= 7.0.4)
14
+ activesupport (= 7.0.4)
16
15
  nio4r (~> 2.0)
17
16
  websocket-driver (>= 0.6.1)
18
- actionmailbox (7.0.2.3)
19
- actionpack (= 7.0.2.3)
20
- activejob (= 7.0.2.3)
21
- activerecord (= 7.0.2.3)
22
- activestorage (= 7.0.2.3)
23
- activesupport (= 7.0.2.3)
17
+ actionmailbox (7.0.4)
18
+ actionpack (= 7.0.4)
19
+ activejob (= 7.0.4)
20
+ activerecord (= 7.0.4)
21
+ activestorage (= 7.0.4)
22
+ activesupport (= 7.0.4)
24
23
  mail (>= 2.7.1)
25
24
  net-imap
26
25
  net-pop
27
26
  net-smtp
28
- actionmailer (7.0.2.3)
29
- actionpack (= 7.0.2.3)
30
- actionview (= 7.0.2.3)
31
- activejob (= 7.0.2.3)
32
- activesupport (= 7.0.2.3)
27
+ actionmailer (7.0.4)
28
+ actionpack (= 7.0.4)
29
+ actionview (= 7.0.4)
30
+ activejob (= 7.0.4)
31
+ activesupport (= 7.0.4)
33
32
  mail (~> 2.5, >= 2.5.4)
34
33
  net-imap
35
34
  net-pop
36
35
  net-smtp
37
36
  rails-dom-testing (~> 2.0)
38
- actionpack (7.0.2.3)
39
- actionview (= 7.0.2.3)
40
- activesupport (= 7.0.2.3)
37
+ actionpack (7.0.4)
38
+ actionview (= 7.0.4)
39
+ activesupport (= 7.0.4)
41
40
  rack (~> 2.0, >= 2.2.0)
42
41
  rack-test (>= 0.6.3)
43
42
  rails-dom-testing (~> 2.0)
44
43
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
45
- actiontext (7.0.2.3)
46
- actionpack (= 7.0.2.3)
47
- activerecord (= 7.0.2.3)
48
- activestorage (= 7.0.2.3)
49
- activesupport (= 7.0.2.3)
44
+ actiontext (7.0.4)
45
+ actionpack (= 7.0.4)
46
+ activerecord (= 7.0.4)
47
+ activestorage (= 7.0.4)
48
+ activesupport (= 7.0.4)
50
49
  globalid (>= 0.6.0)
51
50
  nokogiri (>= 1.8.5)
52
- actionview (7.0.2.3)
53
- activesupport (= 7.0.2.3)
51
+ actionview (7.0.4)
52
+ activesupport (= 7.0.4)
54
53
  builder (~> 3.1)
55
54
  erubi (~> 1.4)
56
55
  rails-dom-testing (~> 2.0)
@@ -58,42 +57,37 @@ GEM
58
57
  active_link_to (1.0.5)
59
58
  actionpack
60
59
  addressable
61
- activejob (7.0.2.3)
62
- activesupport (= 7.0.2.3)
60
+ activejob (7.0.4)
61
+ activesupport (= 7.0.4)
63
62
  globalid (>= 0.3.6)
64
- activemodel (7.0.2.3)
65
- activesupport (= 7.0.2.3)
66
- activerecord (7.0.2.3)
67
- activemodel (= 7.0.2.3)
68
- activesupport (= 7.0.2.3)
69
- activestorage (7.0.2.3)
70
- actionpack (= 7.0.2.3)
71
- activejob (= 7.0.2.3)
72
- activerecord (= 7.0.2.3)
73
- activesupport (= 7.0.2.3)
63
+ activemodel (7.0.4)
64
+ activesupport (= 7.0.4)
65
+ activerecord (7.0.4)
66
+ activemodel (= 7.0.4)
67
+ activesupport (= 7.0.4)
68
+ activestorage (7.0.4)
69
+ actionpack (= 7.0.4)
70
+ activejob (= 7.0.4)
71
+ activerecord (= 7.0.4)
72
+ activesupport (= 7.0.4)
74
73
  marcel (~> 1.0)
75
74
  mini_mime (>= 1.1.0)
76
- activesupport (7.0.2.3)
75
+ activesupport (7.0.4)
77
76
  concurrent-ruby (~> 1.0, >= 1.0.2)
78
77
  i18n (>= 1.6, < 2)
79
78
  minitest (>= 5.1)
80
79
  tzinfo (~> 2.0)
81
- addressable (2.8.0)
82
- public_suffix (>= 2.0.2, < 5.0)
80
+ addressable (2.8.1)
81
+ public_suffix (>= 2.0.2, < 6.0)
83
82
  builder (3.2.4)
84
83
  concurrent-ruby (1.1.10)
85
84
  crass (1.0.6)
86
- digest (3.1.0)
87
- erubi (1.10.0)
85
+ erubi (1.11.0)
88
86
  globalid (1.0.0)
89
87
  activesupport (>= 5.0)
90
- i18n (1.10.0)
88
+ i18n (1.12.0)
91
89
  concurrent-ruby (~> 1.0)
92
- jquery-rails (4.4.0)
93
- rails-dom-testing (>= 1, < 3)
94
- railties (>= 4.2.0)
95
- thor (>= 0.14, < 2.0)
96
- loofah (2.16.0)
90
+ loofah (2.19.0)
97
91
  crass (~> 1.0.2)
98
92
  nokogiri (>= 1.5.9)
99
93
  mail (2.7.1)
@@ -101,84 +95,73 @@ GEM
101
95
  marcel (1.0.2)
102
96
  method_source (1.0.0)
103
97
  mini_mime (1.1.2)
104
- minitest (5.15.0)
105
- net-imap (0.2.3)
106
- digest
98
+ mini_portile2 (2.8.0)
99
+ minitest (5.16.3)
100
+ net-imap (0.3.1)
107
101
  net-protocol
108
- strscan
109
- net-pop (0.1.1)
110
- digest
102
+ net-pop (0.1.2)
111
103
  net-protocol
112
- timeout
113
104
  net-protocol (0.1.3)
114
105
  timeout
115
- net-smtp (0.3.1)
116
- digest
106
+ net-smtp (0.3.3)
117
107
  net-protocol
118
- timeout
119
108
  nio4r (2.5.8)
120
- nokogiri (1.13.4-x86_64-darwin)
109
+ nokogiri (1.13.9)
110
+ mini_portile2 (~> 2.8.0)
121
111
  racc (~> 1.4)
122
- pg (1.3.1)
123
- public_suffix (4.0.6)
124
- puma (5.6.1)
112
+ pg (1.4.4)
113
+ public_suffix (5.0.0)
114
+ puma (6.0.0)
125
115
  nio4r (~> 2.0)
126
116
  racc (1.6.0)
127
- rack (2.2.3)
128
- rack-test (1.1.0)
129
- rack (>= 1.0, < 3)
130
- rails (7.0.2.3)
131
- actioncable (= 7.0.2.3)
132
- actionmailbox (= 7.0.2.3)
133
- actionmailer (= 7.0.2.3)
134
- actionpack (= 7.0.2.3)
135
- actiontext (= 7.0.2.3)
136
- actionview (= 7.0.2.3)
137
- activejob (= 7.0.2.3)
138
- activemodel (= 7.0.2.3)
139
- activerecord (= 7.0.2.3)
140
- activestorage (= 7.0.2.3)
141
- activesupport (= 7.0.2.3)
117
+ rack (2.2.4)
118
+ rack-test (2.0.2)
119
+ rack (>= 1.3)
120
+ rails (7.0.4)
121
+ actioncable (= 7.0.4)
122
+ actionmailbox (= 7.0.4)
123
+ actionmailer (= 7.0.4)
124
+ actionpack (= 7.0.4)
125
+ actiontext (= 7.0.4)
126
+ actionview (= 7.0.4)
127
+ activejob (= 7.0.4)
128
+ activemodel (= 7.0.4)
129
+ activerecord (= 7.0.4)
130
+ activestorage (= 7.0.4)
131
+ activesupport (= 7.0.4)
142
132
  bundler (>= 1.15.0)
143
- railties (= 7.0.2.3)
133
+ railties (= 7.0.4)
144
134
  rails-dom-testing (2.0.3)
145
135
  activesupport (>= 4.2.0)
146
136
  nokogiri (>= 1.6)
147
- rails-html-sanitizer (1.4.2)
137
+ rails-html-sanitizer (1.4.3)
148
138
  loofah (~> 2.3)
149
- railties (7.0.2.3)
150
- actionpack (= 7.0.2.3)
151
- activesupport (= 7.0.2.3)
139
+ railties (7.0.4)
140
+ actionpack (= 7.0.4)
141
+ activesupport (= 7.0.4)
152
142
  method_source
153
143
  rake (>= 12.2)
154
144
  thor (~> 1.0)
155
145
  zeitwerk (~> 2.5)
156
146
  rake (13.0.6)
157
- rubyzip (2.3.2)
158
- strscan (3.0.1)
159
147
  thor (1.2.1)
160
- timeout (0.2.0)
161
- turbolinks (5.2.1)
162
- turbolinks-source (~> 5.2)
163
- turbolinks-source (5.2.0)
164
- tzinfo (2.0.4)
148
+ timeout (0.3.0)
149
+ tzinfo (2.0.5)
165
150
  concurrent-ruby (~> 1.0)
166
151
  websocket-driver (0.7.5)
167
152
  websocket-extensions (>= 0.1.0)
168
153
  websocket-extensions (0.1.5)
169
- zeitwerk (2.5.4)
154
+ zeitwerk (2.6.1)
170
155
 
171
156
  PLATFORMS
172
- x86_64-darwin-20
157
+ ruby
173
158
 
174
159
  DEPENDENCIES
175
- jquery-rails
176
160
  localtower!
177
161
  pg
178
162
  puma
179
163
  rails (~> 7.0.1)
180
- turbolinks (~> 5)
181
164
  tzinfo-data
182
165
 
183
166
  BUNDLED WITH
184
- 2.3.4
167
+ 2.2.24
@@ -2,7 +2,5 @@ class PagesController < ApplicationController
2
2
  def home
3
3
  a = 2
4
4
  b = {hello: "World"}
5
-
6
- Localtower::Plugins::Capture.new(self, binding).save
7
5
  end
8
6
  end
@@ -0,0 +1,3 @@
1
+ class Post < ApplicationRecord
2
+ # belongs_to :user
3
+ end
@@ -0,0 +1,3 @@
1
+ class User < ApplicationRecord
2
+ # has_many :posts
3
+ end
@@ -1 +0,0 @@
1
- <h1>HELLO</h1>
@@ -12,7 +12,7 @@ development:
12
12
 
13
13
  test:
14
14
  <<: *default
15
- database: localtower_dummy # use same database as development, easier to debug.
15
+ database: localtower_dummy_test
16
16
 
17
17
  production:
18
18
  <<: *default
@@ -35,7 +35,9 @@ Rails.application.configure do
35
35
  config.active_support.deprecation = :log
36
36
 
37
37
  # Raise an error on page load if there are pending migrations.
38
- config.active_record.migration_error = :page_load
38
+ # config.active_record.migration_error = :page_load
39
+ config.active_record.migration_error = false if defined?(Localtower)
40
+ config.reload_classes_only_on_change = false
39
41
 
40
42
  # Debug mode disables concatenation and preprocessing of assets.
41
43
  # This option may cause significant delays in view rendering with a large
@@ -4,7 +4,7 @@
4
4
  # the maximum value specified for Puma. Default is set to 5 threads for minimum
5
5
  # and maximum, this matches the default thread size of Active Record.
6
6
  #
7
- threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
7
+ threads_count = ENV.fetch("RAILS_MAX_THREADS") { 1 }.to_i
8
8
  threads threads_count, threads_count
9
9
 
10
10
  # Specifies the `port` that Puma will listen on to receive requests, default is 3000.
@@ -0,0 +1,14 @@
1
+ class CreateUsers < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :email, null: false
5
+ t.integer :login_count, default: 0, null: false
6
+ t.jsonb :metadata, default: {}, null: false
7
+ t.string :name
8
+
9
+ t.timestamps
10
+ end
11
+ add_index :users, :email, unique: true
12
+ add_index :users, :name
13
+ end
14
+ end
@@ -0,0 +1,7 @@
1
+ class ChangeUsersAt1674166670 < ActiveRecord::Migration[7.0]
2
+ def change
3
+ add_column :users, :city, :string
4
+ add_index :users, :city
5
+ rename_column :users, :login_count, :signin_count
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ class CreatePosts < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :posts do |t|
4
+ t.string :title, null: false
5
+ t.string :content, null: false
6
+
7
+ t.timestamps
8
+ end
9
+ add_index :posts, :title
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ class ChangePostsAt1674166865 < ActiveRecord::Migration[7.0]
2
+ def change
3
+ add_reference :posts, :user, foreign_key: true, index: true
4
+ end
5
+ end
@@ -0,0 +1,41 @@
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: 2023_01_19_222106) do
14
+ # These are extensions that must be enabled in order to support this database
15
+ enable_extension "plpgsql"
16
+
17
+ create_table "posts", force: :cascade do |t|
18
+ t.string "title", null: false
19
+ t.string "content", null: false
20
+ t.datetime "created_at", null: false
21
+ t.datetime "updated_at", null: false
22
+ t.bigint "user_id"
23
+ t.index ["title"], name: "index_posts_on_title"
24
+ t.index ["user_id"], name: "index_posts_on_user_id"
25
+ end
26
+
27
+ create_table "users", force: :cascade do |t|
28
+ t.string "email", null: false
29
+ t.integer "signin_count", default: 0, null: false
30
+ t.jsonb "metadata", default: {}, null: false
31
+ t.string "name"
32
+ t.datetime "created_at", null: false
33
+ t.datetime "updated_at", null: false
34
+ t.string "city"
35
+ t.index ["city"], name: "index_users_on_city"
36
+ t.index ["email"], name: "index_users_on_email", unique: true
37
+ t.index ["name"], name: "index_users_on_name"
38
+ end
39
+
40
+ add_foreign_key "posts", "users"
41
+ end