obs_deploy 0.2.0 → 0.2.2

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: a671e53bbfc49281a52dfc32edc85bf74dddb20fd45034a6f3118aa60cd7693e
4
- data.tar.gz: e8a2fa4883c4a2f182593c8c9b3bb2e4b02918047b6b5f3c6057520b963404c5
3
+ metadata.gz: 41cc050c5b998c658f9e490356baecffde0c4d20c8f9856cb3f9d9365e47ff2d
4
+ data.tar.gz: 9c4bf4468558287c91bcce67af42af569020d4414d9676fd535bbb6ea503f81d
5
5
  SHA512:
6
- metadata.gz: 580a4c94c6769d977de4c1b91f40cf86f355e31c26027761ea24ebc82c0ba2c14cfe2161c4c36fa7b8c385fd4464bceb0dc766cc42a5e2c1c4736b52983e9a2d
7
- data.tar.gz: 57dc7ee60f649e8a344d368d86d201001605a128319396319f833a170a3b0dbd545f96acf8e38279c33ea5b1bc77077aaf7c6ed139ecbedb024d5e2867a5c2aa
6
+ metadata.gz: 3935393353a5b72e06bccc8ae92c9dc53f1047fe20d8d7597c8ed80d081e4e1f17a6e816c9f61c5a1fd13c3b1293e51695e1aa2126a23c17d57957a3534124c3
7
+ data.tar.gz: acdfdcde737dd62fbdfde71225a4a71878118671f5a3b9c638090478c2ee8cea3cb0e56b35042caf009b8de4e682b169b8929a028dd9142666b28294e210b4cc
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- obs_deploy (0.2.0)
4
+ obs_deploy (0.2.2)
5
5
  cheetah
6
6
  dry-cli
7
7
  nokogiri
@@ -31,6 +31,12 @@ module ObsDeploy
31
31
  !!github_diff.match(%r{db/migrate})
32
32
  end
33
33
 
34
+ def migrations
35
+ return [] unless has_migration?
36
+
37
+ github_diff.match(%r{db/migrate/.*\.rb}).to_a
38
+ end
39
+
34
40
  def package_url
35
41
  URI("#{@server}/public/build/OBS:Server:Unstable/#{@product}/x86_64/obs-server")
36
42
  end
@@ -10,6 +10,7 @@ module ObsDeploy
10
10
  autoload :GetPackageVersion, File.join(__dir__, 'commands/get_package_version.rb')
11
11
  autoload :GetDeployedVersion, File.join(__dir__, 'commands/get_deployed_version.rb')
12
12
  autoload :Systemctl, File.join(__dir__, 'commands/systemctl.rb')
13
+ autoload :GetPendingMigration, File.join(__dir__, 'commands/get_pending_migration.rb')
13
14
 
14
15
  # register the commands and its command line
15
16
  register 'available-package', GetPackageVersion
@@ -18,6 +19,7 @@ module ObsDeploy
18
19
  register 'deploy', Deploy
19
20
  register 'refresh-repositories', RefreshRepositories
20
21
  register 'systemctl', Systemctl
22
+ register 'pending-migrations', GetPendingMigration
21
23
  end
22
24
  end
23
25
  end
@@ -5,10 +5,10 @@ module ObsDeploy
5
5
  module Commands
6
6
  class GetDeployedVersion < Dry::CLI::Command
7
7
  desc 'Get the deployed version of OBS'
8
- option :host, type: :string, default: 'https://api.opensuse.org', desc: 'API server'
8
+ option :url, type: :string, default: 'https://api.opensuse.org', desc: 'API url'
9
9
 
10
- def call(host:, **)
11
- puts "Deployed version: #{ObsDeploy::CheckDiff.new(server: host).obs_running_commit}"
10
+ def call(url:, **)
11
+ puts "Deployed version: #{ObsDeploy::CheckDiff.new(server: url).obs_running_commit}"
12
12
  end
13
13
  end
14
14
  end
@@ -5,13 +5,13 @@ module ObsDeploy
5
5
  module Commands
6
6
  class GetPackageVersion < Dry::CLI::Command
7
7
  desc 'Get the available package version'
8
- option :host, type: :string, default: 'https://api.opensuse.org', desc: 'API server'
8
+ option :url, type: :string, default: 'https://api.opensuse.org', desc: 'API url'
9
9
  option :package, type: :string, default: 'obs-api', desc: 'Package name'
10
10
  option :product, type: :string, default: 'SLE_12_SP4', desc: 'Product name'
11
11
  option :architecture, type: :string, default: 'x86_64', desc: 'Architecture'
12
12
 
13
- def call(host:, product:, **)
14
- puts "Available package: #{ObsDeploy::CheckDiff.new(server: host, product: product).package_version}"
13
+ def call(url:, product:, **)
14
+ puts "Available package: #{ObsDeploy::CheckDiff.new(server: url, product: product).package_version}"
15
15
  end
16
16
  end
17
17
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ObsDeploy
4
+ module CLI
5
+ module Commands
6
+ class GetPendingMigration < Dry::CLI::Command
7
+ option :url, type: :string, default: 'https://api.opensuse.org', desc: 'API url'
8
+
9
+ def call(url:, **)
10
+ migrations = ObsDeploy::CheckDiff.new(server: url).migrations
11
+ if migrations.empty?
12
+ puts 'No pending migrations'
13
+ else
14
+ puts migrations
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -52,7 +52,7 @@ module ObsDeploy
52
52
  end
53
53
 
54
54
  def logger_formatter
55
- proc do |severity, datetime, progname, msg|
55
+ proc do |severity, _datetime, _progname, msg|
56
56
  "#{severity} - #{msg}\n"
57
57
  end
58
58
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ObsDeploy
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: obs_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pereira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-08 00:00:00.000000000 Z
11
+ date: 2020-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -168,6 +168,7 @@ files:
168
168
  - lib/obs_deploy/cli/commands/deploy.rb
169
169
  - lib/obs_deploy/cli/commands/get_deployed_version.rb
170
170
  - lib/obs_deploy/cli/commands/get_package_version.rb
171
+ - lib/obs_deploy/cli/commands/get_pending_migration.rb
171
172
  - lib/obs_deploy/cli/commands/refresh_repositories.rb
172
173
  - lib/obs_deploy/cli/commands/systemctl.rb
173
174
  - lib/obs_deploy/cli/commands/version.rb