raw_sql_builder 0.1.3
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 +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/LICENSE.txt +21 -0
- data/README.md +74 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/raw_sql_builder.rb +296 -0
- data/lib/raw_sql_builder/version.rb +3 -0
- data/raw_sql_builder.gemspec +34 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bab3daf639ec844a3ceab09315e46a1d156ee7de
|
4
|
+
data.tar.gz: 7d08250074f05535b9c61f3afb4d33f3f05ab64a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bff3de783f31286037b7833622e2eaa1cbe2b566126e8efbfb81b21da350416d89f7c751f2756d73bc624090d5d9478e5081bfced37e7e614e4c81fe95030027
|
7
|
+
data.tar.gz: fb21eb9619802da5053076f6f738c71664b2b1ae5aa4d405e6e12bb242f0cc40b1e38c62a3e905f3581641b09a49520f4720f4fa5dfcb61d8210cecd0f4c782d
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Matias Tarantini
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# RawSqlBuilder
|
2
|
+
|
3
|
+
This gem is to ease the pain of mass creating and updating object attributes in your database.
|
4
|
+
It will adapt to different tables, columns, and column-types.
|
5
|
+
Will dramatically speed up mass creates/updates.
|
6
|
+
|
7
|
+
- Raw Sql Rules:
|
8
|
+
- Keys being assigned to can be without quotes or surrounded by double quotes
|
9
|
+
- Double quotes are recommended to prevent a column name from being confused
|
10
|
+
with an action. Ex: column name "order"
|
11
|
+
- Values being assigned must be surrounded by single quotes
|
12
|
+
- Hashes:
|
13
|
+
- No exterior curly braces
|
14
|
+
- A hash within the value of another hash must be surrounded by double quotes
|
15
|
+
- Interior hash quotes must be escaped double quotes
|
16
|
+
- Interior hash must use : not =>
|
17
|
+
- Ex: '"main"=>"{\"key\":\"value\"}"'
|
18
|
+
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
Add this line to your application's Gemfile:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
gem 'raw_sql_builder'
|
25
|
+
```
|
26
|
+
|
27
|
+
And then execute:
|
28
|
+
|
29
|
+
$ bundle
|
30
|
+
|
31
|
+
Or install it yourself as:
|
32
|
+
|
33
|
+
$ gem install raw_sql_builder
|
34
|
+
|
35
|
+
## Usage
|
36
|
+
|
37
|
+
Pass through a collection or array of objects to one of the methods below.
|
38
|
+
Will also accept a single object.
|
39
|
+
|
40
|
+
- Creating:
|
41
|
+
- Use the method 'new' to create new objects without saving them to the database.
|
42
|
+
- Once all objects have attributes assigned, pass them through to mass_create or
|
43
|
+
mass_create_or_update to be created.
|
44
|
+
|
45
|
+
- Updating:
|
46
|
+
- Assign attributes to objects, I prefer using the method 'assign_attributes.'
|
47
|
+
- Once all attributes are assigned for all objects pass them through to mass_update or
|
48
|
+
mass_create_or_update for updating.
|
49
|
+
|
50
|
+
- Methods:
|
51
|
+
- mass_create(objects)
|
52
|
+
- This will only do a creation query and include objects that return true on 'new_record?'
|
53
|
+
- Any existing objects that have updated attributes and were passed through will be ignored.
|
54
|
+
- mass_update(objects)
|
55
|
+
- Will only update existing objects and ignore new objects.
|
56
|
+
- mass_create_or_update(objects)
|
57
|
+
- Will separate new objects and updated objects, then run respective queries.
|
58
|
+
- execute(query)
|
59
|
+
- Will execute the query you pass through.
|
60
|
+
|
61
|
+
## Development
|
62
|
+
|
63
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
64
|
+
|
65
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
66
|
+
|
67
|
+
## Contributing
|
68
|
+
|
69
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/raw_sql_builder. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
70
|
+
|
71
|
+
|
72
|
+
## License
|
73
|
+
|
74
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "raw_sql_builder"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,296 @@
|
|
1
|
+
require "raw_sql_builder/version"
|
2
|
+
|
3
|
+
module RawSqlBuilder
|
4
|
+
class << self
|
5
|
+
###### Public methods ######
|
6
|
+
### Raw SQL methods
|
7
|
+
|
8
|
+
def mass_create(objects)
|
9
|
+
run([*objects], :create)
|
10
|
+
end
|
11
|
+
|
12
|
+
def mass_update(objects)
|
13
|
+
run([*objects], :update)
|
14
|
+
end
|
15
|
+
|
16
|
+
def mass_create_or_update(objects)
|
17
|
+
run([*objects], :both)
|
18
|
+
end
|
19
|
+
|
20
|
+
def execute(query)
|
21
|
+
ActiveRecord::Base.connection.execute(query)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
###### Private methods ######
|
27
|
+
### Raw SQL private methods
|
28
|
+
|
29
|
+
def run(objects, type)
|
30
|
+
return puts 'No objects passed through.' if objects.blank?
|
31
|
+
setup_and_loop_objects(objects, type)
|
32
|
+
puts "Creates: #{@creates.size}, Updates: #{@updates.size}"
|
33
|
+
results = check_and_execute(type)
|
34
|
+
set_changes_applied(results)
|
35
|
+
true
|
36
|
+
end
|
37
|
+
|
38
|
+
### Run sub-methods
|
39
|
+
|
40
|
+
def setup_and_loop_objects(objects, type)
|
41
|
+
setup_globals(objects)
|
42
|
+
organize_objects(objects, type)
|
43
|
+
end
|
44
|
+
|
45
|
+
def check_and_execute(type)
|
46
|
+
if create?(type)
|
47
|
+
results = execute(get_create_query) if @creates.size > 0
|
48
|
+
end
|
49
|
+
if update?(type)
|
50
|
+
execute(get_update_query) if @updates_hash.size > 0
|
51
|
+
get_update_exception_queries.each do |query|
|
52
|
+
execute(query)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
results
|
56
|
+
end
|
57
|
+
|
58
|
+
def set_changes_applied(results = nil)
|
59
|
+
return if @creates.none? && @updates.none?
|
60
|
+
|
61
|
+
@creates.each_with_index do |c, i|
|
62
|
+
c.id = results.values[i][0]
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
### Run methods sub-methods
|
67
|
+
|
68
|
+
def setup_globals(objects)
|
69
|
+
@object_class = objects.first.class
|
70
|
+
@table_name = get_table_name(@object_class.name)
|
71
|
+
@columns_hash = @object_class.columns_hash
|
72
|
+
@creates, @updates, @updates_hash, @update_exceptions_hash = [], [], [], []
|
73
|
+
end
|
74
|
+
|
75
|
+
def organize_objects(objects, type)
|
76
|
+
objects.each do |o|
|
77
|
+
next if o.blank?
|
78
|
+
if o.new_record? && create?(type)
|
79
|
+
@creates << o
|
80
|
+
elsif o.changed? && update?(type)
|
81
|
+
filtered_changes = filter_changes(o.changes)
|
82
|
+
next if filtered_changes.blank?
|
83
|
+
|
84
|
+
organize_updates(o, filtered_changes)
|
85
|
+
@updates << o
|
86
|
+
end
|
87
|
+
set_created_at_and_updated_at(o)
|
88
|
+
o.changes_applied
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def organize_updates(object, filtered_changes)
|
93
|
+
check_changes = filtered_changes.values.map { |v| true if v.blank? }.compact
|
94
|
+
|
95
|
+
if check_changes.any?
|
96
|
+
@update_exceptions_hash << { object.id => filtered_changes }
|
97
|
+
else
|
98
|
+
@updates_hash << { object.id => filtered_changes }
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def create?(type)
|
103
|
+
type == :create || type == :both
|
104
|
+
end
|
105
|
+
|
106
|
+
def update?(type)
|
107
|
+
type == :update || type == :both
|
108
|
+
end
|
109
|
+
|
110
|
+
def set_created_at_and_updated_at(object)
|
111
|
+
object.created_at = Time.zone.now if
|
112
|
+
@columns_hash['created_at'].present? && object.created_at.blank?
|
113
|
+
object.updated_at = Time.zone.now if
|
114
|
+
@columns_hash['updated_at'].present? && object.updated_at.blank?
|
115
|
+
object
|
116
|
+
end
|
117
|
+
|
118
|
+
### Getting create/update queries
|
119
|
+
|
120
|
+
def get_create_query
|
121
|
+
keys_string = (@columns_hash.keys - ['id']).join('", "')
|
122
|
+
values_string = create_values_string
|
123
|
+
create_query(keys_string, values_string)
|
124
|
+
end
|
125
|
+
|
126
|
+
def get_update_query
|
127
|
+
changed_columns = @updates_hash.map { |c| c.values.map(&:keys) }.flatten.uniq
|
128
|
+
columns_info = @columns_hash.slice(*(['id'] + changed_columns))
|
129
|
+
return unless columns_info.size > 1
|
130
|
+
|
131
|
+
update_query(*get_update_arrays(columns_info))
|
132
|
+
end
|
133
|
+
|
134
|
+
def get_update_exception_queries
|
135
|
+
@update_exceptions_hash.map do |exception|
|
136
|
+
update_exception_query(exception)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
### Create sub-methods
|
141
|
+
|
142
|
+
def create_values_string
|
143
|
+
create_values.map { |v| v.join(', ') }.join('), (')
|
144
|
+
end
|
145
|
+
|
146
|
+
def create_values
|
147
|
+
@creates.map do |o|
|
148
|
+
o.attributes.except('id').map do |k, v|
|
149
|
+
@type = convert_type(@columns_hash[k])
|
150
|
+
format_value(v, 'DEFAULT')
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def create_query(keys_string, values_string)
|
156
|
+
"INSERT INTO #{@table_name} (\"#{keys_string}\") VALUES (#{values_string}) RETURNING id;"
|
157
|
+
end
|
158
|
+
|
159
|
+
### Update sub-methods
|
160
|
+
|
161
|
+
def get_update_arrays(columns_info)
|
162
|
+
keys_array = []
|
163
|
+
values_array = []
|
164
|
+
columns_info.each do |k, v|
|
165
|
+
@column = k
|
166
|
+
@type = convert_type(v)
|
167
|
+
values_array << update_values_string
|
168
|
+
keys_array << update_keys_string unless @column == 'id'
|
169
|
+
end
|
170
|
+
[keys_array, values_array]
|
171
|
+
end
|
172
|
+
|
173
|
+
def update_values_string
|
174
|
+
"unnest(array[#{update_values}])#{"::#{@type}"} as #{@column}"
|
175
|
+
end
|
176
|
+
|
177
|
+
def update_values
|
178
|
+
if @column == 'id'
|
179
|
+
@updates_hash.map(&:keys)
|
180
|
+
else
|
181
|
+
update_array.join(', ')
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
def update_array
|
186
|
+
@updates_hash.map do |c|
|
187
|
+
c.values.map do |v|
|
188
|
+
format_value(v[@column])
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
def update_keys_string
|
194
|
+
"\"#{@column}\" = COALESCE(source.#{@column}::#{@type}, #{@table_name}.#{@column}::#{@type})"
|
195
|
+
end
|
196
|
+
|
197
|
+
def update_query(keys_array, values_array)
|
198
|
+
"UPDATE #{@table_name} SET #{keys_array.join(', ')} FROM
|
199
|
+
( SELECT #{values_array.join(', ')}) as source WHERE #{@table_name}.id = source.id;"
|
200
|
+
end
|
201
|
+
|
202
|
+
### Update Exception sub-methods
|
203
|
+
|
204
|
+
def update_exception_values_array(exception)
|
205
|
+
exception.values.map do |hash|
|
206
|
+
hash.map do |k, v|
|
207
|
+
@type = convert_type(@columns_hash[k])
|
208
|
+
"\"#{k}\" = #{format_value(v)}::#{@type}"
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
def update_exception_query(exception)
|
214
|
+
"UPDATE #{@table_name} SET #{update_exception_values_array(exception).join(', ')}
|
215
|
+
WHERE #{@table_name}.id = #{exception.keys.first};"
|
216
|
+
end
|
217
|
+
|
218
|
+
### Helper methods
|
219
|
+
|
220
|
+
def filter_changes(changes)
|
221
|
+
return {} unless changes.size > 0
|
222
|
+
filtered_changes = {}
|
223
|
+
changes.each do |k, v|
|
224
|
+
filtered_changes[k] = v[1] unless v[0].blank? && v[1].blank?
|
225
|
+
end
|
226
|
+
filtered_changes
|
227
|
+
end
|
228
|
+
|
229
|
+
def get_table_name(name)
|
230
|
+
name = name.deconstantize unless name.deconstantize.blank?
|
231
|
+
name.tableize
|
232
|
+
end
|
233
|
+
|
234
|
+
def objects_count(type)
|
235
|
+
return @creates.size if type == :create
|
236
|
+
@updates_hash.size + @update_exceptions_hash.size
|
237
|
+
end
|
238
|
+
|
239
|
+
def format_value(value, default = 'NULL')
|
240
|
+
if value.present? || value == false
|
241
|
+
"'#{type_formatting(value)}'"
|
242
|
+
else
|
243
|
+
default
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
def type_formatting(value)
|
248
|
+
@type = 'json' if @type == 'text' && (value.is_a?(Hash) || value.is_a?(Array))
|
249
|
+
|
250
|
+
if @type == 'text[]'
|
251
|
+
value = value.flatten.uniq.to_s if value.is_a?(Array)
|
252
|
+
value = "{#{value.trim_ends(%w([ ]))}}"
|
253
|
+
elsif @type == 'hstore' && value.is_a?(Hash)
|
254
|
+
value = value.map do |k, v|
|
255
|
+
"\"#{k}\"=>\"#{v.to_s.gsub('=>', ':').gsub('"', '\"')}\""
|
256
|
+
end.join(', ')
|
257
|
+
elsif @type == 'json'
|
258
|
+
value = "#{value.to_s.gsub('=>', ':')}"
|
259
|
+
end
|
260
|
+
value.to_s.gsub("'nil'", "'null'").gsub("'", "''").gsub("''''", "''")
|
261
|
+
end
|
262
|
+
|
263
|
+
def convert_type(attributes)
|
264
|
+
if attributes.type == :text
|
265
|
+
return 'text[]' if attributes.array
|
266
|
+
'text'
|
267
|
+
else
|
268
|
+
convert_hash[attributes.type] || attributes.type.to_s
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
### Hashes
|
273
|
+
|
274
|
+
def convert_hash
|
275
|
+
{
|
276
|
+
datetime: 'timestamp',
|
277
|
+
string: 'text',
|
278
|
+
fixnum: 'integer',
|
279
|
+
boolean: 'boolean'
|
280
|
+
}
|
281
|
+
end
|
282
|
+
|
283
|
+
def response_hash
|
284
|
+
{
|
285
|
+
create: {
|
286
|
+
skip: "No eligible objects to create for #{@object_class}... Skipping.",
|
287
|
+
complete: "#{@object_class} creating complete."
|
288
|
+
},
|
289
|
+
update: {
|
290
|
+
skip: "No changed columns for update for #{@object_class}... Skipping.",
|
291
|
+
complete: "#{@object_class} updating complete."
|
292
|
+
}
|
293
|
+
}
|
294
|
+
end
|
295
|
+
end
|
296
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'raw_sql_builder/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "raw_sql_builder"
|
8
|
+
spec.version = RawSqlBuilder::VERSION
|
9
|
+
spec.authors = ["Matias Tarantini"]
|
10
|
+
spec.email = ["MatTarantini@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = 'Creates Raw SQL mass creates and updates.'
|
13
|
+
spec.description = 'This gem is meant to speed up large creations or updates of objects.'
|
14
|
+
spec.homepage = 'https://github.com/MatTarantini/raw_sql_builder'
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
spec.required_ruby_version = '>= 2.0'
|
30
|
+
|
31
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
32
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
33
|
+
spec.add_development_dependency "minitest"
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: raw_sql_builder
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matias Tarantini
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: This gem is meant to speed up large creations or updates of objects.
|
56
|
+
email:
|
57
|
+
- MatTarantini@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".travis.yml"
|
64
|
+
- CODE_OF_CONDUCT.md
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bin/console
|
71
|
+
- bin/setup
|
72
|
+
- lib/raw_sql_builder.rb
|
73
|
+
- lib/raw_sql_builder/version.rb
|
74
|
+
- raw_sql_builder.gemspec
|
75
|
+
homepage: https://github.com/MatTarantini/raw_sql_builder
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata:
|
79
|
+
allowed_push_host: https://rubygems.org
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '2.0'
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
requirements: []
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 2.4.4
|
97
|
+
signing_key:
|
98
|
+
specification_version: 4
|
99
|
+
summary: Creates Raw SQL mass creates and updates.
|
100
|
+
test_files: []
|