localtower 0.2.3 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +11 -8
- data/app/controllers/localtower/pages_controller.rb +17 -0
- data/app/views/localtower/pages/logs.html.erb +42 -28
- data/config/routes.rb +2 -0
- data/lib/localtower/plugins/capture.rb +66 -45
- data/lib/localtower/tools.rb +1 -1
- data/lib/localtower/version.rb +1 -1
- data/lib/localtower.rb +1 -3
- data/public/screenshots/v0.1.6/5_capture.png +0 -0
- data/spec/dummy/Gemfile +1 -21
- data/spec/dummy/Gemfile.lock +104 -146
- data/spec/dummy/app/controllers/pages_controller.rb +8 -0
- data/spec/dummy/app/views/pages/home.html.erb +1 -0
- data/spec/dummy/config/application.rb +0 -9
- data/spec/dummy/config/environments/development.rb +0 -7
- data/spec/dummy/config/initializers/new_framework_defaults.rb +0 -3
- data/spec/dummy/config/routes.rb +2 -0
- data/spec/dummy/log/development.log +2 -158
- data/spec/dummy/log/localtower.log +1735 -1984
- data/spec/dummy/log/test.log +1829 -2183
- data/spec/factories/migration.rb +161 -139
- data/spec/factories/model.rb +34 -30
- data/spec/lib/localtower/generators/model_spec.rb +6 -7
- data/spec/lib/localtower/generators/relation_spec.rb +6 -3
- data/spec/spec_helper.rb +3 -12
- metadata +63 -159
- data/spec/dummy/coverage/assets/0.10.0/application.css +0 -799
- data/spec/dummy/coverage/assets/0.10.0/application.js +0 -1707
- data/spec/dummy/coverage/assets/0.10.0/colorbox/border.png +0 -0
- data/spec/dummy/coverage/assets/0.10.0/colorbox/controls.png +0 -0
- data/spec/dummy/coverage/assets/0.10.0/colorbox/loading.gif +0 -0
- data/spec/dummy/coverage/assets/0.10.0/colorbox/loading_background.png +0 -0
- data/spec/dummy/coverage/assets/0.10.0/favicon_green.png +0 -0
- data/spec/dummy/coverage/assets/0.10.0/favicon_red.png +0 -0
- data/spec/dummy/coverage/assets/0.10.0/favicon_yellow.png +0 -0
- data/spec/dummy/coverage/assets/0.10.0/loading.gif +0 -0
- data/spec/dummy/coverage/assets/0.10.0/magnify.png +0 -0
- data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/spec/dummy/coverage/index.html +0 -294
- data/spec/dummy/tmp/restart.txt +0 -0
data/spec/factories/migration.rb
CHANGED
@@ -1,161 +1,183 @@
|
|
1
|
-
|
2
|
-
factory :create_table, class: Hash do
|
3
|
-
migration_name "Post"
|
4
|
-
migrations
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
FactoryBot.define do
|
2
|
+
factory :create_table, class: "Hash" do
|
3
|
+
migration_name { "Post" }
|
4
|
+
migrations do
|
5
|
+
[
|
6
|
+
{
|
7
|
+
action: "create_table",
|
8
|
+
table_name: "posts"
|
9
|
+
}
|
10
|
+
]
|
11
|
+
end
|
10
12
|
end
|
11
13
|
|
12
|
-
factory :create_table_two, class: Hash do
|
13
|
-
migration_name "User"
|
14
|
-
migrations
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
factory :create_table_two, class: "Hash" do
|
15
|
+
migration_name { "User" }
|
16
|
+
migrations do
|
17
|
+
[
|
18
|
+
{
|
19
|
+
action: "create_table",
|
20
|
+
table_name: "users"
|
21
|
+
}
|
22
|
+
]
|
23
|
+
end
|
20
24
|
end
|
21
25
|
|
22
|
-
factory :add_column, class: Hash do
|
23
|
-
migration_name "Post"
|
24
|
-
migrations
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
26
|
+
factory :add_column, class: "Hash" do
|
27
|
+
migration_name { "Post" }
|
28
|
+
migrations do
|
29
|
+
[
|
30
|
+
{
|
31
|
+
action: "add_column",
|
32
|
+
table_name: "posts",
|
33
|
+
column: "title",
|
34
|
+
column_type: "string",
|
35
|
+
index: true,
|
36
|
+
nullable: true,
|
37
|
+
},
|
38
|
+
{
|
39
|
+
action: "add_column",
|
40
|
+
table_name: "posts",
|
41
|
+
column: "content",
|
42
|
+
column_type: "text",
|
43
|
+
index: false,
|
44
|
+
nullable: true,
|
45
|
+
},
|
46
|
+
{
|
47
|
+
action: "add_column",
|
48
|
+
table_name: "posts",
|
49
|
+
column: "views",
|
50
|
+
column_type: "integer",
|
51
|
+
index: true,
|
52
|
+
default: 0,
|
53
|
+
nullable: false,
|
54
|
+
},
|
55
|
+
{
|
56
|
+
action: "add_column",
|
57
|
+
table_name: "posts",
|
58
|
+
column: "tags",
|
59
|
+
column_type: "array",
|
60
|
+
index: true,
|
61
|
+
nullable: true,
|
62
|
+
}
|
63
|
+
]
|
64
|
+
end
|
59
65
|
end
|
60
66
|
|
61
|
-
factory :add_column_fail, class: Hash do
|
62
|
-
migration_name "Post"
|
63
|
-
migrations
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
67
|
+
factory :add_column_fail, class: "Hash" do
|
68
|
+
migration_name { "Post" }
|
69
|
+
migrations do
|
70
|
+
[
|
71
|
+
{
|
72
|
+
action: "add_column",
|
73
|
+
table_name: "posts",
|
74
|
+
column: "title",
|
75
|
+
# column_type: "string",
|
76
|
+
}
|
77
|
+
]
|
78
|
+
end
|
71
79
|
end
|
72
80
|
|
73
|
-
factory :rename_column, class: Hash do
|
74
|
-
migration_name "Post"
|
75
|
-
migrations
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
81
|
+
factory :rename_column, class: "Hash" do
|
82
|
+
migration_name { "Post" }
|
83
|
+
migrations do
|
84
|
+
[
|
85
|
+
{
|
86
|
+
action: "rename_column",
|
87
|
+
table_name: "posts",
|
88
|
+
column: "content",
|
89
|
+
new_column_name: "content_new",
|
90
|
+
}
|
91
|
+
]
|
92
|
+
end
|
83
93
|
end
|
84
94
|
|
85
|
-
factory :remove_column, class: Hash do
|
86
|
-
migration_name "Post"
|
87
|
-
migrations
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
95
|
+
factory :remove_column, class: "Hash" do
|
96
|
+
migration_name { "Post" }
|
97
|
+
migrations do
|
98
|
+
[
|
99
|
+
{
|
100
|
+
action: "remove_column",
|
101
|
+
table_name: "posts",
|
102
|
+
column: "title",
|
103
|
+
},
|
104
|
+
{
|
105
|
+
action: "rename_column",
|
106
|
+
table_name: "posts",
|
107
|
+
column: "views",
|
108
|
+
new_column_name: "views_by_users",
|
109
|
+
}
|
110
|
+
]
|
111
|
+
end
|
100
112
|
end
|
101
113
|
|
102
|
-
factory :change_column_type, class: Hash do
|
103
|
-
migration_name "Post"
|
104
|
-
migrations
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
114
|
+
factory :change_column_type, class: "Hash" do
|
115
|
+
migration_name { "Post" }
|
116
|
+
migrations do
|
117
|
+
[
|
118
|
+
{
|
119
|
+
action: "change_column_type",
|
120
|
+
table_name: "posts",
|
121
|
+
column: "content_new",
|
122
|
+
new_column_type: "string",
|
123
|
+
},
|
124
|
+
{
|
125
|
+
action: "add_index_to_column",
|
126
|
+
table_name: "posts",
|
127
|
+
column: "views_by_users",
|
128
|
+
}
|
129
|
+
]
|
130
|
+
end
|
117
131
|
end
|
118
132
|
|
119
|
-
factory :add_index_to_column, class: Hash do
|
120
|
-
migration_name "Post"
|
121
|
-
migrations
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
133
|
+
factory :add_index_to_column, class: "Hash" do
|
134
|
+
migration_name { "Post" }
|
135
|
+
migrations do
|
136
|
+
[
|
137
|
+
{
|
138
|
+
action: "add_index_to_column",
|
139
|
+
table_name: "posts",
|
140
|
+
column: "content_new",
|
141
|
+
}
|
142
|
+
]
|
143
|
+
end
|
128
144
|
end
|
129
145
|
|
130
|
-
factory :belongs_to, class: Hash do
|
131
|
-
migration_name "Post"
|
132
|
-
migrations
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
146
|
+
factory :belongs_to, class: "Hash" do
|
147
|
+
migration_name { "Post" }
|
148
|
+
migrations do
|
149
|
+
[
|
150
|
+
{
|
151
|
+
action: "belongs_to",
|
152
|
+
table_name: "posts",
|
153
|
+
belongs_to: "users",
|
154
|
+
}
|
155
|
+
]
|
156
|
+
end
|
139
157
|
end
|
140
158
|
|
141
|
-
factory :remove_index_to_column, class: Hash do
|
142
|
-
migration_name "Post"
|
143
|
-
migrations
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
159
|
+
factory :remove_index_to_column, class: "Hash" do
|
160
|
+
migration_name { "Post" }
|
161
|
+
migrations do
|
162
|
+
[
|
163
|
+
{
|
164
|
+
action: "remove_index_to_column",
|
165
|
+
table_name: "posts",
|
166
|
+
column: "views_by_users",
|
167
|
+
}
|
168
|
+
]
|
169
|
+
end
|
150
170
|
end
|
151
171
|
|
152
|
-
factory :drop_table, class: Hash do
|
153
|
-
migration_name "Post"
|
154
|
-
migrations
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
172
|
+
factory :drop_table, class: "Hash" do
|
173
|
+
migration_name { "Post" }
|
174
|
+
migrations do
|
175
|
+
[
|
176
|
+
{
|
177
|
+
action: "drop_table",
|
178
|
+
table_name: "posts",
|
179
|
+
}
|
180
|
+
]
|
181
|
+
end
|
160
182
|
end
|
161
183
|
end
|
data/spec/factories/model.rb
CHANGED
@@ -1,36 +1,40 @@
|
|
1
|
-
|
2
|
-
factory :post_one, class: Hash do
|
3
|
-
model_name "Post"
|
4
|
-
attributes
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
1
|
+
FactoryBot.define do
|
2
|
+
factory :post_one, class: "Hash" do
|
3
|
+
model_name { "Post" }
|
4
|
+
attributes do
|
5
|
+
[
|
6
|
+
{
|
7
|
+
attribute_name: "title",
|
8
|
+
attribute_type: "string",
|
9
|
+
index: true
|
10
|
+
},
|
11
|
+
{
|
12
|
+
attribute_name: "content",
|
13
|
+
attribute_type: "text"
|
14
|
+
},
|
15
|
+
]
|
16
|
+
end
|
15
17
|
end
|
16
18
|
|
17
|
-
factory :user_one, class: Hash do
|
18
|
-
model_name "User"
|
19
|
-
attributes
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
19
|
+
factory :user_one, class: "Hash" do
|
20
|
+
model_name { "User" }
|
21
|
+
attributes do
|
22
|
+
[
|
23
|
+
{
|
24
|
+
attribute_name: "name",
|
25
|
+
attribute_type: "string",
|
26
|
+
index: true,
|
27
|
+
},
|
28
|
+
{
|
29
|
+
attribute_name: "metadata",
|
30
|
+
attribute_type: "jsonb"
|
31
|
+
},
|
32
|
+
]
|
33
|
+
end
|
30
34
|
end
|
31
35
|
|
32
|
-
factory :relation_one, class: Hash do
|
33
|
-
model_one_name "User"
|
34
|
-
model_two_name "Post"
|
36
|
+
factory :relation_one, class: "Hash" do
|
37
|
+
model_one_name { "User" }
|
38
|
+
model_two_name { "Post" }
|
35
39
|
end
|
36
40
|
end
|
@@ -3,7 +3,6 @@ require 'spec_helper'
|
|
3
3
|
module Localtower
|
4
4
|
module Generators
|
5
5
|
describe Model do
|
6
|
-
|
7
6
|
before(:all) do
|
8
7
|
clean_files
|
9
8
|
end
|
@@ -21,9 +20,9 @@ module Localtower
|
|
21
20
|
expect(::Localtower::Tools.word_in_file?("#{Rails.root}/app/models/post.rb", /class Post/)).to eq(true)
|
22
21
|
|
23
22
|
expect(::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /create_table "posts"/)).to eq(true)
|
24
|
-
expect(::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.string
|
25
|
-
expect(::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.text
|
26
|
-
expect(::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.index
|
23
|
+
expect(::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.string(.*)"title"/)).to eq(true)
|
24
|
+
expect(::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.text(.*)"content"/)).to eq(true)
|
25
|
+
expect(::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.index(.*)\["title"\], name: "index_posts_on_title"/)).to eq(true)
|
27
26
|
end
|
28
27
|
|
29
28
|
it 'create a user' do
|
@@ -35,9 +34,9 @@ module Localtower
|
|
35
34
|
expect(File.exist?("#{Rails.root}/app/models/user.rb")).to eq(true)
|
36
35
|
expect(::Localtower::Tools.word_in_file?("#{Rails.root}/app/models/user.rb", /class User/)).to eq(true)
|
37
36
|
expect(::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /create_table "users"/)).to eq(true)
|
38
|
-
expect(::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.string
|
39
|
-
expect(::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.jsonb
|
40
|
-
expect(::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.index
|
37
|
+
expect(::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.string(.*)"name"/)).to eq(true)
|
38
|
+
expect(::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.jsonb(.*)"metadata"/)).to eq(true)
|
39
|
+
expect(::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.index(.*)\["name"\], name: "index_users_on_name"/)).to eq(true)
|
41
40
|
end
|
42
41
|
end
|
43
42
|
end
|
@@ -3,7 +3,6 @@ require 'spec_helper'
|
|
3
3
|
module Localtower
|
4
4
|
module Generators
|
5
5
|
describe Relation do
|
6
|
-
|
7
6
|
before(:all) do
|
8
7
|
clean_files
|
9
8
|
end
|
@@ -48,8 +47,12 @@ module Localtower
|
|
48
47
|
|
49
48
|
expect(::Localtower::Tools.word_in_file?("#{Rails.root}/app/models/user_post.rb", /class UserPost/)).to eq(true)
|
50
49
|
expect(::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /create_table "user_posts"/)).to eq(true)
|
51
|
-
|
52
|
-
|
50
|
+
|
51
|
+
user_id = ::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.integer(.*)"user_id"/) || ::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.bigint(.*)"user_id"/)
|
52
|
+
post_id = ::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.integer(.*)"post_id"/) || ::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.bigint(.*)"post_id"/)
|
53
|
+
|
54
|
+
expect(user_id).to eq(true)
|
55
|
+
expect(post_id).to eq(true)
|
53
56
|
|
54
57
|
expect(::Localtower::Tools.word_in_file?("#{Rails.root}/app/models/user.rb", /has_many :posts, through: :user_posts/)).to eq(true)
|
55
58
|
expect(::Localtower::Tools.word_in_file?("#{Rails.root}/app/models/user.rb", /has_many :posts/)).to eq(true)
|
data/spec/spec_helper.rb
CHANGED
@@ -17,21 +17,13 @@ ENV['RAILS_ENV'] = 'test'
|
|
17
17
|
|
18
18
|
require File.expand_path('../dummy/config/environment.rb', __FILE__)
|
19
19
|
require 'rspec/rails'
|
20
|
-
require '
|
21
|
-
|
22
|
-
# require 'simplecov'
|
23
|
-
# Dir["#{File.join(File.dirname(__FILE__), '..')}/lib/**/*.rb"].each {|file| load file }
|
24
|
-
|
25
|
-
# SimpleCov.start do
|
26
|
-
# add_group 'Lib', '../lib'
|
27
|
-
# add_group 'App', '../app'
|
28
|
-
# end
|
20
|
+
require 'factory_bot'
|
29
21
|
|
30
22
|
Rails.application.eager_load!
|
31
23
|
Rails.backtrace_cleaner.remove_silencers!
|
32
24
|
|
33
25
|
RSpec.configure do |config|
|
34
|
-
config.include
|
26
|
+
config.include FactoryBot::Syntax::Methods
|
35
27
|
|
36
28
|
config.mock_with :rspec
|
37
29
|
config.use_transactional_fixtures = false
|
@@ -41,7 +33,7 @@ RSpec.configure do |config|
|
|
41
33
|
# config.order = 'random'
|
42
34
|
|
43
35
|
config.before(:suite) do
|
44
|
-
|
36
|
+
FactoryBot.find_definitions
|
45
37
|
end
|
46
38
|
|
47
39
|
config.before(:all) do
|
@@ -52,4 +44,3 @@ RSpec.configure do |config|
|
|
52
44
|
clean_files
|
53
45
|
end
|
54
46
|
end
|
55
|
-
|