organo 0.4.3 → 0.4.4
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 +4 -4
- data/lib/organo/commands/dump.rb +30 -0
- data/lib/organo/version.rb +1 -1
- data/lib/organo.rb +4 -0
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8407453ab8286b3b42000a26b2b32fe2aa4dd88958b8aa233fa6fe3913833218
|
4
|
+
data.tar.gz: 7dcd6925be753407d8db55a6df822c8482374aefd55dfec953d41ad1ff73de33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed341b506fedd1e2e537bbcc990b2d9e62d92c57dfde1d3efc9396d1c1610a1b0141b08aba33f332f96cb0d0a5bc05a67ef41fdeada2267da99e789455230f4f
|
7
|
+
data.tar.gz: 04edcf3916ccbac568857b46d7893ba72a94347c7f58b3fddca90c17cdbd4f638983d48d869f7e1f284fca203e9a4fa93911761427dcb00d876b096a900efa56
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'os'
|
4
|
+
|
5
|
+
module Organo
|
6
|
+
module CLI
|
7
|
+
module Commands
|
8
|
+
|
9
|
+
class Dump < Dry::CLI::Command
|
10
|
+
desc 'Dump databse to SQL file'
|
11
|
+
|
12
|
+
def call(*)
|
13
|
+
executable = 'sqlite3'
|
14
|
+
can_run = false
|
15
|
+
win_filepath = "#{File.expand_path('~')}/sqlite-tools/sqlite3.exe"
|
16
|
+
if OS.windows? && File.exist?(win_filepath)
|
17
|
+
executable = win_filepath
|
18
|
+
can_run = true
|
19
|
+
elsif OS.linux? && system("which #{executable}")
|
20
|
+
can_run = true
|
21
|
+
end
|
22
|
+
output = 'Unable to run the command.'
|
23
|
+
output = `#{executable} #{Config::DATABASE_FILE} .dump > organo_dump.sql` if can_run
|
24
|
+
puts output unless output.empty?
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/organo/version.rb
CHANGED
data/lib/organo.rb
CHANGED
@@ -21,6 +21,7 @@ require_relative 'organo/commands/remote/remote_upload'
|
|
21
21
|
require_relative 'organo/commands/api/api_get_anime'
|
22
22
|
require_relative 'organo/commands/api/api_get_season'
|
23
23
|
require_relative 'organo/commands/api/api_get_sequels'
|
24
|
+
require_relative 'organo/commands/dump'
|
24
25
|
|
25
26
|
module Organo
|
26
27
|
module CLI
|
@@ -54,6 +55,9 @@ module Organo
|
|
54
55
|
register 'api get anime', Organo::CLI::Commands::API::Get::Anime
|
55
56
|
register 'api get season', Organo::CLI::Commands::API::Get::Season
|
56
57
|
register 'api get sequels', Organo::CLI::Commands::API::Get::Sequels
|
58
|
+
|
59
|
+
# SQL dump
|
60
|
+
register 'dump', Organo::CLI::Commands::Dump
|
57
61
|
end
|
58
62
|
end
|
59
63
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: organo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Louis-Philippe Fortin
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.21'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: os
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.1'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rest-client
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,6 +137,7 @@ files:
|
|
123
137
|
- lib/organo/commands/api/api_get_anime.rb
|
124
138
|
- lib/organo/commands/api/api_get_season.rb
|
125
139
|
- lib/organo/commands/api/api_get_sequels.rb
|
140
|
+
- lib/organo/commands/dump.rb
|
126
141
|
- lib/organo/commands/init.rb
|
127
142
|
- lib/organo/commands/remote/remote_add.rb
|
128
143
|
- lib/organo/commands/remote/remote_download.rb
|