docker_rails_proxy 0.2.6 → 0.2.7

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: c0a36f7252172ddf4b5cc4f2fe88555788bd9a7291242ac9c26379e7774a3470
4
- data.tar.gz: 03fb2b8e5d68f72af9325e3c3c6d9385769ada6945bfda29a1e6b94681dfa603
3
+ metadata.gz: c0623e3df00f146812c68581de71230f43bdca59c3ea5d5ca46186eb8b470825
4
+ data.tar.gz: '07459a145dbdaa9b0639b440d84e1605fb86d7d640578b5ee27baae48cc64fcf'
5
5
  SHA512:
6
- metadata.gz: d8186d06f8038000538b95678e1d32d307999b2c65f3ab05efa6cd759b9882be4349131923a867bafc5bd73a88ad389dafd4805993b9e2d3d8580731b88fca8a
7
- data.tar.gz: abf9d518993f79218142e17fa1d443f64e06b6fb81b9736188f8d224d68132cc6cabff3cdd0163d723683e97c979603bf5b34f727c236769736b433a39ef0c0e
6
+ metadata.gz: 6ed97a66a0489c45ca071341a1326a6101793809c0e9b04b399ad485d702db3211deb6fc06d80784cb43d9674cfb64be3c72a88cb53fda1ffd0f785f80f8b5ae
7
+ data.tar.gz: a687878a62bf672d149ac0f78a204ecb8130e19e6f68219ef1fe6d2a53daebda692582b1a9c8e1af30247fe0621a22ce8b733dc0ca2448d3eb294dba1c9d68fa
@@ -6,11 +6,14 @@ module DockerRailsProxy
6
6
  UNNEEDED_ATTRIBUTES = %w[livenessProbe readinessProbe command lifecycle].freeze
7
7
  ACCEPTED_STATUSES = %w[Running Failed].freeze
8
8
 
9
- attr_accessor :data
9
+ attr_accessor :data, :options
10
+
11
+ after_initialize { self.options = {} }
12
+ after_initialize :parse_options!, :set_defaults
10
13
 
11
14
  before_process do
12
15
  self.data = JSON.parse(
13
- kubectl_output("get pod #{cloned_pod_name} -o json")
16
+ kubectl_output("get pod #{cloned_pod_name} -n #{options[:namespace]} -o json")
14
17
  )
15
18
  end
16
19
 
@@ -56,6 +59,7 @@ module DockerRailsProxy
56
59
 
57
60
  kubectl <<-RUN_COMMAND
58
61
  run #{pod_name} --rm -i --tty \
62
+ --namespace='#{options[:namespace]}' \
59
63
  --image='#{container['image']}' \
60
64
  --overrides='#{overrides.to_json}'
61
65
  RUN_COMMAND
@@ -66,7 +70,7 @@ module DockerRailsProxy
66
70
  def cloned_pod_name
67
71
  @cloned_pod_name ||= begin
68
72
  pods = kubectl_output(<<-GET_PODS).split(" ")
69
- get pods -o jsonpath='{range .items[*]}{.metadata.name},{.status.phase}{" "}{end}'
73
+ get pods -n #{options[:namespace]} -o jsonpath='{range .items[*]}{.metadata.name},{.status.phase}{" "}{end}'
70
74
  GET_PODS
71
75
 
72
76
  pods = pods.map do |values|
@@ -91,6 +95,29 @@ module DockerRailsProxy
91
95
  end
92
96
  end
93
97
  end
98
+
99
+ def parse_options!
100
+ opt_parser.parse!(arguments)
101
+ end
102
+
103
+ def set_defaults
104
+ options[:namespace] = 'default' if options[:namespace].nil?
105
+ end
106
+
107
+ def opt_parser
108
+ @opt_parser ||= OptionParser.new do |opts|
109
+ opts.banner = "Usage: bin/#{APP_NAME} kubectl bash [<arguments>] -- [<additional_arguments>]"
110
+
111
+ opts.on(
112
+ '-n', '--namespace NAMESPACE', 'The namespace of the pod to clone and run the bash command in (default: default)'
113
+ ) { |namespace| options[:namespace] = namespace }
114
+
115
+ opts.on('-h', '--help', 'Display this screen') do
116
+ puts opts
117
+ exit
118
+ end
119
+ end
120
+ end
94
121
  end
95
122
  end
96
123
  end
@@ -1,3 +1,3 @@
1
1
  module DockerRailsProxy
2
- VERSION = '0.2.6'
2
+ VERSION = '0.2.7'
3
3
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker_rails_proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jairo
8
8
  - Vázquez
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2023-07-03 00:00:00.000000000 Z
11
+ date: 2026-02-11 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: Configures docker-compose and provides rails command helpers
15
14
  email:
@@ -62,7 +61,6 @@ homepage: https://github.com/jairovm/docker_rails_proxy
62
61
  licenses:
63
62
  - MIT
64
63
  metadata: {}
65
- post_install_message:
66
64
  rdoc_options: []
67
65
  require_paths:
68
66
  - lib
@@ -77,8 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
75
  - !ruby/object:Gem::Version
78
76
  version: '0'
79
77
  requirements: []
80
- rubygems_version: 3.4.10
81
- signing_key:
78
+ rubygems_version: 3.6.2
82
79
  specification_version: 4
83
80
  summary: docker, docker-compose and rails wrapper
84
81
  test_files: []