wisco 0.1.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 +7 -0
- data/bin/wisco +7 -0
- data/lib/wisco/commands/exec.rb +126 -0
- data/lib/wisco/commands/fixtures.rb +149 -0
- data/lib/wisco/commands/init.rb +63 -0
- data/lib/wisco/commands/list.rb +192 -0
- data/lib/wisco/commands/pull.rb +176 -0
- data/lib/wisco/commands/push.rb +129 -0
- data/lib/wisco/config.rb +43 -0
- data/lib/wisco/connector.rb +91 -0
- data/lib/wisco/path_utils.rb +57 -0
- data/lib/wisco/version.rb +3 -0
- data/lib/wisco/workato_api.rb +75 -0
- data/lib/wisco.rb +162 -0
- metadata +98 -0
data/lib/wisco.rb
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
require 'thor'
|
|
3
|
+
require_relative 'wisco/version'
|
|
4
|
+
|
|
5
|
+
module Wisco
|
|
6
|
+
CLI_NAME = 'wisco'
|
|
7
|
+
DISPLAY_NAME = 'Wisco (Workato Connector SDK Companion)'
|
|
8
|
+
WISCO_DIR = ".#{CLI_NAME}"
|
|
9
|
+
CONFIG_FILENAME = 'config.json'
|
|
10
|
+
|
|
11
|
+
def self.config_path(target_dir)
|
|
12
|
+
File.join(target_dir, WISCO_DIR, CONFIG_FILENAME)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
require_relative 'wisco/config'
|
|
17
|
+
require_relative 'wisco/connector'
|
|
18
|
+
require_relative 'wisco/commands/init'
|
|
19
|
+
require_relative 'wisco/commands/list'
|
|
20
|
+
require_relative 'wisco/commands/exec'
|
|
21
|
+
require_relative 'wisco/commands/fixtures'
|
|
22
|
+
require_relative 'wisco/commands/pull'
|
|
23
|
+
require_relative 'wisco/commands/push'
|
|
24
|
+
|
|
25
|
+
module Wisco
|
|
26
|
+
class CLI < Thor
|
|
27
|
+
package_name DISPLAY_NAME
|
|
28
|
+
check_unknown_options!
|
|
29
|
+
|
|
30
|
+
def self.exit_on_failure?
|
|
31
|
+
true
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Rewrite `wisco <command> --help` → `wisco help <command>` so Thor shows
|
|
35
|
+
# per-command help instead of treating --help as a positional argument.
|
|
36
|
+
def self.start(given_args = ARGV, config = {})
|
|
37
|
+
if given_args.length >= 2 &&
|
|
38
|
+
(given_args.include?('--help') || given_args.include?('-h')) &&
|
|
39
|
+
!given_args.first.start_with?('-')
|
|
40
|
+
super(['help', given_args.first], config)
|
|
41
|
+
else
|
|
42
|
+
super
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
map %w[--version -v] => :version
|
|
47
|
+
desc 'version', 'Show version'
|
|
48
|
+
def version
|
|
49
|
+
puts "#{DISPLAY_NAME} v#{VERSION}"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
desc 'init [PATH]', "Detect connector and initialise #{WISCO_DIR}/"
|
|
53
|
+
long_desc "Searches PATH (default: current directory) for a valid connector file and writes #{WISCO_DIR}/#{CONFIG_FILENAME}."
|
|
54
|
+
def init(path = nil)
|
|
55
|
+
Wisco::Commands::Init.run(path || Dir.pwd)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
desc 'list [SUBCOMMAND] [PATH]', 'Show connector structure'
|
|
59
|
+
long_desc <<~DESC
|
|
60
|
+
Shows a tree overview by default. SUBCOMMAND can be:
|
|
61
|
+
actions List all actions as a markdown table
|
|
62
|
+
triggers List all triggers as a markdown table
|
|
63
|
+
all Show tree + actions + triggers
|
|
64
|
+
PATH defaults to the current directory.
|
|
65
|
+
DESC
|
|
66
|
+
option :sort, type: :string, desc: 'Sort actions/triggers by key or title', enum: %w[key title]
|
|
67
|
+
def list(subcommand = nil, path = nil)
|
|
68
|
+
if subcommand&.match?(%r{^[./~\\]|^[A-Za-z]:[/\\]})
|
|
69
|
+
path = subcommand
|
|
70
|
+
subcommand = nil
|
|
71
|
+
end
|
|
72
|
+
Wisco::Commands::List.run(subcommand, path || Dir.pwd, sort: options[:sort])
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
desc 'exec PATH [TARGET_DIR]', 'Execute connector methods against fixture data'
|
|
76
|
+
long_desc <<~DESC
|
|
77
|
+
Runs each ready execute_* file in fixtures/<section>/<key>/.
|
|
78
|
+
Run `wisco fixtures PATH` first to generate fixture templates.
|
|
79
|
+
|
|
80
|
+
PATH forms:
|
|
81
|
+
actions.get_users one key in a known section
|
|
82
|
+
actions all keys in that section
|
|
83
|
+
get_users auto-detect section
|
|
84
|
+
DESC
|
|
85
|
+
option :input, type: :string, desc: 'Specific input file'
|
|
86
|
+
option :debug, type: :boolean, default: false, desc: 'Print ExecCommand call details'
|
|
87
|
+
def exec(path_arg, target_dir = nil)
|
|
88
|
+
Wisco::Commands::Exec.run(
|
|
89
|
+
path_arg,
|
|
90
|
+
target_dir || Dir.pwd,
|
|
91
|
+
input: options[:input],
|
|
92
|
+
debug: options[:debug]
|
|
93
|
+
)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
desc 'fixtures PATH [TARGET_DIR]', 'Fetch input/output fields and generate fixture templates'
|
|
97
|
+
long_desc <<~DESC
|
|
98
|
+
Fetches input_fields and output_fields from the connector and writes them
|
|
99
|
+
to fixtures/<section>/<key>/. Also generates an execute_input.json template.
|
|
100
|
+
|
|
101
|
+
PATH forms:
|
|
102
|
+
actions.get_users one key in a known section
|
|
103
|
+
actions all keys in that section
|
|
104
|
+
get_users auto-detect section
|
|
105
|
+
DESC
|
|
106
|
+
option :overwrite, type: :boolean, default: false, desc: 'Overwrite execute_input.json even if user-edited'
|
|
107
|
+
option :debug, type: :boolean, default: false, desc: 'Print ExecCommand call details'
|
|
108
|
+
def fixtures(path_arg, target_dir = nil)
|
|
109
|
+
Wisco::Commands::Fixtures.run(
|
|
110
|
+
path_arg,
|
|
111
|
+
target_dir || Dir.pwd,
|
|
112
|
+
overwrite: options[:overwrite],
|
|
113
|
+
debug: options[:debug]
|
|
114
|
+
)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
desc 'push [TARGET_DIR]', 'Push connector assets to the Workato platform'
|
|
118
|
+
long_desc <<~DESC
|
|
119
|
+
Uploads the connector code, logo.png, and README.md to Workato.
|
|
120
|
+
Requires workato_developer_api hostname and api_token in #{WISCO_DIR}/#{CONFIG_FILENAME}.
|
|
121
|
+
If not set, you will be prompted on first run.
|
|
122
|
+
DESC
|
|
123
|
+
option :title, type: :string, desc: 'Connector title (default: from config or connector code)'
|
|
124
|
+
option :notes, type: :string, desc: 'Version notes (prompted if not provided)'
|
|
125
|
+
option :folder, type: :numeric, desc: 'Workato folder ID to push connector into'
|
|
126
|
+
option :verbose, type: :boolean, default: true, desc: 'Enable detailed SDK logging'
|
|
127
|
+
option :debug, type: :boolean, default: false, desc: 'Show push call details'
|
|
128
|
+
def push(target_dir = nil)
|
|
129
|
+
Wisco::Commands::Push.run(
|
|
130
|
+
target_dir || Dir.pwd,
|
|
131
|
+
title: options[:title],
|
|
132
|
+
notes: options[:notes],
|
|
133
|
+
folder: options[:folder],
|
|
134
|
+
verbose: options[:verbose],
|
|
135
|
+
debug: options[:debug]
|
|
136
|
+
)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
desc 'pull [TARGET_DIR]', 'Pull connector from the Workato platform'
|
|
140
|
+
long_desc <<~DESC
|
|
141
|
+
Downloads connector data from the Workato Developer API.
|
|
142
|
+
Saves results to .wisco/pull/ inside the target directory.
|
|
143
|
+
|
|
144
|
+
Requires workato_developer_api hostname and api_token in #{WISCO_DIR}/#{CONFIG_FILENAME}.
|
|
145
|
+
If not set, you will be prompted on first run.
|
|
146
|
+
|
|
147
|
+
--what accepts comma-separated values: all, logo, code, versions, meta
|
|
148
|
+
DESC
|
|
149
|
+
option :what, type: :string, default: 'all',
|
|
150
|
+
desc: 'What to retrieve: all, logo, code, versions, meta'
|
|
151
|
+
option :title, type: :string, desc: 'Connector title to search for (default: derived from connector file)'
|
|
152
|
+
option :debug, type: :boolean, default: false, desc: 'Show API call details'
|
|
153
|
+
def pull(target_dir = nil)
|
|
154
|
+
Wisco::Commands::Pull.run(
|
|
155
|
+
target_dir || Dir.pwd,
|
|
156
|
+
what: options[:what],
|
|
157
|
+
title: options[:title],
|
|
158
|
+
debug: options[:debug]
|
|
159
|
+
)
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: wisco
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.7
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- mbillington
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-05-10 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: activesupport
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 7.0.0
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 7.0.0
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: workato-connector-sdk
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - '='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 1.3.19
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - '='
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 1.3.19
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: thor
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '1.0'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '1.0'
|
|
55
|
+
description:
|
|
56
|
+
email:
|
|
57
|
+
executables:
|
|
58
|
+
- wisco
|
|
59
|
+
extensions: []
|
|
60
|
+
extra_rdoc_files: []
|
|
61
|
+
files:
|
|
62
|
+
- bin/wisco
|
|
63
|
+
- lib/wisco.rb
|
|
64
|
+
- lib/wisco/commands/exec.rb
|
|
65
|
+
- lib/wisco/commands/fixtures.rb
|
|
66
|
+
- lib/wisco/commands/init.rb
|
|
67
|
+
- lib/wisco/commands/list.rb
|
|
68
|
+
- lib/wisco/commands/pull.rb
|
|
69
|
+
- lib/wisco/commands/push.rb
|
|
70
|
+
- lib/wisco/config.rb
|
|
71
|
+
- lib/wisco/connector.rb
|
|
72
|
+
- lib/wisco/path_utils.rb
|
|
73
|
+
- lib/wisco/version.rb
|
|
74
|
+
- lib/wisco/workato_api.rb
|
|
75
|
+
homepage: https://github.com/billingtonm/wisco
|
|
76
|
+
licenses:
|
|
77
|
+
- MIT
|
|
78
|
+
metadata: {}
|
|
79
|
+
post_install_message:
|
|
80
|
+
rdoc_options: []
|
|
81
|
+
require_paths:
|
|
82
|
+
- lib
|
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
84
|
+
requirements:
|
|
85
|
+
- - ">="
|
|
86
|
+
- !ruby/object:Gem::Version
|
|
87
|
+
version: '2.7'
|
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
|
+
requirements:
|
|
90
|
+
- - ">="
|
|
91
|
+
- !ruby/object:Gem::Version
|
|
92
|
+
version: '0'
|
|
93
|
+
requirements: []
|
|
94
|
+
rubygems_version: 3.1.6
|
|
95
|
+
signing_key:
|
|
96
|
+
specification_version: 4
|
|
97
|
+
summary: Workato Connector SDK Companion
|
|
98
|
+
test_files: []
|