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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60bfda0078d17b33a65c93c0ce7204328fd10e55cdb64d699c03a8b5a4ab8c81
4
- data.tar.gz: 5742128565877f12aa6b6b211179d79840d2b05a8858aaeda009113bd39634d5
3
+ metadata.gz: 8407453ab8286b3b42000a26b2b32fe2aa4dd88958b8aa233fa6fe3913833218
4
+ data.tar.gz: 7dcd6925be753407d8db55a6df822c8482374aefd55dfec953d41ad1ff73de33
5
5
  SHA512:
6
- metadata.gz: 97934394e6a32b27014db664f8f49dab8edab63b6bec65d38a49cc47bf5ad3c598c93d33aa50ce591d11677a7bfdb48b07d9c97e83cd1c773036e135bf6053eb
7
- data.tar.gz: 5a958e6cb4cc9db14f4fa612b395ed98959a6ccec21955d5aa0cd8b039e0dd62fe156ec87b9fb09ad93aa8e90f2d913dff76c9ddd2efd9efc84af237621e956e
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Organo
4
- VERSION = '0.4.3'
4
+ VERSION = '0.4.4'
5
5
  end
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.3
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