nando 1.0.6 → 1.1.0

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: 1a7fb83451086e0dd1f86308a72f5f2156c3fe10e85fbe1c5abbb735c362c5b1
4
- data.tar.gz: ab3617f4c8ad02bd97e8ecaf77349a15f4d1469186106376205dc99784bab854
3
+ metadata.gz: 8477a6de523a18f91ef35775eab752ddf4bd2b0f0c13ee6f6e220b0316c11b27
4
+ data.tar.gz: 164fca0acb142b42a6ef79aec42eff52ec5ca4635911220d0ec9904fc0ab6dd9
5
5
  SHA512:
6
- metadata.gz: b1f84e39ad1088ff45137d16f99a1fe1e8d4bc3cdd9dee6d29c33279bbd728c43de0b3d867363e28353453f2165f1f951f1c259eb8e141ca43e940e86415268e
7
- data.tar.gz: 7a7c76b37c87052bf49aa0e3050b60b803e0ba4fb160200345d66d0fed5111967a582335fdeaa9a5112d95a7f8eb0284e2ea352e9ae5c3d35c9fb87e02573fc6
6
+ metadata.gz: c83229e31db8cafdb09d7e7541932ac2732d274dad77ff44a61145bd9afb20262e6fc226958ac8dc16759952da704798dbc39ca2132a04f52962be195d8d5f53
7
+ data.tar.gz: 17de7f834a3a6d3f2663239f481ea05b71d80860d8158fe30a204b59568e28e856136543b654f6421e403b019e7ea18b711b4b3741f7e3d74c3023bd83f50cb7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nando (1.0.5)
4
+ nando (1.0.6)
5
5
  awesome_print (~> 1.8.0)
6
6
  colorize (~> 0.8.1)
7
7
  dotenv (~> 2.7.6)
data/exe/nando CHANGED
@@ -23,6 +23,10 @@ parser = OptionParser.new do |opt|
23
23
  end
24
24
  end
25
25
 
26
+ opt.on("-d", "--dry-run", "Pass value") do |bool|
27
+ options[:dry_run] = true
28
+ end
29
+
26
30
  opt.on("-h", "--help", "Show this message") do |value|
27
31
  NandoInterface.print_help_message()
28
32
  exit 0
@@ -35,7 +39,7 @@ begin
35
39
  action = ARGV.shift()
36
40
  case action
37
41
  when 'up'
38
- NandoMigrator.instance.migrate()
42
+ NandoMigrator.instance.migrate(options)
39
43
  when 'down'
40
44
  NandoMigrator.instance.rollback()
41
45
  when 'apply'
@@ -31,6 +31,7 @@ module NandoInterface
31
31
  flags = [
32
32
  ['-t/--type', 'Used to specify the migration type'],
33
33
  ['-f/--function', 'Used to specify which function files to add to a migration'],
34
+ ['-d/--dry-run', 'Used to prevent the tool from applying migrations and only provide info'],
34
35
  ['-h/--help', 'Shows the help message']
35
36
  ]
36
37
 
@@ -56,6 +56,7 @@ class NandoMigrator
56
56
  def migrate (options = {})
57
57
  _debug 'Migrating!'
58
58
 
59
+ migrations_to_apply = []
59
60
  migration_files = get_migration_files(@migration_dir)
60
61
 
61
62
  if migration_files.length == 0
@@ -73,7 +74,22 @@ class NandoMigrator
73
74
  next
74
75
  end
75
76
 
76
- execute_migration_method(:up, filename, migration_name, migration_version)
77
+ if options[:dry_run]
78
+ migrations_to_apply << {:migration_version => migration_version, :migration_name => migration_name}
79
+ else
80
+ execute_migration_method(:up, filename, migration_name, migration_version)
81
+ end
82
+ end
83
+
84
+ if options[:dry_run]
85
+ if migrations_to_apply.count > 0
86
+ puts "Migrations that would be applied:"
87
+ for migration in migrations_to_apply do
88
+ puts "=> #{migration[:migration_version]} - '#{migration[:migration_name]}'"
89
+ end
90
+ else
91
+ _warn 'No migration would be applied'
92
+ end
77
93
  end
78
94
 
79
95
  end
data/lib/nando/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Nando
2
- VERSION = "1.0.6"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nando
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernando Alves
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-30 00:00:00.000000000 Z
11
+ date: 2021-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler