wisco 0.3.0 → 0.3.1
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 +4 -4
- data/lib/wisco/assets/.gitignore +3 -0
- data/lib/wisco/commands/init.rb +67 -1
- data/lib/wisco/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 72efcafcb9b1fdca5d4e8da95e9856e4a2c3920a8783323ff0ee533fafec1795
|
|
4
|
+
data.tar.gz: 7b357fbf5264403871bcc3523d31258fdc3df60fb07ca20c5d77ed41e0049395
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5d31c9feb76d2241c72d20756942048e27e0bbd16309acbe50d004f3222da33e9c7fd24df47821fdb901154282003d3931548ab0d9dbb1914f5deb27a7b192cd
|
|
7
|
+
data.tar.gz: 9d5e3f0b012e088720afea813f1dfe29241b57ba6da228554f1e6234b3eb8292e10b4dce3a56bd43960fba58e649cac4ef0d49763e600a3bce9184131847368c
|
data/lib/wisco/commands/init.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require 'erb'
|
|
1
2
|
require 'fileutils'
|
|
2
3
|
require_relative '../config'
|
|
3
4
|
require_relative '../connector'
|
|
@@ -5,6 +6,15 @@ require_relative '../connector'
|
|
|
5
6
|
module Wisco
|
|
6
7
|
module Commands
|
|
7
8
|
module Init
|
|
9
|
+
HOSTNAMES = [
|
|
10
|
+
{ region: 'US Data Center', hostname: 'www.workato.com' },
|
|
11
|
+
{ region: 'EU Data Center', hostname: 'app.eu.workato.com' },
|
|
12
|
+
{ region: 'JP Data Center', hostname: 'app.jp.workato.com' },
|
|
13
|
+
{ region: 'SG Data Center', hostname: 'app.sg.workato.com' },
|
|
14
|
+
{ region: 'AU Data Center', hostname: 'app.au.workato.com' },
|
|
15
|
+
{ region: 'IL Data Center', hostname: 'app.il.workato.com' },
|
|
16
|
+
].freeze
|
|
17
|
+
|
|
8
18
|
module_function
|
|
9
19
|
|
|
10
20
|
def run(target_dir)
|
|
@@ -36,10 +46,41 @@ module Wisco
|
|
|
36
46
|
config['connector']['path'] = target_dir
|
|
37
47
|
config['connector']['file'] = connector_file
|
|
38
48
|
|
|
49
|
+
prompt_hostname(config)
|
|
50
|
+
|
|
39
51
|
Wisco::Config.save_config(config_path, config)
|
|
40
52
|
puts "Config written to #{config_path}"
|
|
41
53
|
|
|
42
54
|
update_gitignore(target_dir)
|
|
55
|
+
deploy_github_workflow(target_dir, connector_file, config)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def prompt_hostname(config)
|
|
59
|
+
api_cfg = config['workato_developer_api'] ||= {}
|
|
60
|
+
current = api_cfg['hostname']
|
|
61
|
+
|
|
62
|
+
if current && !current.strip.empty?
|
|
63
|
+
puts "Current Workato hostname: #{current}"
|
|
64
|
+
print 'Keep this? (y/n): '
|
|
65
|
+
return if $stdin.gets.strip.downcase == 'y'
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
puts 'Select your Workato instance:'
|
|
69
|
+
HOSTNAMES.each_with_index do |entry, i|
|
|
70
|
+
puts " #{i + 1}. #{entry[:hostname]} (#{entry[:region]})"
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
loop do
|
|
74
|
+
print "Enter number (1-#{HOSTNAMES.size}): "
|
|
75
|
+
input = $stdin.gets.strip
|
|
76
|
+
index = input.to_i
|
|
77
|
+
if index >= 1 && index <= HOSTNAMES.size
|
|
78
|
+
api_cfg['hostname'] = HOSTNAMES[index - 1][:hostname]
|
|
79
|
+
puts "Hostname set to: #{api_cfg['hostname']}"
|
|
80
|
+
return
|
|
81
|
+
end
|
|
82
|
+
warn "Invalid selection. Please enter a number between 1 and #{HOSTNAMES.size}."
|
|
83
|
+
end
|
|
43
84
|
end
|
|
44
85
|
|
|
45
86
|
def update_gitignore(target_dir)
|
|
@@ -55,9 +96,34 @@ module Wisco
|
|
|
55
96
|
puts "Added '#{entry}' to .gitignore"
|
|
56
97
|
end
|
|
57
98
|
else
|
|
58
|
-
|
|
99
|
+
asset_path = File.join(__dir__, '..', 'assets', '.gitignore')
|
|
100
|
+
FileUtils.cp(asset_path, gitignore_path)
|
|
101
|
+
puts "Created .gitignore from template"
|
|
59
102
|
end
|
|
60
103
|
end
|
|
104
|
+
|
|
105
|
+
def deploy_github_workflow(target_dir, connector_file, config)
|
|
106
|
+
output_path = File.join(target_dir, '.github', 'workflows', 'deploy.yml')
|
|
107
|
+
|
|
108
|
+
if File.exist?(output_path)
|
|
109
|
+
print '.github/workflows/deploy.yml already exists. Overwrite? (y/n): '
|
|
110
|
+
unless $stdin.gets.strip.downcase == 'y'
|
|
111
|
+
puts 'Skipped: .github/workflows/deploy.yml'
|
|
112
|
+
return
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
hostname = config.dig('workato_developer_api', 'hostname')
|
|
117
|
+
workato_base_url = "https://#{hostname}"
|
|
118
|
+
connector_name = connector_file
|
|
119
|
+
|
|
120
|
+
template_path = File.join(__dir__, '..', 'assets', '.github', 'workflows', 'deploy.yml.erb')
|
|
121
|
+
rendered = ERB.new(File.read(template_path)).result(binding)
|
|
122
|
+
|
|
123
|
+
FileUtils.mkdir_p(File.dirname(output_path))
|
|
124
|
+
File.write(output_path, rendered)
|
|
125
|
+
puts 'Created .github/workflows/deploy.yml'
|
|
126
|
+
end
|
|
61
127
|
end
|
|
62
128
|
end
|
|
63
129
|
end
|
data/lib/wisco/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wisco
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- mbillington
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-05-
|
|
11
|
+
date: 2026-05-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -64,6 +64,7 @@ extra_rdoc_files: []
|
|
|
64
64
|
files:
|
|
65
65
|
- bin/wisco
|
|
66
66
|
- lib/wisco.rb
|
|
67
|
+
- lib/wisco/assets/.gitignore
|
|
67
68
|
- lib/wisco/commands/exec.rb
|
|
68
69
|
- lib/wisco/commands/fixtures.rb
|
|
69
70
|
- lib/wisco/commands/init.rb
|