schema-evolution-manager 0.9.45 → 0.9.47

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: f9aa2e5f4ca0f466a5af46ed97fca2186cdd699ac4e0c5cf05b2e9572aee0583
4
- data.tar.gz: 452714b924c36169ddc725fe75ba1315153a27564adce616afb04f8aa5920649
3
+ metadata.gz: ed6b170d492bc54dae6e23bec8915bc63ee60cf623cc58d7fe501513e5ac51cb
4
+ data.tar.gz: d8cc588c9fdbf909b7f74d0caf5733f2e19fb42904ed5162e884fdca07e520a4
5
5
  SHA512:
6
- metadata.gz: a3b69b1dad0e1128683d5c6d880766f766681c9db47aff820f4d798d25d4a278fc01e7e3138f8ae75c0a53501c0ef47c48479614a41187762778eb70e44ed2c8
7
- data.tar.gz: 1279727ee5dcc9a99059870cc29ed278e62dd881d544a6a7ac34c9631e882eaea43da06a91de0c90f063ea5ee37dc06cf580dfc429454b6c5d737707eb03781e
6
+ metadata.gz: c49a71d7e017ba6a8a2b16dc817e7e02df007e2f715a102daf9d291beb9085145d5ec2fd9da1f769c169df7aef8bdec968d7bda3ce597bf61ec2f9efdac6a4af
7
+ data.tar.gz: 0b7fafcd88dab54fbdfab0bed71763c5c2cfc206514f78bbf25e73cc687f6882282b102729958b90b0775ebce993d2fb0a95c80d78545af606d8b7ab299b10b9
data/README.md CHANGED
@@ -123,17 +123,21 @@ First presented at [PGDay NYC 2013](https://speakerdeck.com/mbryzek/schema-evolu
123
123
 
124
124
  ## Installation
125
125
 
126
- There are two ways to install schema evolution manager:
126
+ There are three ways to install schema evolution manager:
127
+
128
+ 1. Via brew
129
+
130
+ brew install schema-evolution-manager
127
131
 
128
132
  1. Direct install using ruby (no dependency on ruby gems)
129
133
 
130
- git clone git://github.com/mbryzek/schema-evolution-manager.git
134
+ git clone git@github.com:mbryzek/schema-evolution-manager.git
131
135
  cd schema-evolution-manager
132
- git checkout 0.9.45
136
+ git checkout 0.9.47
133
137
  ruby ./configure.rb
134
138
  sudo ./install.rb
135
139
 
136
- 2. If you have ruby gems:
140
+ 1. If you have ruby gems:
137
141
 
138
142
  gem install schema-evolution-manager
139
143
 
data/bin/sem-add CHANGED
@@ -16,7 +16,7 @@ if file.to_s.strip == ""
16
16
  SchemaEvolutionManager::RdocUsage.printAndExit(1)
17
17
  end
18
18
 
19
- SchemaEvolutionManager::Preconditions.check_state(File.exists?(file), "File[#{file}] could not be found")
19
+ SchemaEvolutionManager::Preconditions.check_state(File.exist?(file), "File[#{file}] could not be found")
20
20
  SchemaEvolutionManager::Preconditions.check_state(file.match(/\.sql/i), "File[#{file}] must end with .sql")
21
21
 
22
22
  scripts_dir = File.join(`pwd`.strip, "scripts")
@@ -26,7 +26,7 @@ contents = IO.read(file)
26
26
  now = Time.now.utc.strftime('%Y%m%d-%H%M%S')
27
27
  target = File.join(scripts_dir, "#{now}.sql")
28
28
 
29
- while File.exists?(target)
29
+ while File.exist?(target)
30
30
  sleep 0.1
31
31
  now = Time.now.utc.strftime('%Y%m%d-%H%M%S')
32
32
  target = File.join(scripts_dir, "#{now}.sql")
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))
18
+ args = SchemaEvolutionManager::Args.from_stdin(:optional => %w(url host port name user dry_run password set))
19
19
 
20
20
  password = if args.password
21
21
  SchemaEvolutionManager::Ask.for_password("Please enter your password: ")
data/bin/sem-dist CHANGED
@@ -80,7 +80,7 @@ SchemaEvolutionManager::Library.with_temp_file do |tmp|
80
80
  end
81
81
 
82
82
  gzip_file = "#{tarball}.gz"
83
- if File.exists?(gzip_file)
83
+ if File.exist?(gzip_file)
84
84
  puts "Removing old gzip file at #{gzip_file}"
85
85
  FileUtils.rm(gzip_file)
86
86
  end
data/bin/sem-init CHANGED
@@ -54,7 +54,7 @@ Dir.chdir(args.dir) do
54
54
  wrappers = []
55
55
  Dir.glob("#{template_dir}/*").each do |path|
56
56
  wrapper = File.basename(path)
57
- if !File.exists?(wrapper)
57
+ if !File.exist?(wrapper)
58
58
  puts "Creating wrapper script #{wrapper}"
59
59
  copy_file(path, wrapper, subs)
60
60
  SchemaEvolutionManager::Library.system_or_error("chmod +x #{wrapper}")
@@ -67,14 +67,14 @@ Dir.chdir(args.dir) do
67
67
  end
68
68
 
69
69
  readme = "README.md"
70
- if !File.exists?(readme)
70
+ if !File.exist?(readme)
71
71
  puts "Creating #{readme}"
72
72
  copy_file("schema-evolution-manager/template/README.md", "README.md", subs)
73
73
  SchemaEvolutionManager::Library.system_or_error("git add #{readme}")
74
74
  SchemaEvolutionManager::Library.system_or_error("git commit -m 'Adding README.md' README.md")
75
75
  end
76
76
 
77
- if !File.exists?("scripts")
77
+ if !File.exist?("scripts")
78
78
  SchemaEvolutionManager::Library.system_or_error("mkdir scripts")
79
79
  SchemaEvolutionManager::Library.system_or_error("touch scripts/.exists")
80
80
  SchemaEvolutionManager::Library.system_or_error("git add scripts/.exists")
@@ -5,7 +5,9 @@ module SchemaEvolutionManager
5
5
  # tests around it... so we have our own internal simple implementation.
6
6
  class Args
7
7
 
8
- if !defined?(FLAGS_WITH_ARGUMENTS)
8
+ if !defined?(ARRAY_FLAGS)
9
+ ARRAY_FLAGS = [:set]
10
+
9
11
  FLAGS_WITH_ARGUMENTS = {
10
12
  :artifact_name => "Specifies the name of the artifact. Tag will be appended to this name",
11
13
  :user => "Connect to the database as this username instead of the default",
@@ -16,7 +18,7 @@ module SchemaEvolutionManager
16
18
  :dir => "Path to a directory",
17
19
  :tag => "A git tag (e.g. 0.0.1)",
18
20
  :prefix => "Configure installer to use this prefix",
19
- :set => "Passthrough for postgresql --set argument"
21
+ :set => "Passthrough for postgresql --set argument. Returns an array of the options set"
20
22
  }
21
23
 
