seed_me_seymour 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe7ff8f888e1bb3df1192c3183fcf4c623926124
4
- data.tar.gz: 757f3d6f69af2228d93283f7f3757542cd88ecf1
3
+ metadata.gz: 8df3f105ff26b2b64e82274489ad49fc953205a1
4
+ data.tar.gz: 22c20503d40a7f8977afd00a4786cf22e6371cd1
5
5
  SHA512:
6
- metadata.gz: 616f89e07c8c8fe658e1f247d38d3e6c29f92f58de7c4eb1ed07a0e2eb2719c962601a73cdfe06144f7b2e9c1bf0153fd883ce54511bc34c803d3a88c3f27034
7
- data.tar.gz: c9edbdd36cb421e35fdc310a8115042af68d2e532c06a16ff2cb90954633d8814b6aad40a5df98523ef24e7919bf09044519982daab195a491f5e4f4af61d6d9
6
+ metadata.gz: d3a371b5823929b7077208aae7c0c741a04e5ebace52fa492537947abfe6f759712cd77bce56f08196429fc4ca5e890fd3ef580fde40215bed6e48e552682997
7
+ data.tar.gz: a452fa6a9b7a74d63e076ad3c10385e93096254b902810e2f9734feb0988f223ff472b956492cbd083ddc5d5a46535ef8d445d229ec662d95e60fb6262cb4081
@@ -1,3 +1,3 @@
1
1
  module SeedMeSeymour
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
@@ -1,6 +1,7 @@
1
1
  require "seed_me_seymour/version"
2
2
  require 'active_support/inflector'
3
3
  require 'rails/engine'
4
+ Rails.application.load_tasks
4
5
  # require_relative '../tasks/seed_me_seymour'
5
6
 
6
7
 
@@ -10,150 +11,150 @@ module SeedMeSeymour
10
11
  in your schema. Future releases will create seed data based on basic fields/tables and more complicated associations."
11
12
 
12
13
  end
