rails-sqlite-extras 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -6
- data/lib/rails-sqlite-extras.rb +3 -1
- data/lib/rails_sqlite_extras/version.rb +1 -1
- data/rails-sqlite-extras.gemspec +2 -0
- data/spec/smoke_spec.rb +1 -1
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f04c61ed26fd15da758373a2a9d908d163c0f1fea6d0b23055702e2664ac105
|
4
|
+
data.tar.gz: 569f88ccbd101b9f7718c626dd73d161c4b99d2d7ab03c0e2ecd2cb868b50c09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4780d7e7f71864a711f4b5b041c8f27b8571f3c8790fc8fc6cd92b413c330cc868d6e2de94112d0b74d22512e2feda65a6e10157611c819b8364264a623479b5
|
7
|
+
data.tar.gz: 7caadfe00f71e9c6e3e5f1978b44f491659e1e30e587188f91641bf27c28760129359d49ee5181baeea154e1d40046f8ef7f2a9beacef1462b6058e0dec6433c
|
data/README.md
CHANGED
@@ -1,19 +1,27 @@
|
|
1
1
|
# Rails Sqlite Extras [![Gem Version](https://badge.fury.io/rb/rails-sqlite-extras.svg)](https://badge.fury.io/rb/rails-sqlite-extras) [![GH Actions](https://github.com/pawurb/rails-sqlite-extras/actions/workflows/ci.yml/badge.svg)](https://github.com/pawurb/rails-sqlite-extras/actions)
|
2
2
|
|
3
|
-
Copy/paste of [ecto_sqlite3_extras](https://github.com/orsinium-labs/ecto_sqlite3_extras). Helper queries available in Ruby and rake tasks providing insights into the Sqlite database.
|
3
|
+
Copy/paste of [ecto_sqlite3_extras](https://github.com/orsinium-labs/ecto_sqlite3_extras). Helper queries available in Ruby and Rails rake tasks providing insights into the Sqlite database.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
`Gemfile`
|
9
8
|
```bash
|
10
|
-
|
11
|
-
bundle config set build.sqlite3 "--with-sqlite-cflags='-DSQLITE_ENABLE_DBSTAT_VTAB=1'"
|
9
|
+
gem "rails-sqlite-extras"
|
12
10
|
```
|
13
11
|
|
12
|
+
Some queries use `dbstat` table. You have to use [sqlite3 gem](https://github.com/sparklemotion/sqlite3-ruby) with version `>= 2.3.0` because it has this feature enabled by default:
|
13
|
+
|
14
14
|
`Gemfile`
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem "sqlite3", "~> 2.3"
|
18
|
+
```
|
19
|
+
|
20
|
+
Alternatively, if you're stuck on lower version, you have to enable `dbstat` by setting a `SQLITE_ENABLE_DBSTAT_VTAB` compile flag:
|
21
|
+
|
15
22
|
```bash
|
16
|
-
|
23
|
+
bundle config set force_ruby_platform true
|
24
|
+
bundle config set build.sqlite3 "--with-sqlite-cflags='-DSQLITE_ENABLE_DBSTAT_VTAB=1'"
|
17
25
|
```
|
18
26
|
|
19
27
|
## Available queries
|
data/lib/rails-sqlite-extras.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "terminal-table"
|
4
|
+
|
3
5
|
module RailsSqliteExtras
|
4
6
|
@@database_url = nil
|
5
7
|
|
@@ -52,7 +54,7 @@ module RailsSqliteExtras
|
|
52
54
|
puts Terminal::Table.new(
|
53
55
|
title: title,
|
54
56
|
headings: headings,
|
55
|
-
rows: result.values,
|
57
|
+
rows: result.map(&:values),
|
56
58
|
)
|
57
59
|
else
|
58
60
|
raise "Invalid in_format option"
|
data/rails-sqlite-extras.gemspec
CHANGED
@@ -17,9 +17,11 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.license = "MIT"
|
18
18
|
s.add_dependency "rails"
|
19
19
|
s.add_dependency "sqlite3"
|
20
|
+
s.add_dependency "terminal-table"
|
20
21
|
s.add_development_dependency "rake"
|
21
22
|
s.add_development_dependency "rspec"
|
22
23
|
s.add_development_dependency "rufo"
|
24
|
+
s.add_development_dependency "dbg-rb"
|
23
25
|
|
24
26
|
if s.respond_to?(:metadata=)
|
25
27
|
s.metadata = { "rubygems_mfa_required" => "true" }
|
data/spec/smoke_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-sqlite-extras
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pawurb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: terminal-table
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +94,20 @@ dependencies:
|
|
80
94
|
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: dbg-rb
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
83
111
|
description: " Helper queries providing insights into the Sqlite database for Rails
|
84
112
|
apps. "
|
85
113
|
email:
|