22
24
  FLAGS_NO_ARGUMENTS = {
@@ -61,7 +63,7 @@ module SchemaEvolutionManager
61
63
  @user = found_arguments.delete(:user)
62
64
  @dir = found_arguments.delete(:dir)
63
65
  @tag = found_arguments.delete(:tag)
64
- @set = found_arguments.delete(:set)
66
+ @set = found_arguments.delete(:set) || []
65
67
 
66
68
  @dry_run = found_arguments.delete(:dry_run)
67
69
  @password = found_arguments.delete(:password)
@@ -138,7 +140,12 @@ module SchemaEvolutionManager
138
140
  index += 1
139
141
 
140
142
  if FLAGS_WITH_ARGUMENTS.has_key?(flag)
141
- found[flag] = values[index]
143
+ if ARRAY_FLAGS.include?(flag)
144
+ found[flag] ||= []
145
+ found[flag] << values[index]
146
+ else
147
+ found[flag] = values[index]
148
+ end
142
149
  index += 1
143
150
 
144
151
  elsif FLAGS_NO_ARGUMENTS.has_key?(flag)
@@ -2,14 +2,16 @@ module SchemaEvolutionManager
2
2
 
3
3
  class Db
4
4
 
5
- attr_reader :url
5
+ attr_reader :url, :psql_executable_with_options
6
6
 
7
7
  def initialize(url, opts={})
8
8
  @url = Preconditions.check_not_blank(url, "url cannot be blank")
9
9
  password = opts.delete(:password)
10
10
 
11
- set = opts.delete(:set).to_s.strip
12
- @psql_executable_with_options = set.empty? ? "psql" : "psql --set='%s'" % set
11
+ @psql_executable_with_options = "psql"
12
+ (opts.delete(:set) || []).each do |arg|
13
+ @psql_executable_with_options << " --set #{arg}"
14
+ end
13
15
 
14
16
  Preconditions.assert_empty_opts(opts)
15
17
  connection_data = ConnectionData.parse_url(@url)
@@ -65,7 +67,7 @@ module SchemaEvolutionManager
65
67
  # executes sql commands from a file in a single transaction
66
68
  def psql_file(filename, path)
67
69
  Preconditions.assert_class(path, String)
68
- Preconditions.check_state(File.exists?(path), "File[%s] not found" % path)
70
+ Preconditions.check_state(File.exist?(path), "File[%s] not found" % path)
69
71
 
70
72
  options = Db.attribute_values(path).join(" ")
71
73
 
@@ -81,7 +83,7 @@ module SchemaEvolutionManager
81
83
  result = `#{command} > #{output} 2>&1`.strip
82
84
  status = $?
83
85
  if status.to_i > 0
84
- errors = File.exists?(output) ? IO.read(output) : result
86
+ errors = File.exist?(output) ? IO.read(output) : result
85
87
  raise ScriptError.new(self, filename, path, errors)
86
88
  end
87
89
  end
@@ -47,7 +47,7 @@ SchemaEvolutionManager::Library.ensure_dir!(version_dir)
47
47
  SchemaEvolutionManager::Library.ensure_dir!(bin_dir)
48
48
 
49
49
  Dir.chdir(lib_dir) do
50
- if File.exists?("schema-evolution-manager")
50
+ if File.exist?("schema-evolution-manager")
51
51
  if File.symlink?("schema-evolution-manager")
52
52
  SchemaEvolutionManager::Library.system_or_error("rm schema-evolution-manager")
53
53
  SchemaEvolutionManager::Library.system_or_error("ln -s %s %s" % [version_name, 'schema-evolution-manager'])
@@ -89,7 +89,7 @@ end
89
89
 
90
90
  # Overrwrite bin/sem-config with proper location of lib dir
91
91
  init_file = File.join(version_dir, "bin/sem-config")
92
- SchemaEvolutionManager::Preconditions.check_state(File.exists?(init_file), "Init file[%s] not found" % init_file)
92
+ SchemaEvolutionManager::Preconditions.check_state(File.exist?(init_file), "Init file[%s] not found" % init_file)
93
93
  File.open(init_file, "w") do |out|
94
94
  out << "load File.join('%s')\n" % File.join(version_dir, 'lib/schema-evolution-manager.rb')
95
95
  end
@@ -91,7 +91,7 @@ module SchemaEvolutionManager
91
91
  end
92
92
 
93
93
  def Library.delete_file_if_exists(path)
94
- if File.exists?(path)
94
+ if File.exist?(path)
95
95
  FileUtils.rm_r(path)
96
96
  end
97
97
  end
@@ -48,7 +48,7 @@ module SchemaEvolutionManager
48
48
 
49
49
  def initialize(path)
50
50
  @path = path
51
- Preconditions.check_state(File.exists?(@path), "File[#{@path}] does not exist")
51
+ Preconditions.check_state(File.exist?(@path), "File[#{@path}] does not exist")
52
52
  @attribute_values = parse_attribute_values
53
53
  end
54
54
 
@@ -60,7 +60,7 @@ module SchemaEvolutionManager
60
60
  # Reads the current version (from the VERSION FILE), returning an
61
61
  # instance of the Version class
62
62
  def Version.read
63
- Preconditions.check_state(File.exists?(VERSION_FILE), "Version file at path[%s] not found" % VERSION_FILE)
63
+ Preconditions.check_state(File.exist?(VERSION_FILE), "Version file at path[%s] not found" % VERSION_FILE)
64
64
  version = IO.read(VERSION_FILE).strip
65
65
  Version.parse(version)
66
66
  end
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.45
4
+ version: 0.9.47
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bryzek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-23 00:00:00.000000000 Z
11
+ date: 2023-01-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: '["Michael Bryzek"]'
14
14
  email: mbryzek@alum.mit.edu
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  - !ruby/object:Gem::Version
73
73
  version: '0'
74
74
  requirements: []
75
- rubygems_version: 3.0.3
75
+ rubygems_version: 3.0.3.1
76
76
  signing_key:
77
77
  specification_version: 4
78
78
  summary: Schema evolution manager is a simple schema migration tool for postgresql