localtower 0.2.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +12 -9
  3. data/app/controllers/localtower/pages_controller.rb +17 -0
  4. data/app/views/localtower/pages/logs.html.erb +42 -28
  5. data/config/routes.rb +2 -0
  6. data/lib/localtower/plugins/capture.rb +72 -47
  7. data/lib/localtower/tools.rb +1 -1
  8. data/lib/localtower/version.rb +1 -1
  9. data/public/screenshots/v0.1.6/5_capture.png +0 -0
  10. data/spec/dummy/Gemfile +1 -21
  11. data/spec/dummy/Gemfile.lock +103 -144
  12. data/spec/dummy/app/controllers/pages_controller.rb +8 -0
  13. data/spec/dummy/app/views/pages/home.html.erb +1 -0
  14. data/spec/dummy/config/application.rb +0 -9
  15. data/spec/dummy/config/environments/development.rb +0 -7
  16. data/spec/dummy/config/initializers/new_framework_defaults.rb +0 -3
  17. data/spec/dummy/config/routes.rb +2 -0
  18. data/spec/dummy/log/development.log +2 -132
  19. data/spec/dummy/log/localtower.log +1220 -2014
  20. data/spec/dummy/log/test.log +1246 -2195
  21. data/spec/factories/migration.rb +161 -139
  22. data/spec/factories/model.rb +34 -30
  23. data/spec/lib/localtower/generators/model_spec.rb +6 -7
  24. data/spec/lib/localtower/generators/relation_spec.rb +6 -3
  25. data/spec/spec_helper.rb +3 -12
  26. metadata +68 -130
  27. data/spec/dummy/coverage/assets/0.10.0/application.css +0 -799
  28. data/spec/dummy/coverage/assets/0.10.0/application.js +0 -1707
  29. data/spec/dummy/coverage/assets/0.10.0/colorbox/border.png +0 -0
  30. data/spec/dummy/coverage/assets/0.10.0/colorbox/controls.png +0 -0
  31. data/spec/dummy/coverage/assets/0.10.0/colorbox/loading.gif +0 -0
  32. data/spec/dummy/coverage/assets/0.10.0/colorbox/loading_background.png +0 -0
  33. data/spec/dummy/coverage/assets/0.10.0/favicon_green.png +0 -0
  34. data/spec/dummy/coverage/assets/0.10.0/favicon_red.png +0 -0
  35. data/spec/dummy/coverage/assets/0.10.0/favicon_yellow.png +0 -0
  36. data/spec/dummy/coverage/assets/0.10.0/loading.gif +0 -0
  37. data/spec/dummy/coverage/assets/0.10.0/magnify.png +0 -0
  38. data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  39. data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  40. data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  41. data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  42. data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  43. data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  44. data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  45. data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  46. data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-icons_222222_256x240.png +0 -0
  47. data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  48. data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-icons_454545_256x240.png +0 -0
  49. data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-icons_888888_256x240.png +0 -0
  50. data/spec/dummy/coverage/assets/0.10.0/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  51. data/spec/dummy/coverage/index.html +0 -294
  52. data/spec/dummy/tmp/restart.txt +0 -0
@@ -1,161 +1,183 @@
1
- FactoryGirl.define do
2
- factory :create_table, class: Hash do
3
- migration_name "Post"
4
- migrations [
5
- {
6
- action: "create_table",
7
- table_name: "posts"
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
- action: "create_table",
17
- table_name: "users"
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
- action: "add_column",
27
- table_name: "posts",
28
- column: "title",
29
- column_type: "string",
30
- index: true,
31
- nullable: true,
32
- },
33
- {
34
- action: "add_column",
35
- table_name: "posts",
36
- column: "content",
37
- column_type: "text",
38
- index: false,
39
- nullable: true,
40
- },
41
- {
42
- action: "add_column",
43
- table_name: "posts",
44
- column: "views",
45
- column_type: "integer",
46
- index: true,
47
- default: 0,
48
- nullable: false,
49
- },
50
- {
51
- action: "add_column",
52
- table_name: "posts",
53
- column: "tags",
54
- column_type: "array",
55
- index: true,
56
- nullable: true,
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
- action: "add_column",
66
- table_name: "posts",
67
- column: "title",
68
- # column_type: "string",
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
- action: "rename_column",
78
- table_name: "posts",
79
- column: "content",
80
- new_column_name: "content_new",
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
- action: "remove_column",
90
- table_name: "posts",
91
- column: "title",
92
- },
93
- {
94
- action: "rename_column",
95
- table_name: "posts",
96
- column: "views",
97
- new_column_name: "views_by_users",
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
- action: "change_column_type",
107
- table_name: "posts",
108
- column: "content_new",
109
- new_column_type: "string",
110
- },
111
- {
112
- action: "add_index_to_column",
113
- table_name: "posts",
114
- column: "views_by_users",
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
- action: "add_index_to_column",
124
- table_name: "posts",
125
- column: "content_new",
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
- action: "belongs_to",
135
- table_name: "posts",
136
- belongs_to: "users",
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
- action: "remove_index_to_column",
146
- table_name: "posts",
147
- column: "views_by_users",
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
- action: "drop_table",
157
- table_name: "posts",
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
@@ -1,36 +1,40 @@
1
- FactoryGirl.define do
2
- factory :post_one, class: Hash do
3
- model_name "Post"
4
- attributes [
5
- {
6
- attribute_name: "title",
7
- attribute_type: "string",
8
- index: true
9
- },
10
- {
11
- attribute_name: "content",
12
- attribute_type: "text"
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
- attribute_name: "name",
22
- attribute_type: "string",
23
- index: true,
24
- },
25
- {
26
- attribute_name: "metadata",
27
- attribute_type: "jsonb"
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 "title"/)).to eq(true)
25
- expect(::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.text "content"/)).to eq(true)
26
- expect(::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.index \["title"\], name: "index_posts_on_title", using: :btree/)).to eq(true)
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 "name"/)).to eq(true)
39
- expect(::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.jsonb "metadata"/)).to eq(true)
40
- expect(::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.index \["name"\], name: "index_users_on_name", using: :btree/)).to eq(true)
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
- expect(::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.integer "user_id"/)).to eq(true)
52
- expect(::Localtower::Tools.word_in_file?("#{Rails.root}/db/schema.rb", /t.integer "post_id"/)).to eq(true)
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 'factory_girl'
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 FactoryGirl::Syntax::Methods
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
- FactoryGirl.find_definitions
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
-