docker_rails_proxy 0.2.5 → 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: 5fc34e31db0b0337ee37b71bcc6d19f08c1b5856e1b7946643ef7b1636c4fa8c
4
- data.tar.gz: b7c1da4db5d4d8ab094b482f800fc7c4c54967076c910d07c57ae470486b3856
3
+ metadata.gz: c0623e3df00f146812c68581de71230f43bdca59c3ea5d5ca46186eb8b470825
4
+ data.tar.gz: '07459a145dbdaa9b0639b440d84e1605fb86d7d640578b5ee27baae48cc64fcf'
5
5
  SHA512:
6
- metadata.gz: 51607018697f916b603225a1cb03182ecd5b51f7b87f868e750b4c7438f0ca1eef64bbc24b768c0f820f9ae846bf0c440dc2e603699e101434977d811741cca8
7
- data.tar.gz: 7e9b12ca108603ed2ba2f6dea8101675c58d14525f64da2a3066dd00987d8d21149ba0eee4d8558fd2bd2bd96f7b86af1294ed31e380729b42c518cf0b7fd33c
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
@@ -0,0 +1,40 @@
1
+ module DockerRailsProxy
2
+ class Rails < SyncBack
3
+ class FhirApplicationCredentials < self
4
+ attr_accessor :options
5
+
6
+ after_initialize { self.options = {} }
7
+ after_initialize { opt_parser.parse!(arguments) }
8
+
9
+ validates { '--environment is required' if options[:environment].nil? }
10
+ validates { '--application is required' if options[:application].nil? }
11
+
12
+ def process
13
+ command = "RAILS_MASTER_KEY=$(<config/credentials/#{options[:environment]}.key) "\
14
+ "EDITOR=vim bin/rails encrypted:edit "\
15
+ "config/credentials/fhir_applications/" + options[:environment] + "/" + options[:application] + ".yml.enc"
16
+ execute "bash -c '#{command}'", tty: true
17
+ end
18
+
19
+ private
20
+
21
+ def opt_parser
22
+ @opt_parser ||= OptionParser.new do |opts|
23
+ opts.banner = "Usage: bin/#{APP_NAME} rails fhir_application_credentials [options]"
24
+ opts.on(
25
+ '--environment ENVIRONMENT', 'App environment'
26
+ ) { |environment| options[:environment] = environment }
27
+ opts.on(
28
+ '--application APPLICATION', 'App permalink'
29
+ ) { |application| options[:application] = application }
30
+
31
+ opts.on('-h', '--help', 'Display this screen') do
32
+ puts opts
33
+ exit
34
+ end
35
+ end
36
+ end
37
+
38
+ end
39
+ end
40
+ end
@@ -3,10 +3,12 @@ module DockerRailsProxy
3
3
  attr_reader :args
4
4
 
5
5
  autoload :Credentials, 'docker_rails_proxy/commands/rails/credentials'
6
+ autoload :FhirApplicationCredentials, 'docker_rails_proxy/commands/rails/fhir_application_credentials'
6
7
 
7
8
  builds ->(params:) do
8
9
  case params[:arguments].first
9
10
  when 'credentials' then Credentials
11
+ when 'fhir_application_credentials' then FhirApplicationCredentials
10
12
  else
11
13
  DockerRailsProxy::Rails
12
14
  end
@@ -1,3 +1,3 @@
1
1
  module DockerRailsProxy
2
- VERSION = '0.2.5'
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.5
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-01-26 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:
@@ -38,6 +37,7 @@ files:
38
37
  - lib/docker_rails_proxy/commands/kubectl/set_kubeconfig.rb
39
38
  - lib/docker_rails_proxy/commands/rails.rb
40
39
  - lib/docker_rails_proxy/commands/rails/credentials.rb
40
+ - lib/docker_rails_proxy/commands/rails/fhir_application_credentials.rb
41
41
  - lib/docker_rails_proxy/commands/rake.rb
42
42
  - lib/docker_rails_proxy/commands/rspec.rb
43
43
  - lib/docker_rails_proxy/commands/spring.rb
@@ -61,7 +61,6 @@ homepage: https://github.com/jairovm/docker_rails_proxy
61
61
  licenses:
62
62
  - MIT
63
63
  metadata: {}
64
- post_install_message:
65
64
  rdoc_options: []
66
65
  require_paths:
67
66
  - lib
@@ -76,8 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
75
  - !ruby/object:Gem::Version
77
76
  version: '0'
78
77
  requirements: []
79
- rubygems_version: 3.3.26
80
- signing_key:
78
+ rubygems_version: 3.6.2
81
79
  specification_version: 4
82
80
  summary: docker, docker-compose and rails wrapper
83
81
  test_files: []