bartask 0.1.0 → 0.1.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: 46e1cce930119b586806da631fc6d3e818ab8ed4b238f9560aad332471799231
4
- data.tar.gz: 8b4cbe91dd8454c1d5feb44077078bd4be43ee408291ae1e34d6d2021d1167dd
3
+ metadata.gz: 5a28ec79acd35a6b336145c815cfe1db335b77a39d9e129f4651d304a7e3821b
4
+ data.tar.gz: 639e410f31d96ac1ff959276adcb7a83d7bf70737afdb9f361a52dab87e03e82
5
5
  SHA512:
6
- metadata.gz: 8432407cd0719a035f6d074d4e6203da54438080a82033dae43de8d4955fc54e418d94f900671979dd7f8b25306455332a26fa553a7f3c2291078ca6a6a31b9b
7
- data.tar.gz: 4ad33a81804d421d0c6aa0baf29aca6cc24b67918195b93c8813e8aa5678a1aa23be6b2a1a915a6c825467691dc2f3a9342128a6ecb50bade793d8b7c99d0cb8
6
+ metadata.gz: fb3ef91962d923d340416a975f022c4fb996b48517711d9932e53577aa47eef8addfc4b51582910207681b383d8872536e782cadf154c96b13d0aed1e99d2f63
7
+ data.tar.gz: deed1e19a2eaa91dd6cf3c8e666c255488ec51597a81706689311ca887cdbd33323e3264989b4ff27b132132f1ec4bc599a2da84515bfcfc07c01f7d181cc4ce
data/Rakefile CHANGED
@@ -3,6 +3,8 @@
3
3
  require "bundler/gem_tasks"
4
4
  require "minitest/test_task"
5
5
 
6
- Minitest::TestTask.create
6
+ Minitest::TestTask.create do |t|
7
+ t.verbose = true
8
+ end
7
9
 
8
10
  task default: :test
data/lib/bartask/base.rb CHANGED
@@ -7,13 +7,16 @@ require "open3"
7
7
 
8
8
  module Bartask
9
9
  class Base
10
- def initialize(config_file_path: nil)
10
+ def initialize(config_file_path: nil, dump_file_path: nil)
11
11
  @config_file_path = config_file_path || Pathname.new("config/database.yml")
12
+ @specified_dump_file_path = dump_file_path
12
13
  parse_config_file
13
14
  end
14
15
 
15
16
  def dump_file_path
16
17
  @dump_file_path ||= begin
18
+ return @specified_dump_file_path unless @specified_dump_file_path.nil?
19
+
17
20
  suffix = branch_name.empty? ? "" : "_#{branch_name}"
18
21
  Pathname.new("tmp/#{@config["database"]}#{suffix}.dump")
19
22
  end
@@ -40,7 +43,7 @@ module Bartask
40
43
  def branch_name
41
44
  @branch_name ||= begin
42
45
  stdout, _, _ = Open3.capture3("git name-rev --name-only HEAD")
43
- stdout.strip
46
+ stdout.strip.gsub("/", "_")
44
47
  end
45
48
  end
46
49
 
data/lib/bartask/cli.rb CHANGED
@@ -7,9 +7,9 @@ class Bartask::Cli
7
7
  options = cli.parse
8
8
 
9
9
  if options[:mode] == "r"
10
- Bartask::Restorer.new(config_file_path: options[:config]).execute
10
+ Bartask::Restorer.new(config_file_path: options[:config], dump_file_path: options[:dump]).execute
11
11
  else
12
- Bartask::Dumper.new(config_file_path: options[:config]).execute
12
+ Bartask::Dumper.new(config_file_path: options[:config], dump_file_path: options[:dump]).execute
13
13
  end
14
14
  end
15
15
  end
@@ -44,7 +44,7 @@ class Bartask::Cli
44
44
 
45
45
  def global_command
46
46
  @global_command ||= OptionParser.new do |opts|
47
- opts.banner = "Usage: #{CMD} [options] [subcommand [options]]"
47
+ opts.banner = "Usage: #{CMD} [subcommand] [options]"
48
48
  opts.separator ""
49
49
  opts.separator USAGE
50
50
  end
@@ -58,6 +58,10 @@ class Bartask::Cli
58
58
  opts.on("-C", "--config PATH", "Config file path") do |v|
59
59
  @options[:config] = v
60
60
  end
61
+
62
+ opts.on("-D", "--dump PATH", "Dump file path") do |v|
63
+ @options[:dump] = v
64
+ end
61
65
  end,
62
66
  'r' => OptionParser.new do |opts|
63
67
  opts.banner = "Usage: #{CMD} r [options]"
@@ -65,6 +69,10 @@ class Bartask::Cli
65
69
  opts.on("-C", "--config PATH", "Config file path") do |v|
66
70
  @options[:config] = v
67
71
  end
72
+
73
+ opts.on("-D", "--dump PATH", "Dump file path") do |v|
74
+ @options[:dump] = v
75
+ end
68
76
  end
69
77
  }
70
78
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bartask
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bartask
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Yaginuma
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-11 00:00:00.000000000 Z
11
+ date: 2024-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport