putpaws 0.0.4 → 0.0.6

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: c9b025bc939b88f486c24a29bee4a1e0d8d7d3fbd1dee2e074d747d591eef94c
4
- data.tar.gz: 4bc2a5ea2528e771e9b50af5e2452c49de9b1f0b3fb564bcb018328a3c7db380
3
+ metadata.gz: '0880d0887eb118ff264bf873fdbe215e039329e9dfc58d004885c7f728f5730a'
4
+ data.tar.gz: 25114357952cb895486c6068e1115cf2d8baea0d3a23b20c7e5d569e73acbb93
5
5
  SHA512:
6
- metadata.gz: ca49348b366c8edf1b7956918a127226aff23955f603f8f3a5fbb20a79599df8c6b6c6a05e463e83afd835c7f1fa7966f692b9dff40874159e871a0a760cadc4
7
- data.tar.gz: da8783fe46689817420ab7e7258add92c3fb2131ae8d55afa3940102efc12860037a6b4d95523a8dac78dc8fbd859f2a1255755cac2fd02cd10ed061c662c04c
6
+ metadata.gz: e3a52e4bb01dc8d0825a96b52083935f9b630256576a36f780fbefea1d8925a0a3a71ecf1be7524026032d38d9ea4a682d6bd11d79294f52c33ea04f9ffefb80
7
+ data.tar.gz: 584f4a1b234e0561e5ed0278c8c00410df99577926e4a087671e378b41f3f7541d20a9b6ca857dbd9d26eb51e604960b2f1a5439ea16bfcfcc6eba7590fef1ea
@@ -12,7 +12,7 @@ class Putpaws::ApplicationConfig < Struct.new(
12
12
  def self.load(path_prefix: '.putpaws')
13
13
  @application_data ||= begin
14
14
  path = Pathname.new(path_prefix).join("application.json").to_s
15
- data = File.exists?(path) ?
15
+ data = File.exist?(path) ?
16
16
  JSON.parse(File.read(path), symbolize_names: true).to_h :
17
17
  {}
18
18
  end
@@ -57,6 +57,6 @@ class Putpaws::ApplicationConfig < Struct.new(
57
57
  end
58
58
 
59
59
  def schedules
60
- @schedules ||= (self[:schedules] || []).map{|x| Putpaws::ScheduleConfig.find(x)}
60
+ @schedules ||= (self[:schedules] || []).map{|x| Putpaws::ScheduleConfig.find(x)}.compact
61
61
  end
62
62
  end
@@ -1,4 +1,4 @@
1
- require "tty-prompt"
1
+ require "putpaws/prompt"
2
2
  require "putpaws/cloud_watch/log_command"
3
3
  require "putpaws/cloud_watch/default_log_formatter"
4
4
 
@@ -6,7 +6,7 @@ namespace :log do
6
6
  desc "Set Log Group."
7
7
  task :set_log_group do
8
8
  app = fetch(:app)
9
- prompt = TTY::Prompt.new
9
+ prompt = Putpaws::Prompt.safe
10
10
  log_type = if app.build_log_group_prefix
11
11
  prompt.select("Choose log type", ["default", "build"])
12
12
  else
@@ -1,4 +1,4 @@
1
- require "tty-prompt"
1
+ require "putpaws/prompt"
2
2
  require "putpaws/ecs/task_command"
3
3
 
4
4
  namespace :ecs do
@@ -10,7 +10,7 @@ namespace :ecs do
10
10
  task_def = t.task_definition_arn.split('/').last
11
11
  ["#{task_id} (#{task_def}) #{t.last_status}", t]
12
12
  }.to_h
13
- prompt = TTY::Prompt.new
13
+ prompt = Putpaws::Prompt.safe
14
14
  selected = prompt.select("Choose a task you're going to operate", ecs_tasks.keys)
15
15
  ecs_task = ecs_tasks[selected]
16
16
 
@@ -7,7 +7,7 @@ class Putpaws::InfraNetworkConfig < Struct.new(
7
7
  def self.load(path_prefix: '.putpaws')
8
8
  @infra_network_data ||= begin
9
9
  path = Pathname.new(path_prefix).join("infra.json").to_s
10
- data = File.exists?(path) ?
10
+ data = File.exist?(path) ?
11
11
  JSON.parse(File.read(path), symbolize_names: true).to_h :
12
12
  {}
13
13
  data[:network] || {}
@@ -11,7 +11,7 @@ class Putpaws::InfraTargetConfig < Struct.new(
11
11
  def self.load(path_prefix: '.putpaws')
12
12
  @infra_target_data ||= begin
13
13
  path = Pathname.new(path_prefix).join("infra.json").to_s
14
- data = File.exists?(path) ?
14
+ data = File.exist?(path) ?
15
15
  JSON.parse(File.read(path), symbolize_names: true).to_h :
16
16
  {}
17
17
  data[:target] || {}
@@ -0,0 +1,9 @@
1
+ require "io/console"
2
+ require "tty-prompt"
3
+
4
+ class Putpaws::Prompt
5
+ def self.safe
6
+ default_args = {output: IO.console || $stderr}
7
+ TTY::Prompt.new(**default_args)
8
+ end
9
+ end
@@ -9,7 +9,7 @@ class Putpaws::ScheduleConfig < Struct.new(
9
9
  def self.load(path_prefix: '.putpaws')
10
10
  @schedule_data ||= begin
11
11
  path = Pathname.new(path_prefix).join("schedule.json").to_s
12
- data = File.exists?(path) ?
12
+ data = File.exist?(path) ?
13
13
  JSON.parse(File.read(path), symbolize_names: true).to_h :
14
14
  {}
15
15
  end
@@ -1,4 +1,4 @@
1
- require "tty-prompt"
1
+ require "putpaws/prompt"
2
2
  require "putpaws/schedule_config"
3
3
  require "putpaws/scheduler/schedule_command"
4
4
 
@@ -12,7 +12,7 @@ namespace :scheduler do
12
12
  raise "Please set `schedules` at .putpaws/schedule.json\nFollowing schedules available:\n#{schedule_options.to_json}\n"
13
13
  end
14
14
 
15
- prompt = TTY::Prompt.new
15
+ prompt = Putpaws::Prompt.safe
16
16
  selected = prompt.select("Choose a task you're going to operate", schedules.map(&:name))
17
17
  schedule_config = schedules.find{|x| x.name == selected}
18
18
 
@@ -1,3 +1,3 @@
1
1
  module Putpaws
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: putpaws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - metheglin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-03 00:00:00.000000000 Z
11
+ date: 2023-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -105,6 +105,7 @@ files:
105
105
  - lib/putpaws/hello.rb
106
106
  - lib/putpaws/infra_network_config.rb
107
107
  - lib/putpaws/infra_target_config.rb
108
+ - lib/putpaws/prompt.rb
108
109
  - lib/putpaws/schedule_config.rb
109
110
  - lib/putpaws/scheduler/schedule_command.rb
110
111
  - lib/putpaws/scheduler/scheduler_task.rb