shopapp 0.2.32 → 0.2.33

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 66455468ac8b97082eedbe9f50c450cb9e3019d229b7e1e9da232481b0cfc87b
4
- data.tar.gz: 35552b660f91d892c1fa3ad0d23de3888fe8d8b001badc8e49a33a6aea72174f
3
+ metadata.gz: 982aecb815386a153a6875d0092aa5a4dc121ca76231e08306fe00e1c1bef63e
4
+ data.tar.gz: '0569f7f627fc7cfe0a467a9d7ad3819da7ad005cd33d937196866d8c8e74ba61'
5
5
  SHA512:
6
- metadata.gz: 71d1c957bfe67238831d3676c7f1311b30e64a893762dacc32666fffbed752471765b1d7929737069196e953b333cdc6a6a77b922aec7d7670a7537c0ec30fa2
7
- data.tar.gz: cae7485e706e24e70035bc7dfea31f4d59f3e0ab6d3c3dea046d9330f8e71610fcf9048c62e81aa759cfcd0a7ef780810a3e2596c3b99862c953150fca6587ae
6
+ metadata.gz: 14fcb5a42a086ae9373b8b969ea7748ab3526d6c7f6707db3fcaddaf5e58f2f3dfa558f33e1b3db1ef227b1817dd4f99ffdab438c6757c127df043fab7a2d89a
7
+ data.tar.gz: feca3e9552f13e98deed5b8b9fd7fca2a3c53a0a5c43ce40d822ec0219359db786061dddb9be010c19d35d53677bd04b3cf454e9ac7ebfc33a19db3fc70a9fe7
data/bin/shop CHANGED
@@ -8,15 +8,13 @@ deployment_targets = `rake shopapp:targets`.strip
8
8
  commands = %w(console rake tail bash run pulldb fetchdb restoredb help)
9
9
  if ARGV.count == 2 && ARGV[0] == 'help' && (commands.include? ARGV[1])
10
10
  cmd = "rake shopapp:help cmd=#{ARGV[1]}"
11
- elsif ARGV.count <= 1 && ARGV[0] == 'restore'
12
- cmd = "rake shopapp:restore #{ARGV[1..-1].join ' '}"
13
11
  elsif ARGV.count < 2 ||
14
12
  !(deployment_targets.split(', ').include? ARGV[0]) ||
15
13
  !(commands.include? ARGV[1])
16
14
  puts "Usage: shop [TARGET] COMMAND [parameters]"
17
15
  puts "Targets: #{deployment_targets}."
18
16
  puts "Commands: #{commands.join ', '}."
19
- puts "No target for restore and help, mandatory for all others."
17
+ puts "No target for help, mandatory for all others."
20
18
  puts "For more info on specific command: shop help COMMAND."
21
19
  return
22
20
  else
@@ -29,10 +29,14 @@ namespace :shopapp do
29
29
  def restoredb(timestamp)
30
30
  db_name = deployment_settings['dbname'] || Rails.configuration.database_configuration['production']['database']
31
31
  dump_filename = "#{db_name}_#{timestamp}.dump"
32
+ restoredb_from_file(dump_filepath)
33
+ end
34
+
35
+ def restoredb_from_file(dump_filepath)
32
36
  dev_db_name = Rails.configuration.database_configuration['development']['database']
33
37
  puts "Restoring to local development database..."
34
- system "pg_restore --no-owner --verbose -c --no-acl -n public --dbname #{dev_db_name} #{Rails.root.join('tmp', dump_filename)}"
35
- puts 'Restored production database to local development.'
38
+ system "pg_restore --no-owner --verbose -c --no-acl -n public --dbname #{dev_db_name} #{Rails.root.join('tmp', dump_filepath)}"
39
+ puts 'Restored the database to local development.'
36
40
  end
37
41
 
38
42
  desc 'list existing targets'
@@ -114,4 +118,15 @@ namespace :shopapp do
114
118
  "There is no command #{ENV['cmd']}"
115
119
  end
116
120
  end
121
+
122
+ task restoredb: :environment do
123
+ db_basename = Rails.configuration.database_configuration[ENV['target']]['database']
124
+ dump_filepath ||= if ENV['timestamp']
125
+ Rails.root.join "tmp/#{db_basename}_#{ENV['timestamp']}.dump"
126
+ else
127
+ ENV['filepath'] ||
128
+ Dir[Rails.root.join("tmp/#{db_basename}_*.dump")].sort.last
129
+ end
130
+ restoredb_from_file(dump_filepath)
131
+ end
117
132
  end
data/shopapp.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'shopapp'
3
- s.version = '0.2.32'
4
- s.date = '2019-03-24'
3
+ s.version = '0.2.33'
4
+ s.date = '2019-03-29'
5
5
  s.summary = 'Do a shoplift.'
6
6
  s.description = 'Ha! Art thou Bedlam? Dost thou thirst base Trojan, to have me fold up Parca\'s fatal web? Hence!\
7
7
  I am qualmish at the smell of leek.'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.32
4
+ version: 0.2.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zeljko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-24 00:00:00.000000000 Z
11
+ date: 2019-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -304,8 +304,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
304
304
  - !ruby/object:Gem::Version
305
305
  version: '0'
306
306
  requirements: []
307
- rubyforge_project:
308
- rubygems_version: 2.7.8
307
+ rubygems_version: 3.0.3
309
308
  signing_key:
310
309
  specification_version: 4
311
310
  summary: Do a shoplift.