seed_me_seymour 0.1.17 → 0.1.18

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: 840e1eb0b7a5b16ad881d2fc05396dd73d4aa97f
4
- data.tar.gz: 10fc0d31cbc2b5ce0bbb1aedc1259b9ec137a93b
3
+ metadata.gz: 1f85aac6f8366d416fba78aa47dd75ba4b52c9b9
4
+ data.tar.gz: aaeaa2f728801432418b3a7d47005876d03a3add
5
5
  SHA512:
6
- metadata.gz: bd688a10dc6407d576c1e7a645b008bd921b2c45e864439e5c3a09f560f100454c3954cb138ab78ac1e20ed74018bca8cabe78850a02fc32dc064bfd815546d9
7
- data.tar.gz: 4ed06fb8f5dc1871a567c6091609d3fa40ff7f646545d2495a7ab38c4cdac8760bf8da28ac85a3e8bc4772101c807a6fac4be455fd3102bf3d7037a369f2cd26
6
+ metadata.gz: 917764ec0b88cb676707184319330e8c398b9a9c75eefd8bf8d3570f9ab457d8050a3f6d984bde08222bf40249ff848988b229f116c8150db4443e6aac9703f2
7
+ data.tar.gz: eb09adcbc0ea868e3eebffc516ad731ea36d429f4fc440cc1c189febb297c0ad296fb6398e7d05f7287d8edd18f193b46cc723d612c96ee65b3c783fa46df27e
data/Rakefile CHANGED
@@ -1,12 +1,19 @@
1
- require_relative 'config/application'
2
- require 'active_support/inflector'
3
- require 'rails/engine'
1
+ $:.unshift File.dirname(__FILE__)
4
2
 
5
- # Rails.application.load_tasks
3
+ Dir['tasks/**/*.rake'].each { |rake| load rake }
6
4
 
7
- namespace :seedme do
8
- desc "seedme creates a seeds file based on an application's models and those model's column type "
9
- task :go do
5
+ require 'bundler'
6
+ Bundler::GemHelper.install_tasks
7
+
8
+ # require_relative 'config/application'
9
+ # require 'active_support/inflector'
10
+ # require 'rails/engine'
11
+ # import "./tasks/seed_me_seymour.rake"
12
+ # # Rails.application.load_tasks
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
10
17
 
11
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
12
19
  # task :go => :environment do
@@ -15,135 +22,135 @@ namespace :seedme do
15
22
 
16
23
 
17
24
  #determine the path to file
