rack-queries 0.2.0 → 0.2.1

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
  SHA256:
3
- metadata.gz: ff0ff5ff17f2b92777eed435babd21f179b2c180e6882f7bdb7dd8fba4affe0b
4
- data.tar.gz: 799525b05a406fd23603b9106aafb7049799e7cec3bc01092d06da3773fefef9
3
+ metadata.gz: 7278f7eac12f1013fe34eb2b1e84e75b7114d71d0f646c275a374c6615e56a82
4
+ data.tar.gz: a3c052ba9ced08c46d895b1197a63cfc65132df7e5f8ac6f64b5a16c3c0fa64b
5
5
  SHA512:
6
- metadata.gz: ea9c93d77699216d9fb9550b1de40cd06f8ebb82f3869f123c40129ab0828204e79d1b76dce254ccec7c9778f017b890ddf6ea714ec0a17aee087649e7f95e71
7
- data.tar.gz: a6b822fb674fc51723a43708c4cf9b2715003418919eb71d6661a4ba7fb7e18c2dcea20e20dae74069ee5ad377b24320285d97348099dc9670f5309e69edac32
6
+ metadata.gz: 36ef6a95c554444c3e7d18e2027da7050b3e58390b9a3a707461d17abbdbe480195f8594eb49c71d1c1ad8b5ce51d6f6f54911480a94acb0971227c12f26ad3e
7
+ data.tar.gz: 87bcb39c6ab1e19e1ff38342a42ddb0d48311d922bee2439de15ab9b95af5f58e1a90ad7472d97f4b85c2fd1cbabbd4e417c07f17d74e0059e2f250c19f198e0
data/.eslintignore CHANGED
@@ -1,2 +1,3 @@
1
1
  /coverage/
2
2
  /lib/rack/queries/static/
3
+ /vendor/bundle/
data/.travis.yml CHANGED
@@ -7,7 +7,7 @@ before_install:
7
7
  - gem install bundler
8
8
  install:
9
9
  - bundle install --jobs=3 --retry=3 --deployment
10
- - yarn install
10
+ - yarn install --ignore-engines
11
11
  script:
12
12
  - bundle exec rake
13
13
  - bundle exec rubocop
data/CHANGELOG.md CHANGED
@@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.2.1] - 2019-08-09
10
+
11
+ ### Changed
12
+
13
+ - [INTERNAL] Switch to using `@testing-library/react` for tests.
14
+ - Rebuild JavaScript dist with latest dependencies.
15
+
9
16
  ## [0.2.0] - 2019-05-17
10
17
 
11
18
  ### Added
@@ -41,7 +48,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
41
48
 
42
49
  - Initial release 🎉
43
50
 
44
- [unreleased]: https://github.com/CultureHQ/rack-queries/compare/v0.2.0...HEAD
51
+ [unreleased]: https://github.com/CultureHQ/rack-queries/compare/v0.2.1...HEAD
52
+ [0.2.1]: https://github.com/CultureHQ/rack-queries/compare/v0.2.0...v0.2.1
45
53
  [0.2.0]: https://github.com/CultureHQ/rack-queries/compare/v0.1.3...v0.2.0
46
54
  [0.1.3]: https://github.com/CultureHQ/rack-queries/compare/v0.1.2...v0.1.3
47
55
  [0.1.2]: https://github.com/CultureHQ/rack-queries/compare/v0.1.1...v0.1.2
