Class: Fhcap::CLI::Component

Inherits:
ThorBase show all
Defined in:
lib/fhcap/component.rb

Instance Attribute Summary

Attributes inherited from ThorBase

#config, #thor

Instance Method Summary collapse

Methods inherited from ThorBase

add_shared_option, chef_server_names, cluster_template_names, config_key_collection, exit_on_failure?, #initialize, provider_names, provider_names_for, repo_names, run_cmd, run_knife_cmd, shared_options

Methods included from ReposHelper

#find_cluster, #find_cluster_pwds, #find_cluster_pwds_with_repo, #find_cluster_with_repo, #find_data_bag, #find_data_bag_item, #find_environment, #find_repo_item, #find_role, #get_cookbook_deps, #get_cookbook_meta, #get_cookbook_versions, #get_cookbooks, #get_dirty_cookbooks, #get_entry_dependencies, #get_modified_cookbooks, #git_diff, #is_dirty?, #modified?, #repo_cfg, #repo_clusters_dir, #repo_cookbook_paths, #repo_dir, #repo_names, #repo_paths, #repos_config, #repos_dir, #run_inside_repo_dir

Methods included from ProvidersHelper

#provider_availability_zones, #provider_config, #provider_credentials, #provider_for, #provider_names, #provider_names_for, #provider_regions, #provider_type, #providers_config

Methods included from Thor::Actions

#run

Constructor Details

This class inherits a constructor from Fhcap::ThorBase

Instance Method Details

#list_artifactsObject



70
71
72
73
# File 'lib/fhcap/component.rb', line 70

def list_artifacts
  require "fhcap/tasks/chef/cookbook/list_artifacts"
  Tasks::Chef::Cookbook::ListArtifacts.new(task_options(options.dup)).run
end

#update(component, version, build) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fhcap/component.rb', line 21

def update(component, version, build)

  artifact_cookbook = options[:cookbook] || component
  #1. Update artifact version
  Fhcap::CLI::Component.new.invoke(:update_artifact, [component, version, build], {cookbook: options[:cookbook], interactive: options[:interactive]}) if options['update-artifact']

  #2. Update config
  Fhcap::CLI::Component.new.invoke(:update_config, [component], {force: options[:force]}) if options['update-config']

  #3. Update cookbook
  Fhcap::CLI::Cookbook.new.invoke(:update, [], {dirty: true, level: options['level']}) if options['update-cookbook']

end

#update_artifact(component, version, build) ⇒ Object



39
40
41
42
# File 'lib/fhcap/component.rb', line 39

def update_artifact(component, version, build)
  require "fhcap/tasks/chef/cookbook/update_artifact"
  Tasks::Chef::Cookbook::UpdateArtifact.new(task_options(options.dup.merge({cookbook: options[:cookbook], component: component, version: version, build: build}))).run
end

#update_config(component) ⇒ Object



61
62
63
64
# File 'lib/fhcap/component.rb', line 61

def update_config(component)
  require "fhcap/tasks/chef/cookbook/update_config"
  Tasks::Chef::Cookbook::UpdateConfig.new(task_options(options.dup.merge({cookbook: component}))).run
end