18
- path = File.expand_path('../', __FILE__)
19
- fil_e = File.join(path, '../../db/schema.rb')
20
- fi_le = File.join(path, '../../db/seeds.rb')
21
- s = File.open(fil_e)
22
- #whipe everything from seed file
23
- File.open(fi_le, 'w') {|file| file.truncate(0) }
24
-
25
- # set faker code
26
- boolean = "Faker::Boolean.boolean"
27
- date = "Faker::Date.forward(23)"
28
- decimal = "Faker::Number.decimal(2)"
29
- float = "Faker::Number.decimal(2)"
30
- integer = "Faker::Number.between(1, 10)"
31
- #indx referes to references. User references to get index into schema.rb
32
- indx = "Faker::Number.between(1, 10)"
33
- string = "Faker::StarWars.character"
34
- text = "Faker::Lorem.sentences(4)"
35
- time = "Faker::Time.forward(23, :morning)"
36
-
37
- #contigent email and password
38
- email = "Faker::Internet.email"
39
- password = "'password'"
40
-
41
- #begin parse though each line of schema.rb
42
- s.each do |line|
43
- class_singular = ""
44
- created_text = ""
45
-
46
- #if line is a model class
47
- if line.match(/(?<=create_table\s").*?(?=")/)
48
- #set model class, singularize, and capitalize
49
- classes = line.match(/(?<=create_table\s").*?(?=")/)[0]
50
- class_singular = classes.singularize.capitalize
51
- #appends to document
52
- File.open(fi_le, 'a') { |file|
53
- file.puts "10.times do \n " +
54
- class_singular + ".create!({"
55
- }
56
-
57
- #if line has a t. and is not a date time
58
- elsif line.match(/((?<=\s\st.)[a-z]{1,13})/) && line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] != "datetime"
59
- #set column name
60
- column = line.match(/\st.[a-z]{1,13}.*(?<=")(.*?)"/)[1]
61
- #if line is a string
62
- if line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "string"
63
- type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "string"
64
- type = string
65
- #if column is an email
66
- if line.match(/\st.[a-z]{1,13}.*(?<=")(.*?)"/)[1] == "email"
67
- column = "email"
68
- type = email
69
- #if column is a password
70
- elsif line.match(/\st.[a-z]{1,13}.*(?<=")(.*?)"/)[1] == "password"
71
- column = "password"
72
- type = password
73
-
74
- end
75
- #append to file
76
- File.open(fi_le, 'a') { |file|
77
- file.puts column + ": " + type + ", "
78
- }
79
- #being looking at the active record types inside individual table
80
- #if type is a text
81
- elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "text"
82
- type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
83
- type = text
84
- File.open(fi_le, 'a') { |file|
85
- file.puts column + ": " + type + ", "
86
- }
87
- #if type is a boolean
88
- elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "boolean"
89
- type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
90
- type = boolean
91
- File.open(fi_le, 'a') { |file|
92
- file.puts column + ": " + type + ", "
93
- }
94
- #if type is a date
95
- elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "date"
96
- type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
97
- type = date
98
- File.open(fi_le, 'a') { |file|
99
- file.puts column + ": " + type + ", "
100
- }
101
- #if type is a decimal
102
- elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "decimal"
103
- type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
104
- type = decimal
105
- File.open(fi_le, 'a') { |file|
106
- file.puts column + ": " + type + ", "
107
- }
108
- #if type is a float
109
- elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "float"
110
- type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
111
- type = float
112
- File.open(fi_le, 'a') { |file|
113
- file.puts column + ": " + type + ", "
114
- }
115
- #if type is an integer
116
- elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "integer"
117
- type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
118
- type = integer
119
- File.open(fi_le, 'a') { |file|
120
- file.puts column + ": " + type + ", "
121
- }
122
- #if type is a references
123
- elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "index"
124
- column = line.match(/\s[t.index].*(?<=")(?<=\s\[")(([a-z]+.\id))/)[1]
125
- type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
126
- type = indx
127
- File.open(fi_le, 'a') { |file|
128
- file.puts column + ": " + type + ", "
129
- }
130
- #if type is a time
131
- elsif line.match(/((?<=\s\st.)[a-z]{1,13})/)[0] == "time"
132
- type = line.match(/((?<=\s\st.)[a-z]{1,13})/)[0]
133
- type = time
134
- File.open(fi_le, 'a') { |file|
135
- file.puts column + ": " + type + ", "
136
- }
137
-
138
- end
139
- #locates the end and appends the correct end to the seed file
140
- elsif line.match(/\s\s(end)/)
141
- File.open(fi_le, 'a') { |file|
142
- file.puts "})
143
- end
144
- \n"
145
- }
146
-
147
- end
148
- end
149
- end
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
@@ -1,3 +1,3 @@
1
1
  module SeedMeSeymour
2
- VERSION = "0.1.17"
2
+ VERSION = "0.1.18"
3
3
  end
@@ -10,7 +10,7 @@ require 'seed_me_seymour/version'
10
10
 
11
11
  Gem::Specification.new do |spec|
12
12
  spec.name = "seed_me_seymour"
13
- spec.version = '0.1.17'
13
+ spec.version = '0.1.18'
14
14
  spec.authors = ["Tony S.", "Brandon G." ]
15
15
  spec.email = ["saric.tony@gmail.com\n", "bmg.oak@gmail.com\n"]
16
16
  spec.licenses = ['MIT']
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.17
4
+ version: 0.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony S.
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-04-27 00:00:00.000000000 Z
12
+ date: 2017-04-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler