Module: Comply::CLI::Subcommands::Integrations
- Includes:
- Helpers::Integration
- Included in:
- Agent
- Defined in:
- lib/comply/cli/subcommands/integrations.rb
Class Method Summary collapse
Methods included from Helpers::Integration
#env_vars_by_prompt, #prettify_integration, #pretty_print_integration, #prompt_and_create_integration, #prompt_and_update_integration, #prompt_for_env
Class Method Details
.included(thor) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/comply/cli/subcommands/integrations.rb', line 7 def self.included(thor) thor.class_eval do desc 'integrations:list', 'List integrations' define_method 'integrations:list' do integrations = default_program.integrations if integrations.empty? say 'No integrations found.' else integrations.each do |integration| say pretty_print_integration(integration) end end end desc 'integrations:enable INTEGRATION_ID', 'Enable an integration' define_method 'integrations:enable' do |integration_type| integration = default_program.integrations.find do |i| i.integration_type == integration_type end raise Thor::Error, 'Integration already enabled' if integration prompt_and_create_integration(integration_type) end desc 'integrations:update INTEGRATION_ID', 'Enable an integration' define_method 'integrations:update' do |integration_type| integration = default_program.integrations.find do |i| i.integration_type == integration_type end raise Thor::Error, 'Integration not found' unless integration prompt_and_update_integration(integration) end desc 'integrations:sync INTEGRATION_ID', 'Sync an integration' define_method 'integrations:sync' do |integration_type| integration = default_program.integrations.find do |i| i.integration_type == integration_type end raise Thor::Error, 'Integration not found' unless integration integration.links['sync'].post say 'Integration synced' end end end |