schema-evolution-manager 0.9.51 → 0.9.53

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: 5607ce9ddb40b0da1972de8ddc6352fd52d0ddecfcf4e12a22eaf8c5df2b9cb2
4
- data.tar.gz: 4fc5721b5020371c23f6fa98bb0659660e95d602d9c90ceaf8deb03f7356a95b
3
+ metadata.gz: 0d5bef9063ede01772251882e1ff8652bda678ec8401a3344e706f303b48c420
4
+ data.tar.gz: 0ad47d946818ce331acc713730a8e456a7a8948823d8e40cc2b7e55936bc9e6c
5
5
  SHA512:
6
- metadata.gz: e8f3328ba25b7d215d84594d54286f899a16066dfdfcac74ffca6a022f8296e1cd1f1ce299080c4cd351b0634a6434f670a5eac282eb374454a8505450267614
7
- data.tar.gz: 25a09aa167990b08a2fa62b2f8ec1113880fc9a9a600c378f0f89321767ec90b09b22596661f27443eb08415e79b52ee33169b28e834842298fe3fc8136a06e2
6
+ metadata.gz: 707c14f6b932b1c7e02da6b40ae385d12006355afedbbe275213b8eea8092b7d01187ab046d38578c5719d2fa39ac2f78fcf83677cee324b66f655ea41dde389
7
+ data.tar.gz: 83f0713085aa02e47f80136da6b61ad8679af7a36650d36d40236e77a0d6b4946f1767c23f716552b08db9d1d5e1f3ee062d1a32a905b20c09c0eee539f2a7ef
data/README.md CHANGED
@@ -133,7 +133,7 @@ There are three ways to install schema evolution manager:
133
133
 
134
134
  git clone git@github.com:mbryzek/schema-evolution-manager.git
135
135
  cd schema-evolution-manager
136
- git checkout 0.9.51
136
+ git checkout 0.9.53
137
137
  ruby ./configure.rb
138
138
  sudo ./install.rb
139
139
 
data/bin/sem-apply CHANGED
@@ -15,7 +15,7 @@ require 'tempfile'
15
15
 
16
16
  load File.join(File.dirname(__FILE__), 'sem-config')
17
17
 
18
- args = SchemaEvolutionManager::Args.from_stdin(:optional => %w(url host port name user dry_run password set))
18
+ args = SchemaEvolutionManager::Args.from_stdin(:optional => %w(url host port name user dry_run non_interactive password set))
19
19
 
20
20
  password = if args.password
21
21
  SchemaEvolutionManager::Ask.for_password("Please enter your password: ")
@@ -24,11 +24,11 @@ password = if args.password
24
24
  end
25
25
 
26
26
  db = SchemaEvolutionManager::Db.from_args(args, :password => password)
27
- util = SchemaEvolutionManager::ApplyUtil.new(db, :dry_run => args.dry_run || false)
27
+ util = SchemaEvolutionManager::ApplyUtil.new(db, :dry_run => args.dry_run || false, :non_interactive => args.non_interactive || false)
28
28
 
29
29
  begin
30
30
  db.bootstrap!
31
-
31
+
32
32
  puts "Upgrading schema for #{db.url}"
33
33
  count = util.apply!("./scripts")
34
34
  if count == 0
@@ -8,6 +8,11 @@ module SchemaEvolutionManager
8
8
  @dry_run = true
9
9
  end
10
10
 
11
+ @non_interactive = opts.delete(:non_interactive)
12
+ if @non_interactive.nil?
13
+ @non_interactive = false
14
+ end
15
+
11
16
  @db = Preconditions.assert_class(db, Db)
12
17
  @scripts = Scripts.new(@db, Scripts::SCRIPTS)
13
18
  end
@@ -16,14 +21,32 @@ module SchemaEvolutionManager
16
21
  @dry_run
17
22
  end
18
23
 
24
+ def non_interactive?
25
+ @non_interactive
26
+ end
27
+
19
28
  # Applies scripts in order, returning number of scripts applied
20
29
  def apply!(dir)
21
30
  Preconditions.check_state(File.directory?(dir),
22
31
  "Dir[%s] does not exist" % dir)
23
32
 
24
- count = 0
33
+ pending_scripts = []
25
34
  @scripts.each_pending(dir) do |filename, path|
26
- count += 1
35
+ pending_scripts << [filename, path]
36
+ end
37
+
38
+ if pending_scripts.size > 1 && !dry_run? && !non_interactive?
39
+ puts "Please confirm that you would like to apply all (#{pending_scripts.size}) of the pending scripts:"
40
+ pending_scripts.each do |filename, path|
41
+ puts " #{filename}"
42
+ end
43
+ continue = SchemaEvolutionManager::Ask.for_boolean("Continue?")
44
+ if !continue
45
+ return 0
46
+ end
47
+ end
48
+
49
+ pending_scripts.each do |filename, path|
27
50
  if @dry_run
28
51
  puts "[DRY RUN] Applying #{filename}"
29
52
  puts path
@@ -35,9 +58,8 @@ module SchemaEvolutionManager
35
58
  puts " Done"
36
59
  end
37
60
  end
38
- count
61
+ pending_scripts.size
39
62
  end
40
63
 
41
64
  end
42
-
43
65
  end
@@ -24,12 +24,13 @@ module SchemaEvolutionManager
24
24
  FLAGS_NO_ARGUMENTS = {
25
25
  :password => "Prompt user to enter password for the database user. Password is stored for the duration of the process",
26
26
  :dry_run => "Include flag to echo commands that will run without actually executing them",
27
+ :non_interactive => "Avoid all prompts and use defaults for any option that requires user input",
27
28
  :help => "Display help",
28
29
  :verbose => "Enable verbose logging of all system calls",
29
30
  }
30
31
  end
31
32
 
32
- attr_reader :artifact_name, :host, :port, :name, :prefix, :url, :user, :dir, :dry_run, :tag, :password, :set
33
+ attr_reader :artifact_name, :host, :port, :name, :prefix, :url, :user, :dir, :dry_run, :non_interactive, :tag, :password, :set
33
34
 
34
35
  # args: Actual string arguments
35
36
  # :required => list of parameters that are required
@@ -66,6 +67,7 @@ module SchemaEvolutionManager
66
67
  @set = found_arguments.delete(:set) || []
67
68
 
68
69
  @dry_run = found_arguments.delete(:dry_run)
70
+ @non_interactive = found_arguments.delete(:non_interactive)
69
71
  @password = found_arguments.delete(:password)
70
72
  @help = found_arguments.delete(:help)
71
73
  @verbose = found_arguments.delete(:verbose)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema-evolution-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.51
4
+ version: 0.9.53
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bryzek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-09 00:00:00.000000000 Z
11
+ date: 2024-07-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: '["Michael Bryzek"]'
14
14
  email: mbryzek@alum.mit.edu