13
-
14
- namespace :seedme do
15
- desc "seedme creates a seeds file based on an application's models and those model's column type "
16
- task :go do
17
-
18
- # leaving this code in case we need the :environment do and next two lines. they're currently at top and task excludes the environment
19
- # task :go => :environment do
20
- # require 'active_support/inflector'
21
- # require 'rails/engine'
22
-
23
-
24
- #determine the path to file
25
- path = File.expand_path('../', __FILE__)
26
- fil_e = File.join(path, '../../db/schema.rb')
27
- fi_le = File.join(path, '../../db/seeds.rb')
28
- s = File.open(fil_e)
29
- #whipe everything from seed file
30
- File.open(fi_le, 'w') {|file| file.truncate(0) }
31
-
32
- # set faker code
33
- boolean = "Faker::Boolean.boolean"
34
- date = "Faker::Date.forward(23)"
35
- decimal = "Faker::Number.decimal(2)"
36
- float = "Faker::Number.decimal(2)"
37
- integer = "Faker::Number.between(1, 10)"
38
- #indx referes to references. User references to get index into schema.rb
39
- indx = "Faker::Number.between(1, 10)"
40
- string = "Faker::StarWars.character"
41
- text = "Faker::Lorem.sentences(4)"
42
- time = "Faker::Time.forward(23, :morning)"
43
-
44
- #contigent email and password
45
- email = "Faker::Internet.email"
46
- password = "'password'"
47
-
48
- #begin parse though each line of schema.rb
49
- s.each do |line|
50
- class_singular = ""
51
- created_text = ""
52
-
53
- #if line is a model class
54
- if line.match(/(?<=create_table\s").*?(?=")/)
55
- #set model class, singularize, and capitalize
56
- classes = line.match(/(?<=create_table\s").*?(?=")/)[0]
57
- class_singular = classes.singularize.capitalize
58
- #appends to document
59
- File.open(fi_le, 'a') { |file|
60
- file.puts "10.times do \n " +
61
- class_singular + ".create!({"
62
- }
63
-
64
- #if line has a t. and is not a date time
65
- elsif line.match(/((?<=\s\st.)[a-z]{1,13})/) && line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] != "datetime"
66
- #set column name
67
- column = line.match(/\st.[a-z]{1,13}.*(?<=")(.*?)"/)[1]
68
- #if line is a string
69
- if line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "string"
70
- type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "string"
71
- type = string
72
- #if column is an email
73
- if line.match(/\st.[a-z]{1,13}.*(?<=")(.*?)"/)[1] == "email"
74
- column = "email"
75
- type = email
76
- #if column is a password
77
- elsif line.match(/\st.[a-z]{1,13}.*(?<=")(.*?)"/)[1] == "password"
78
- column = "password"
79
- type = password
80
-
81
- end
82
- #append to file
83
- File.open(fi_le, 'a') { |file|
84
- file.puts column + ": " + type + ", "
85
- }
86
- #being looking at the active record types inside individual table
87
- #if type is a text
88
- elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "text"
89
- type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
90
- type = text
91
- File.open(fi_le, 'a') { |file|
92
- file.puts column + ": " + type + ", "
93
- }
94
- #if type is a boolean
95
- elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "boolean"
96
- type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
97
- type = boolean
98
- File.open(fi_le, 'a') { |file|
99
- file.puts column + ": " + type + ", "
100
- }
101
- #if type is a date
102
- elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "date"
103
- type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
104
- type = date
105
- File.open(fi_le, 'a') { |file|
106
- file.puts column + ": " + type + ", "
107
- }
108
- #if type is a decimal
109
- elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "decimal"
110
- type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
111
- type = decimal
112
- File.open(fi_le, 'a') { |file|
113
- file.puts column + ": " + type + ", "
114
- }
115
- #if type is a float
116
- elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "float"
117
- type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
118
- type = float
119
- File.open(fi_le, 'a') { |file|
120
- file.puts column + ": " + type + ", "
121
- }
122
- #if type is an integer
123
- elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "integer"
124
- type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
125
- type = integer
126
- File.open(fi_le, 'a') { |file|
127
- file.puts column + ": " + type + ", "
128
- }
129
- #if type is a references
130
- elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "index"
131
- column = line.match(/\s[t.index].*(?<=")(?<=\s\[")(([a-z]+.\id))/)[1]
132
- type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
133
- type = indx
134
- File.open(fi_le, 'a') { |file|
135
- file.puts column + ": " + type + ", "
136
- }
137
- #if type is a time
138
- elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "time"
139
- type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
140
- type = time
141
- File.open(fi_le, 'a') { |file|
142
- file.puts column + ": " + type + ", "
143
- }
144
-
145
- end
146
- #locates the end and appends the correct end to the seed file
147
- elsif line.match(/\s\s(end)/)
148
- File.open(fi_le, 'a') { |file|
149
- file.puts "})
150
- end
151
- \n"
152
- }
153
-
154
- end
155
- end
156
- end
157
- end
158
- # File.open(fi_le, 'a') { |file|
159
- # file.puts "User.destroy_all"
14
+ #
15
+ # namespace :seedme do
16
+ # desc "seedme creates a seeds file based on an application's models and those model's column type "
17
+ # task :go do
18
+ #
19
+ # # leaving this code in case we need the :environment do and next two lines. they're currently at top and task excludes the environment
20
+ # # task :go => :environment do
21
+ # # require 'active_support/inflector'
22
+ # # require 'rails/engine'
23
+ #
24
+ #
25
+ # #determine the path to file
26
+ # path = File.expand_path('../', __FILE__)
27
+ # fil_e = File.join(path, '../../db/schema.rb')
28
+ # fi_le = File.join(path, '../../db/seeds.rb')
29
+ # s = File.open(fil_e)
30
+ # #whipe everything from seed file
31
+ # File.open(fi_le, 'w') {|file| file.truncate(0) }
32
+ #
33
+ # # set faker code
34
+ # boolean = "Faker::Boolean.boolean"
35
+ # date = "Faker::Date.forward(23)"
36
+ # decimal = "Faker::Number.decimal(2)"
37
+ # float = "Faker::Number.decimal(2)"
38
+ # integer = "Faker::Number.between(1, 10)"
39
+ # #indx referes to references. User references to get index into schema.rb
40
+ # indx = "Faker::Number.between(1, 10)"
41
+ # string = "Faker::StarWars.character"
42
+ # text = "Faker::Lorem.sentences(4)"
43
+ # time = "Faker::Time.forward(23, :morning)"
44
+ #
45
+ # #contigent email and password
46
+ # email = "Faker::Internet.email"
47
+ # password = "'password'"
48
+ #
49
+ # #begin parse though each line of schema.rb
50
+ # s.each do |line|
51
+ # class_singular = ""
52
+ # created_text = ""
53
+ #
54
+ # #if line is a model class
55
+ # if line.match(/(?<=create_table\s").*?(?=")/)
56
+ # #set model class, singularize, and capitalize
57
+ # classes = line.match(/(?<=create_table\s").*?(?=")/)[0]
58
+ # class_singular = classes.singularize.capitalize
59
+ # #appends to document
60
+ # File.open(fi_le, 'a') { |file|
61
+ # file.puts "10.times do \n " +
62
+ # class_singular + ".create!({"
63
+ # }
64
+ #
65
+ # #if line has a t. and is not a date time
66
+ # elsif line.match(/((?<=\s\st.)[a-z]{1,13})/) && line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] != "datetime"
67
+ # #set column name
68
+ # column = line.match(/\st.[a-z]{1,13}.*(?<=")(.*?)"/)[1]
69
+ # #if line is a string
70
+ # if line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "string"
71
+ # type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "string"
72
+ # type = string
73
+ # #if column is an email
74
+ # if line.match(/\st.[a-z]{1,13}.*(?<=")(.*?)"/)[1] == "email"
75
+ # column = "email"
76
+ # type = email
77
+ # #if column is a password
78
+ # elsif line.match(/\st.[a-z]{1,13}.*(?<=")(.*?)"/)[1] == "password"
79
+ # column = "password"
80
+ # type = password
81
+ #
82
+ # end
83
+ # #append to file
84
+ # File.open(fi_le, 'a') { |file|
85
+ # file.puts column + ": " + type + ", "
86
+ # }
87
+ # #being looking at the active record types inside individual table
88
+ # #if type is a text
89
+ # elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "text"
90
+ # type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
91
+ # type = text
92
+ # File.open(fi_le, 'a') { |file|
93
+ # file.puts column + ": " + type + ", "
94
+ # }
95
+ # #if type is a boolean
96
+ # elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "boolean"
97
+ # type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
98
+ # type = boolean
99
+ # File.open(fi_le, 'a') { |file|
100
+ # file.puts column + ": " + type + ", "
101
+ # }
102
+ # #if type is a date
103
+ # elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "date"
104
+ # type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
105
+ # type = date
106
+ # File.open(fi_le, 'a') { |file|
107
+ # file.puts column + ": " + type + ", "
108
+ # }
109
+ # #if type is a decimal
110
+ # elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "decimal"
111
+ # type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
112
+ # type = decimal
113
+ # File.open(fi_le, 'a') { |file|
114
+ # file.puts column + ": " + type + ", "
115
+ # }
116
+ # #if type is a float
117
+ # elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "float"
118
+ # type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
119
+ # type = float
120
+ # File.open(fi_le, 'a') { |file|
121
+ # file.puts column + ": " + type + ", "
122
+ # }
123
+ # #if type is an integer
124
+ # elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "integer"
125
+ # type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
126
+ # type = integer
127
+ # File.open(fi_le, 'a') { |file|
128
+ # file.puts column + ": " + type + ", "
129
+ # }
130
+ # #if type is a references
131
+ # elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "index"
132
+ # column = line.match(/\s[t.index].*(?<=")(?<=\s\[")(([a-z]+.\id))/)[1]
133
+ # type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
134
+ # type = indx
135
+ # File.open(fi_le, 'a') { |file|
136
+ # file.puts column + ": " + type + ", "
137
+ # }
138
+ # #if type is a time
139
+ # elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "time"
140
+ # type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
141
+ # type = time
142
+ # File.open(fi_le, 'a') { |file|
143
+ # file.puts column + ": " + type + ", "
144
+ # }
145
+ #
146
+ # end
147
+ # #locates the end and appends the correct end to the seed file
148
+ # elsif line.match(/\s\s(end)/)
149
+ # File.open(fi_le, 'a') { |file|
150
+ # file.puts "})
151
+ # end
152
+ # \n"
153
+ # }
154
+ #
155
+ # end
156
+ # end
157
+ # end
158
+ # end
159
+ # # File.open(fi_le, 'a') { |file|
160
+ # # file.puts "User.destroy_all"
@@ -8,7 +8,7 @@ require 'seed_me_seymour/version'
8
8
 
9
9
  Gem::Specification.new do |spec|
10
10
  spec.name = "seed_me_seymour"
11
- spec.version = '0.1.8'
11
+ spec.version = '0.1.9'
12
12
  spec.authors = ["Tony S.", "Brandon G." ]
13
13
  spec.email = ["saric.tony@gmail.com\n", "bmg.oak@gmail.com\n"]
14
14
  spec.licenses = ['MIT']
@@ -1,141 +1,141 @@
1
- # require_relative 'config/application'
1
+ require_relative 'config/application'
2
2
  # Rails.application.load_tasks
3
- # namespace :seedme do
4
- # desc "seedme creates a seeds file based on an application's models and those model's column type "
5
- # task :go => :environment do
6
- # require 'active_support/inflector'
7
- # require 'rails/engine'
8
- #
9
- # #determine the path to file
10
- # path = File.expand_path('../', __FILE__)
11
- # fil_e = File.join(path, 'db/schema.rb')
12
- # fi_le = File.join(path, 'db/seeds.rb')
13
- # s = File.open(fil_e)
14
- # #whipe everything from seed file
15
- # File.open(fi_le, 'w') {|file| file.truncate(0) }
16
- #
17
- # # set faker code
18
- # boolean = "Faker::Boolean.boolean"
19
- # date = "Faker::Date.forward(23)"
20
- # decimal = "Faker::Number.decimal(2)"
21
- # float = "Faker::Number.decimal(2)"
22
- # integer = "Faker::Number.between(1, 10)"
23
- # #indx referes to references. User references to get index into schema.rb
24
- # indx = "Faker::Number.between(1, 10)"
25
- # string = "Faker::StarWars.character"
26
- # text = "Faker::Lorem.sentences(4)"
27
- # time = "Faker::Time.forward(23, :morning)"
28
- #
29
- # #contigent email and password
30
- # email = "Faker::Internet.email"
31
- # password = "'password'"
32
- #
33
- # #begin parse though each line of schema.rb
34
- # s.each do |line|
35
- # class_singular = ""
36
- # created_text = ""
37
- #
38
- # #if line is a model class
39
- # if line.match(/(?<=create_table\s").*?(?=")/)
40
- # #set model class, singularize, and capitalize
41
- # classes = line.match(/(?<=create_table\s").*?(?=")/)[0]
42
- # class_singular = classes.singularize.capitalize
43
- # #appends to document
44
- # File.open(fi_le, 'a') { |file|
45
- # file.puts "10.times do \n " +
46
- # class_singular + ".create!({"
47
- # }
48
- #
49
- # #if line has a t. and is not a date time
50
- # elsif line.match(/((?<=\s\st.)[a-z]{1,13})/) && line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] != "datetime"
51
- # #set column name
52
- # column = line.match(/\st.[a-z]{1,13}.*(?<=")(.*?)"/)[1]
53
- # #if line is a string
54
- # if line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "string"
55
- # type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "string"
56
- # type = string
57
- # #if column is an email
58
- # if line.match(/\st.[a-z]{1,13}.*(?<=")(.*?)"/)[1] == "email"
59
- # column = "email"
60
- # type = email
61
- # #if column is a password
62
- # elsif line.match(/\st.[a-z]{1,13}.*(?<=")(.*?)"/)[1] == "password"
63
- # column = "password"
64
- # type = password
65
- #
66
- # end
67
- # #append to file
68
- # File.open(fi_le, 'a') { |file|
69
- # file.puts column + ": " + type + ", "
70
- # }
71
- # #being looking at the active record types inside individual table
72
- # #if type is a text
73
- # elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "text"
74
- # type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
75
- # type = text
76
- # File.open(fi_le, 'a') { |file|
77
- # file.puts column + ": " + type + ", "
78
- # }
79
- # #if type is a boolean
80
- # elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "boolean"
81
- # type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
82
- # type = boolean
83
- # File.open(fi_le, 'a') { |file|
84
- # file.puts column + ": " + type + ", "
85
- # }
86
- # #if type is a date
87
- # elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "date"
88
- # type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
89
- # type = date
90
- # File.open(fi_le, 'a') { |file|
91
- # file.puts column + ": " + type + ", "
92
- # }
93
- # #if type is a decimal
94
- # elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "decimal"
95
- # type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
96
- # type = decimal
97
- # File.open(fi_le, 'a') { |file|
98
- # file.puts column + ": " + type + ", "
99
- # }
100
- # #if type is a float
101
- # elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "float"
102
- # type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
103
- # type = float
104
- # File.open(fi_le, 'a') { |file|
105
- # file.puts column + ": " + type + ", "
106
- # }
107
- # #if type is an integer
108
- # elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "integer"
109
- # type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
110
- # type = integer
111
- # File.open(fi_le, 'a') { |file|
112
- # file.puts column + ": " + type + ", "
113
- # }
114
- # #if type is a references
115
- # elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "index"
116
- # column = line.match(/\s[t.index].*(?<=")(?<=\s\[")(([a-z]+.\id))/)[1]
117
- # type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
118
- # type = indx
119
- # File.open(fi_le, 'a') { |file|
120
- # file.puts column + ": " + type + ", "
121
- # }
122
- # #if type is a time
123
- # elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "time"
124
- # type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
125
- # type = time
126
- # File.open(fi_le, 'a') { |file|
127
- # file.puts column + ": " + type + ", "
128
- # }
129
- #
130
- # end
131
- # #locates the end and appends the correct end to the seed file
132
- # elsif line.match(/\s\s(end)/)
133
- # File.open(fi_le, 'a') { |file|
134
- # file.puts "})
135
- # end
136
- # \n"
137
- # }
138
- #
139
- # end
140
- # end
141
- # end
3
+ namespace :seedme do
4
+ desc "seedme creates a seeds file based on an application's models and those model's column type "
5
+ task :go => :environment do
6
+ require 'active_support/inflector'
7
+ require 'rails/engine'
8
+
9
+ #determine the path to file
10
+ path = File.expand_path('../', __FILE__)
11
+ fil_e = File.join(path, 'db/schema.rb')
12
+ fi_le = File.join(path, 'db/seeds.rb')
13
+ s = File.open(fil_e)
14
+ #whipe everything from seed file
15
+ File.open(fi_le, 'w') {|file| file.truncate(0) }
16
+
17
+ # set faker code
18
+ boolean = "Faker::Boolean.boolean"
19
+ date = "Faker::Date.forward(23)"
20
+ decimal = "Faker::Number.decimal(2)"
21
+ float = "Faker::Number.decimal(2)"
22
+ integer = "Faker::Number.between(1, 10)"
23
+ #indx referes to references. User references to get index into schema.rb
24
+ indx = "Faker::Number.between(1, 10)"
25
+ string = "Faker::StarWars.character"
26
+ text = "Faker::Lorem.sentences(4)"
27
+ time = "Faker::Time.forward(23, :morning)"
28
+
29
+ #contigent email and password
30
+ email = "Faker::Internet.email"
31
+ password = "'password'"
32
+
33
+ #begin parse though each line of schema.rb
34
+ s.each do |line|
35
+ class_singular = ""
36
+ created_text = ""
37
+
38
+ #if line is a model class
39
+ if line.match(/(?<=create_table\s").*?(?=")/)
40
+ #set model class, singularize, and capitalize
41
+ classes = line.match(/(?<=create_table\s").*?(?=")/)[0]
42
+ class_singular = classes.singularize.capitalize
43
+ #appends to document
44
+ File.open(fi_le, 'a') { |file|
45
+ file.puts "10.times do \n " +
46
+ class_singular + ".create!({"
47
+ }
48
+
49
+ #if line has a t. and is not a date time
50
+ elsif line.match(/((?<=\s\st.)[a-z]{1,13})/) && line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] != "datetime"
51
+ #set column name
52
+ column = line.match(/\st.[a-z]{1,13}.*(?<=")(.*?)"/)[1]
53
+ #if line is a string
54
+ if line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "string"
55
+ type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "string"
56
+ type = string
57
+ #if column is an email
58
+ if line.match(/\st.[a-z]{1,13}.*(?<=")(.*?)"/)[1] == "email"
59
+ column = "email"
60
+ type = email
61
+ #if column is a password
62
+ elsif line.match(/\st.[a-z]{1,13}.*(?<=")(.*?)"/)[1] == "password"
63
+ column = "password"
64
+ type = password
65
+
66
+ end
67
+ #append to file
68
+ File.open(fi_le, 'a') { |file|
69
+ file.puts column + ": " + type + ", "
70
+ }
71
+ #being looking at the active record types inside individual table
72
+ #if type is a text
73
+ elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "text"
74
+ type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
75
+ type = text
76
+ File.open(fi_le, 'a') { |file|
77
+ file.puts column + ": " + type + ", "
78
+ }
79
+ #if type is a boolean
80
+ elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "boolean"
81
+ type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
82
+ type = boolean
83
+ File.open(fi_le, 'a') { |file|
84
+ file.puts column + ": " + type + ", "
85
+ }
86
+ #if type is a date
87
+ elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "date"
88
+ type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
89
+ type = date
90
+ File.open(fi_le, 'a') { |file|
91
+ file.puts column + ": " + type + ", "
92
+ }
93
+ #if type is a decimal
94
+ elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "decimal"
95
+ type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
96
+ type = decimal
97
+ File.open(fi_le, 'a') { |file|
98
+ file.puts column + ": " + type + ", "
99
+ }
100
+ #if type is a float
101
+ elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "float"
102
+ type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
103
+ type = float
104
+ File.open(fi_le, 'a') { |file|
105
+ file.puts column + ": " + type + ", "
106
+ }
107
+ #if type is an integer
108
+ elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "integer"
109
+ type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
110
+ type = integer
111
+ File.open(fi_le, 'a') { |file|
112
+ file.puts column + ": " + type + ", "
113
+ }
114
+ #if type is a references
115
+ elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "index"
116
+ column = line.match(/\s[t.index].*(?<=")(?<=\s\[")(([a-z]+.\id))/)[1]
117
+ type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
118
+ type = indx
119
+ File.open(fi_le, 'a') { |file|
120
+ file.puts column + ": " + type + ", "
121
+ }
122
+ #if type is a time
123
+ elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "time"
124
+ type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
125
+ type = time
126
+ File.open(fi_le, 'a') { |file|
127
+ file.puts column + ": " + type + ", "
128
+ }
129
+
130
+ end
131
+ #locates the end and appends the correct end to the seed file
132
+ elsif line.match(/\s\s(end)/)
133
+ File.open(fi_le, 'a') { |file|
134
+ file.puts "})
135
+ end
136
+ \n"
137
+ }
138
+
139
+ end
140
+ end
141
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seed_me_seymour
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony S.