mrm 1.2.0 → 1.3.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
  SHA1:
3
- metadata.gz: dae886f51c635387efae02e7df8cdc3f08f4d3f4
4
- data.tar.gz: 072c996d014c6d956ba27623cd10411fe18fcfa8
3
+ metadata.gz: bc90b2fcb5f8c21c4a0b17bc248c553013d7f53f
4
+ data.tar.gz: b80717c12431eb691b663a87c8ec23154f2c7267
5
5
  SHA512:
6
- metadata.gz: 4de7e5aef08e6f1359f11cbc0d2ab6e2077add60a58bdfb915e836242bf8a8d39d5e6ee6369ac25b44e091fc774bd6ab22f49fa82a0add4fe4a24846528d4e1b
7
- data.tar.gz: a1f80f29d3124b87cadaff34ca82ff7b961a25458251b483cdefa7214eed4c32d9fefa3d3975c60c9ea634723a109367351e5ef956011da0b65a01d247dc616d
6
+ metadata.gz: f9e1c3710997f9bd295deb19c9b52dba8a04e319df5428a0ef342e26a79d64c49f39263b2791018b2212e99bba5dc955a9fa3206b22e3e5e8e995304c8187370
7
+ data.tar.gz: 663b87b564ae4f16e551f34628da9284441664faacf353bd2d1d65d8e912743ed33e5ffec88ad4b584b469f98e9f22c316433c120e6d31d4f9a60a08d947552e
data/bin/mrm CHANGED
@@ -5,7 +5,6 @@ require 'optparse'
5
5
  require 'ostruct'
6
6
 
7
7
  options = OpenStruct.new
8
- client = MRM::Client.new
9
8
 
10
9
  OptionParser.new do |opts|
11
10
  opts.banner = "Usage: mrm [options] <command>\n\nOptions:"
@@ -18,6 +17,7 @@ OptionParser.new do |opts|
18
17
  puts opts.to_s.split("\n")
19
18
  puts "\nCommands:"
20
19
  [
20
+ ['config', '', '', "Saves registry credentials. Required before any other command.\n"],
21
21
  ['check', '', '', "Checks registry availability\n"],
22
22
  ['list', '', '', "Lists repositories of the registry\n"],
23
23
  ['list', '*repo*', '', "Lists tags of the specific repository\n"],
@@ -35,7 +35,21 @@ if options.v
35
35
  abort
36
36
  end
37
37
 
38
+ if !File.file?("#{Dir.home}/.mrmconfig") && ARGV[0] != 'config'
39
+ puts "Run 'mrm config' to configure credentials first"
40
+ abort
41
+ end
42
+
43
+ client = MRM::Client.new
38
44
  case ARGV[0]
45
+ when 'config'
46
+ print 'Registry url(ex: https://registry.example.com): '
47
+ url = STDIN.gets.strip
48
+ print 'Login: '
49
+ login = STDIN.gets.strip
50
+ print 'Password: '
51
+ password = STDIN.noecho(&:gets).strip
52
+ MRM::ConfigStorage.new(url, login, password).store!
39
53
  when 'check'
40
54
  client.version_check
41
55
  when 'delete'
data/lib/mrm/client.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module MRM
2
2
  class Client
3
3
  def initialize
4
- @config = YAML.load_file('config.yml')
4
+ @config = YAML.load_file("#{Dir.home}/.mrmconfig")
5
5
  end
6
6
 
7
7
  def version_check
@@ -0,0 +1,18 @@
1
+ module MRM
2
+ class ConfigStorage
3
+ def initialize(url, login, password)
4
+ @url, @login, @password = url, login, password
5
+ end
6
+
7
+ def store!
8
+ f = File.new("#{Dir.home}/.mrmconfig", 'w')
9
+ f.puts("REGISTRY_URL: #{url}")
10
+ f.puts("REGISTRY_LOGIN: #{login}")
11
+ f.puts("REGISTRY_PASS: #{password}")
12
+ f.close
13
+ end
14
+
15
+ private
16
+ attr_reader :url, :login, :password
17
+ end
18
+ end
data/lib/mrm/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module MRM
2
2
  class Version
3
3
  MAJOR = 1
4
- MINOR = 2
4
+ MINOR = 3
5
5
  PATCH = 0
6
6
  PRE = nil
7
7
 
data/lib/mrm.rb CHANGED
@@ -5,6 +5,7 @@ require 'cgi'
5
5
  require 'json'
6
6
  require 'yaml'
7
7
  require 'pp'
8
+ require 'mrm/config_storage'
8
9
  require 'mrm/colored_output'
9
10
  require 'mrm/client'
10
11
  require 'mrm/api'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mrm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rustam A. Gasanov
@@ -22,6 +22,7 @@ files:
22
22
  - lib/mrm/api.rb
23
23
  - lib/mrm/client.rb
24
24
  - lib/mrm/colored_output.rb
25
+ - lib/mrm/config_storage.rb
25
26
  - lib/mrm/error.rb
26
27
  - lib/mrm/version.rb
27
28
  homepage: http://rubygems.org/gems/mrm