@@ -0,0 +1,76 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ - Using welcoming and inclusive language
18
+ - Being respectful of differing viewpoints and experiences
19
+ - Gracefully accepting constructive criticism
20
+ - Focusing on what is best for the community
21
+ - Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ - The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ - Trolling, insulting/derogatory comments, and personal or political attacks
28
+ - Public or private harassment
29
+ - Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ - Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at support@culturehq.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
74
+
75
+ For answers to common questions about this code of conduct, see
76
+ https://www.contributor-covenant.org/faq
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rack-queries (0.2.0)
4
+ rack-queries (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  ast (2.4.0)
10
- docile (1.3.1)
11
- jaro_winkler (1.5.2)
10
+ docile (1.3.2)
11
+ jaro_winkler (1.5.3)
12
12
  json (2.2.0)
13
13
  minitest (5.11.3)
14
14
  parallel (1.17.0)
@@ -18,18 +18,18 @@ GEM
18
18
  rack-test (1.1.0)
19
19
  rack (>= 1.0, < 3)
20
20
  rainbow (3.0.0)
21
- rake (12.3.2)
22
- rubocop (0.69.0)
21
+ rake (12.3.3)
22
+ rubocop (0.74.0)
23
23
  jaro_winkler (~> 1.5.1)
24
24
  parallel (~> 1.10)
25
25
  parser (>= 2.6)
26
26
  rainbow (>= 2.2.2, < 4.0)
27
27
  ruby-progressbar (~> 1.7)
28
28
  unicode-display_width (>= 1.4.0, < 1.7)
29
- rubocop-performance (1.3.0)
30
- rubocop (>= 0.68.0)
31
- ruby-progressbar (1.10.0)
32
- simplecov (0.16.1)
29
+ rubocop-performance (1.4.1)
30
+ rubocop (>= 0.71.0)
31
+ ruby-progressbar (1.10.1)
32
+ simplecov (0.17.0)
33
33
  docile (~> 1.1)
34
34
  json (>= 1.8, < 3)
35
35
  simplecov-html (~> 0.10.0)
@@ -47,7 +47,7 @@ DEPENDENCIES
47
47
  rack-queries!
48
48
  rack-test (~> 1.1)
49
49
  rake (~> 12.0)
50
- rubocop (~> 0.69)
50
+ rubocop (~> 0.72)
51
51
  rubocop-performance (~> 1.3)
52
52
  simplecov (~> 0.16)
53
53
  sqlite3 (~> 1.4)
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019 Kevin Deisz
3
+ Copyright (c) 2019-present CultureHQ
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Rack::Queries
2
2
 
3
+ [![Build Status](https://travis-ci.com/CultureHQ/rack-queries.svg?branch=master)](https://travis-ci.com/CultureHQ/rack-queries)
3
4
  [![Gem Version](https://img.shields.io/gem/v/rack-queries.svg)](https://github.com/CultureHQ/rack-queries)
4
5
 
5
6
  This gem provides a page in your rack-based (e.g., `Rails`, `Sinatra`) application that allows quick execution of pre-built queries. The goal is to allow quick insights into the state of your application without needing to update the main UI. Consider it a backdoor admin page that you can use before you decide to truly expose query results.
data/bin/example CHANGED
@@ -66,73 +66,64 @@ class Database
66
66
  end
67
67
  end
68
68
 
69
- module Queries
70
- class OrgCountQuery
71
- def self.name
72
- 'Organization count'
73
- end
69
+ module Rack
70
+ module Queries
71
+ create do
72
+ name 'Organization count'
73
+ desc 'The total count of organizations'
74
74
 
75
- def self.desc
76
- 'The total count of organizations in the system'
75
+ run { |_opts| Database.value_from('SELECT COUNT(*) FROM orgs') }
77
76
  end
78
77
 
79
- def run(_opts)
80
- Database.value_from('SELECT COUNT(*) FROM orgs')
81
- end
82
- end
78
+ create do
79
+ name 'User count'
80
+ desc 'The total count of users'
83
81
 
84
- class OrgUsersCountQuery
85
- def org_name
86
- Database.values_from('SELECT name FROM orgs')
82
+ run { |_opts| Database.value_from('SELECT COUNT(*) FROM users') }
87
83
  end
88
84
 
89
- def run(opts)
90
- query = <<~SQL
91
- SELECT COUNT(*) FROM users
92
- WHERE org_id = (SELECT id FROM orgs WHERE name = :org_name)
93
- SQL
85
+ create do
86
+ name 'Users'
87
+ desc 'The list of all users'
94
88
 
95
- Database.value_from(query, opts)
89
+ run do |_opts|
90
+ [%w[id org_id active name]] +
91
+ Database.rows_from('SELECT id, org_id, active, name FROM users')
92
+ end
96
93
  end
97
- end
98
94
 
99
- class OrgActiveUsersCountQuery
100
- def org_name
101
- Database.values_from('SELECT name FROM orgs')
102
- end
95
+ create do
96
+ name 'Users in organizations count'
97
+ desc 'The total count of users in a given organization'
103
98
 
104
- def run(opts)
105
- query = <<~SQL
106
- SELECT COUNT(*) FROM users
107
- WHERE org_id = (SELECT id FROM orgs WHERE name = :org_name)
108
- AND active = 1
109
- SQL
99
+ opt(:org_name) { Database.values_from('SELECT name FROM orgs') }
110
100
 
111
- Database.value_from(query, opts)
112
- end
113
- end
101
+ run do |opts|
102
+ query = <<~SQL
103
+ SELECT COUNT(*) FROM users
104
+ WHERE org_id = (SELECT id FROM orgs WHERE name = :org_name)
105
+ SQL
114
106
 
115
- class UserCountQuery
116
- def run(_opts)
117
- Database.value_from('SELECT COUNT(*) FROM users')
107
+ Database.value_from(query, opts)
108
+ end
118
109
  end
119
- end
120
- end
121
110
 
122
- Rack::Queries.add(
123
- Queries::OrgCountQuery,
124
- Queries::OrgUsersCountQuery,
125
- Queries::OrgActiveUsersCountQuery,
126
- Queries::UserCountQuery
127
- )
111
+ create do
112
+ name 'Active users in organizations count'
113
+ desc 'The total count of active users in a given organization'
128
114
 
129
- Rack::Queries.create do
130
- name 'UsersQuery'
131
- desc 'The list of all users'
115
+ opt(:org_name) { Database.values_from('SELECT name FROM orgs') }
132
116
 
133
- run do |_opts|
134
- [%w[id org_id active name]] +
135
- Database.rows_from('SELECT id, org_id, active, name FROM users')
117
+ run do |opts|
118
+ query = <<~SQL
119
+ SELECT COUNT(*) FROM users
120
+ WHERE org_id = (SELECT id FROM orgs WHERE name = :org_name)
121
+ AND active = 1
122
+ SQL
123
+
124
+ Database.value_from(query, opts)
125
+ end
126
+ end
136
127
  end
137
128
  end
138
129
 
data/docs/screenshot.png CHANGED
Binary file