squirrell 0.1.0
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/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +3 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/Guardfile +42 -0
- data/LICENSE.txt +21 -0
- data/README.md +191 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/generators/sqrl/install/install_generator.rb +19 -0
- data/lib/generators/sqrl/install/templates/example_query.rb +35 -0
- data/lib/generators/sqrl/install/templates/squirrell_initializer.rb +5 -0
- data/lib/generators/sqrl/query/query_generator.rb +29 -0
- data/lib/generators/sqrl/query/templates/query_template.rb.erb +13 -0
- data/lib/squirrell.rb +78 -0
- data/lib/squirrell/version.rb +3 -0
- data/squirrell.gemspec +28 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3e8db40497e5ea5d4b0be64e4f118fc6acdd798f
|
4
|
+
data.tar.gz: 552b660a72a079f1ac2bf4b53cbb0639b472e8b0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: beb3ebe622552e184725616d5b607f14cccaac5101984a179eac6a6a47d1934df36e193fe28e74ca9044678c9137174046c4760eaa1e89946f00c1c21ff485cb
|
7
|
+
data.tar.gz: 9afb120cc06c7446187b982a9e81ea77a63822e158016bced2b37b326584bdc0b5227e2cf8f24de453d9ebad6c2d3caf296172a5d391edd50e68bfd1f6753898
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
squirrell
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.2.2
|
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, 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/Guardfile
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
directories %w(. lib spec)
|
6
|
+
.select { |d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist") }
|
7
|
+
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
+
#
|
12
|
+
# $ mkdir config
|
13
|
+
# $ mv Guardfile config/
|
14
|
+
# $ ln -s config/Guardfile .
|
15
|
+
#
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
+
|
18
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
19
|
+
# rspec may be run, below are examples of the most common uses.
|
20
|
+
# * bundler: 'bundle exec rspec'
|
21
|
+
# * bundler binstubs: 'bin/rspec'
|
22
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
23
|
+
# installed the spring binstubs per the docs)
|
24
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
25
|
+
# * 'just' rspec: 'rspec'
|
26
|
+
|
27
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
28
|
+
require 'guard/rspec/dsl'
|
29
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
30
|
+
|
31
|
+
# Feel free to open issues for suggestions and improvements
|
32
|
+
|
33
|
+
# RSpec files
|
34
|
+
rspec = dsl.rspec
|
35
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
36
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
37
|
+
watch(rspec.spec_files)
|
38
|
+
|
39
|
+
# Ruby files
|
40
|
+
ruby = dsl.ruby
|
41
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
42
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Matt Parsons
|
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,191 @@
|
|
1
|
+
# Squirrell
|
2
|
+
|
3
|
+
Squirrell is a completely non-magical library intended to make it easier to simplify your relationship with ActiveRecord.
|
4
|
+
ActiveRecord provides an immense amount of flexibility and power, and it's really easy to let this functionality become more-and-more intense.
|
5
|
+
Controllers doing arbitrary `where`s, other models doing a `find_by`, maybe even a hidden finder in the views somewhere.
|
6
|
+
This level of decoupling makes things difficult to test and obscures the lines in your application.
|
7
|
+
|
8
|
+
Squirrell makes it easy to create finders and query objects that respond very well to testing and are easy to mock.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'squirrell'
|
16
|
+
```
|
17
|
+
|
18
|
+
### Rails
|
19
|
+
|
20
|
+
Run the install generator to copy the initializer, add `app/queries` to Rails autoload, and provide an example query:
|
21
|
+
|
22
|
+
$ rails generate sqrl:install
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
### Configuring Squirrell
|
27
|
+
|
28
|
+
If you want to use any raw SQL or Arel querying, you'll need to provide Squirrell with an executor.
|
29
|
+
An executor responds to `:call`, accepts a single argument, and executes that argument as a SQL query.
|
30
|
+
It doesn't really have to execute a SQL query, though.
|
31
|
+
It just probably should.
|
32
|
+
|
33
|
+
To configure Squirrell, you can do a block:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
Squirrell.configure do |sqrrll|
|
37
|
+
sqrrll.executor = -> (sql) { ActiveRecord::Base.connection.execute(sql) }
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
### Using a Squirrell query class
|
42
|
+
|
43
|
+
Squirrell query classes have a very limited external interface.
|
44
|
+
They respond to `.find` and return the result of the query.
|
45
|
+
As a result, they're very easy to mock: `allow(ComplexQuery).to receive(:find).and_return(your_stubs)`
|
46
|
+
|
47
|
+
(hah hah, silly squirrell)
|
48
|
+
|
49
|
+
Examples:
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
UserFinder.find(id: 6)
|
53
|
+
WizardByElementAndPet.find(element: :ice, pet: :penguin)
|
54
|
+
HeroByName.find(name: "Finn")
|
55
|
+
```
|
56
|
+
|
57
|
+
### Defining a Squirrell
|
58
|
+
|
59
|
+
There are currently three queries supported by Squirrell: `#finder`, `#arel`, and `#raw_sql`.
|
60
|
+
|
61
|
+
Finders are the simplest.
|
62
|
+
They just return the result of the `#finder` method.
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
class UserFinder
|
66
|
+
include Squirrell
|
67
|
+
|
68
|
+
requires :id
|
69
|
+
|
70
|
+
def finder
|
71
|
+
User.find(@id)
|
72
|
+
end
|
73
|
+
|
74
|
+
def process(result)
|
75
|
+
result.map { |user| "Happy birthday, #{user.name}!" }
|
76
|
+
end
|
77
|
+
end
|
78
|
+
```
|
79
|
+
|
80
|
+
The `requires :id` line indicates what parameters must be passed to `find`.
|
81
|
+
An error will be raised if a required parameter is missing or if an extra parameter is passed.
|
82
|
+
The symbols in the hash are made into instance variables of the same name.
|
83
|
+
|
84
|
+
After the finding method gets called, `#process` gets called with the result of the query.
|
85
|
+
In the previous example, `result` would be an array, and it would convert the found users into a string wishing them a happy birthday.
|
86
|
+
The return value of `process` is ultimately what the return value of `UserFinder.find` will be.
|
87
|
+
|
88
|
+
Arel finders are meant to be used in conjunction with the Arel gem.
|
89
|
+
In truth, the only requirement is that the return value of the `#arel` method respond to `:to_sql`.
|
90
|
+
|
91
|
+
```ruby
|
92
|
+
class WizardByElementAndPet
|
93
|
+
include Squirrell
|
94
|
+
|
95
|
+
requires :element, :pet
|
96
|
+
|
97
|
+
def arel
|
98
|
+
wizards = Wizard.arel_table
|
99
|
+
wizards.where(wizards[:pet].eq(@pet))
|
100
|
+
.where(wizards[:element].eq(@element))
|
101
|
+
.project(wizards[:id])
|
102
|
+
end
|
103
|
+
end
|
104
|
+
```
|
105
|
+
|
106
|
+
Finally, Squirrell can do raw SQL.
|
107
|
+
Define `#raw_sql` on the Squirrell class and it'll use the executor.
|
108
|
+
The string returned by `raw_sql` is passed directly to the executor.
|
109
|
+
Currently, it doesn't do anything clever to escape it.
|
110
|
+
|
111
|
+
```ruby
|
112
|
+
class HeroByName
|
113
|
+
include Squirrell
|
114
|
+
|
115
|
+
requires :name
|
116
|
+
|
117
|
+
def raw_sql
|
118
|
+
"SELECT heroes.id FROM heroes WHERE heroes.name = '#{@name}'"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
```
|
122
|
+
|
123
|
+
Sometimes, you just want to return a bunch of models, and the finder has you totally covered.
|
124
|
+
Other times, the array-of-arrays or array-of-column-hashes are all you need.
|
125
|
+
When that isn't the case, Squirrell provides a `#process` hook that receives the result of the query and can do whatever it wants with it.
|
126
|
+
|
127
|
+
```ruby
|
128
|
+
class HeroByName
|
129
|
+
# ...
|
130
|
+
def process(result)
|
131
|
+
puts result
|
132
|
+
# => #<PG::Result:0x981723098 status=PGRES_TUPLES_OK etc....>
|
133
|
+
puts result.values
|
134
|
+
# => [["1"],["42"]]
|
135
|
+
Hero.find(result.values.flatten)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
HeroByName.find(name: "Finn")
|
140
|
+
# => [#<Hero:0x0987123 @name="Finn" @weapon="Grass Sword", etc...]
|
141
|
+
```
|
142
|
+
|
143
|
+
Squirrell allows you to define optional permitted parameters:
|
144
|
+
|
145
|
+
```ruby
|
146
|
+
def PermissionExample
|
147
|
+
include Squirrell
|
148
|
+
|
149
|
+
requires :user_id
|
150
|
+
permits :post_id
|
151
|
+
|
152
|
+
def raw_sql
|
153
|
+
<<SQL
|
154
|
+
SELECT *
|
155
|
+
FROM users
|
156
|
+
INNER JOIN posts ON users.id = posts.user_id
|
157
|
+
WHERE users.id = #{@user_id} #{has_post?}
|
158
|
+
SQL
|
159
|
+
end
|
160
|
+
|
161
|
+
def has_post?
|
162
|
+
@post_id ? "AND posts.id = #{@post_id}" : ""
|
163
|
+
end
|
164
|
+
end
|
165
|
+
```
|
166
|
+
|
167
|
+
Generally, this makes for more complex queries. If you're finding that you're customizing with a bunch of `permits`, you may want to make a new query object.
|
168
|
+
|
169
|
+
### Rails Generator
|
170
|
+
|
171
|
+
Squirrell has a generator for queries.
|
172
|
+
|
173
|
+
$ rails generate sqrl:query QueryName --type=raw_sql id name
|
174
|
+
|
175
|
+
* `QueryName` is the name of the query object.
|
176
|
+
* `--type=` can either be `raw_sql`, `finder`, or `arel`.
|
177
|
+
* The remaining elements are the required parameters for the query.
|
178
|
+
|
179
|
+
## Development
|
180
|
+
|
181
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
182
|
+
|
183
|
+
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` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
184
|
+
|
185
|
+
## Contributing
|
186
|
+
|
187
|
+
1. Fork it ( https://github.com/[my-github-username]/squirrell/fork )
|
188
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
189
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
190
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
191
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'squirrell'
|
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,19 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Sqrl
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < ::Rails::Generators::Base
|
6
|
+
source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
7
|
+
|
8
|
+
desc 'Creates Squirrell initializer'
|
9
|
+
def copy_initializer
|
10
|
+
template 'squirrell_initializer.rb', 'config/initializers/squirrell.rb'
|
11
|
+
end
|
12
|
+
|
13
|
+
desc 'Creates Example Query'
|
14
|
+
def example_query
|
15
|
+
template 'example_query.rb', 'app/queries/example_query.rb'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class ExampleQuery
|
2
|
+
include Squirrell
|
3
|
+
|
4
|
+
# Requires indicates the parameters necessary for the query.
|
5
|
+
# Called like: `ExampleQuery.find(id: 5, name: "alice", email: "cto@fancycorp.com")`
|
6
|
+
# The values will be made available to queries as instance variables of the
|
7
|
+
# same name.
|
8
|
+
requires :id, :name, :email
|
9
|
+
|
10
|
+
# process handles the result of the query before passing it to the caller.
|
11
|
+
# It's defined by default like this.
|
12
|
+
def process(result)
|
13
|
+
result
|
14
|
+
end
|
15
|
+
|
16
|
+
# `#finder` execute the code in the method and pass directly to `#process`.
|
17
|
+
# Great for ActiveRecord `find_by`, `where`, etc.
|
18
|
+
def finder
|
19
|
+
User.find_by(id: @id, name: @name, email: @email)
|
20
|
+
end
|
21
|
+
|
22
|
+
# `#arel` is where you might put Arel code. As long as the return value of
|
23
|
+
# the method responds to `to_sql`, you're good. The code will be converted to
|
24
|
+
# SQL, executed, and passed into process.
|
25
|
+
def arel
|
26
|
+
users = User.arel_table
|
27
|
+
users.where(users[:name].eq(@name))
|
28
|
+
.project(users[:email])
|
29
|
+
end
|
30
|
+
|
31
|
+
# `#raw_sql` is for raw sql code. It gets executed and passed to process.
|
32
|
+
def raw_sql
|
33
|
+
"SELECT * FROM users WHERE name = '#{@name}'"
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Sqrl
|
4
|
+
module Generators
|
5
|
+
class QueryGenerator < ::Rails::Generators::NamedBase
|
6
|
+
source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
7
|
+
|
8
|
+
class_option :type, type: :string, default: 'finder', desc: 'finder/raw_sql/arel'
|
9
|
+
argument :requires, type: :array, default: ['id'], desc: 'Required parameters'
|
10
|
+
|
11
|
+
desc 'Creates a query'
|
12
|
+
def create_query
|
13
|
+
path = "app/queries/#{file_name}.rb"
|
14
|
+
|
15
|
+
template 'query_template.rb.erb', path
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def require_syms
|
21
|
+
requires.map { |s| ":#{s}" } * ', '
|
22
|
+
end
|
23
|
+
|
24
|
+
def query_type
|
25
|
+
options[:type] || 'finder'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/squirrell.rb
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'squirrell/version'
|
2
|
+
|
3
|
+
module Squirrell
|
4
|
+
class << self
|
5
|
+
attr_accessor :requires
|
6
|
+
attr_accessor :permits
|
7
|
+
attr_reader :executor
|
8
|
+
|
9
|
+
def executor=(e)
|
10
|
+
unless e.respond_to? :call
|
11
|
+
fail ExecutorError, 'Executor must respond to `#call`'
|
12
|
+
end
|
13
|
+
@executor = e
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.configure
|
18
|
+
yield self
|
19
|
+
end
|
20
|
+
|
21
|
+
def raw_sql
|
22
|
+
sql = arel
|
23
|
+
fail InvalidArelError unless sql.respond_to? :to_sql
|
24
|
+
sql.to_sql
|
25
|
+
end
|
26
|
+
|
27
|
+
def process(results)
|
28
|
+
results
|
29
|
+
end
|
30
|
+
|
31
|
+
class ExecutorError < ArgumentError; end
|
32
|
+
class InvalidArelError < ArgumentError; end
|
33
|
+
|
34
|
+
def self.included(klass)
|
35
|
+
Squirrell.requires ||= {}
|
36
|
+
Squirrell.requires[klass] = []
|
37
|
+
Squirrell.permits ||= {}
|
38
|
+
Squirrell.permits[klass] = []
|
39
|
+
|
40
|
+
def klass.requires(*args)
|
41
|
+
Squirrell.requires[self] = args
|
42
|
+
end
|
43
|
+
|
44
|
+
def klass.permits(*args)
|
45
|
+
Squirrell.permits[self] = args
|
46
|
+
end
|
47
|
+
|
48
|
+
def initialize(args)
|
49
|
+
Squirrell.requires[self.class].each do |k|
|
50
|
+
unless args.keys.include? k
|
51
|
+
fail ArgumentError, "Missing required parameter: #{k}"
|
52
|
+
end
|
53
|
+
instance_variable_set "@#{k}", args.delete(k)
|
54
|
+
end
|
55
|
+
|
56
|
+
Squirrell.permits[self.class].each do |k|
|
57
|
+
instance_variable_set "@#{k}", args.delete(k) if args.keys.include? k
|
58
|
+
end
|
59
|
+
|
60
|
+
fail ArgumentError if args.any?
|
61
|
+
end
|
62
|
+
|
63
|
+
def klass.find(args = {})
|
64
|
+
do_query(new(args))
|
65
|
+
end
|
66
|
+
|
67
|
+
def klass.do_query(object)
|
68
|
+
result = nil
|
69
|
+
if object.respond_to? :finder
|
70
|
+
result = object.finder
|
71
|
+
else
|
72
|
+
sql = object.raw_sql
|
73
|
+
result = Squirrell.executor.call(sql)
|
74
|
+
end
|
75
|
+
object.process(result)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
data/squirrell.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'squirrell/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'squirrell'
|
8
|
+
spec.version = Squirrell::VERSION
|
9
|
+
spec.authors = ['Matt Parsons']
|
10
|
+
spec.email = ['parsonsmatt@gmail.com']
|
11
|
+
|
12
|
+
|
13
|
+
spec.summary = 'A kinda magical gem for query objects'
|
14
|
+
spec.homepage = 'https://www.github.com/parsonsmatt/squirrell'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = 'exe'
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.8'
|
23
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
24
|
+
spec.add_development_dependency 'guard', '~> 2.12'
|
25
|
+
spec.add_development_dependency 'rspec', '~> 3.3'
|
26
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.5'
|
27
|
+
spec.add_development_dependency 'rubocop'
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: squirrell
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matt Parsons
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-21 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.8'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.8'
|
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: guard
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.12'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.12'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard-rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '4.5'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '4.5'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description:
|
98
|
+
email:
|
99
|
+
- parsonsmatt@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".ruby-gemset"
|
107
|
+
- ".ruby-version"
|
108
|
+
- ".travis.yml"
|
109
|
+
- CODE_OF_CONDUCT.md
|
110
|
+
- Gemfile
|
111
|
+
- Guardfile
|
112
|
+
- LICENSE.txt
|
113
|
+
- README.md
|
114
|
+
- Rakefile
|
115
|
+
- bin/console
|
116
|
+
- bin/setup
|
117
|
+
- lib/generators/sqrl/install/install_generator.rb
|
118
|
+
- lib/generators/sqrl/install/templates/example_query.rb
|
119
|
+
- lib/generators/sqrl/install/templates/squirrell_initializer.rb
|
120
|
+
- lib/generators/sqrl/query/query_generator.rb
|
121
|
+
- lib/generators/sqrl/query/templates/query_template.rb.erb
|
122
|
+
- lib/squirrell.rb
|
123
|
+
- lib/squirrell/version.rb
|
124
|
+
- squirrell.gemspec
|
125
|
+
homepage: https://www.github.com/parsonsmatt/squirrell
|
126
|
+
licenses:
|
127
|
+
- MIT
|
128
|
+
metadata: {}
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 2.4.6
|
146
|
+
signing_key:
|
147
|
+
specification_version: 4
|
148
|
+
summary: A kinda magical gem for query objects
|
149
|
+
test_files: []
|