class ItamaeSpec::Task::LocalServerspecTask
Constants
- ChangeTargetError
- LoadSpecError
Public Instance Methods
create_spec_command(node_name, hash)
click to toggle source
# File lib/itamae-spec/task/local_serverspec_task.rb, line 9 def create_spec_command(node_name, hash) ENV['TARGET_HOST'] = if hash[:environments][:local_ipv4].nil? hash[:environments][:hostname] else hash[:environments][:local_ipv4] end ENV['NODE_FILE'] = "tmp-nodes/#{node_name}.json" ENV['SUDO_PASSWORD'] = hash[:environments][:sudo_password] ENV['LOCAL_MODE'] = 'enable local mode' command = 'bundle exec rspec' end
list_recipe_filepath(run_list)
click to toggle source
# File lib/itamae-spec/task/local_serverspec_task.rb, line 23 def list_recipe_filepath(run_list) recipes = [] run_list.each do |recipe| target_list = Dir.glob("cookbooks/#{recipe.keys.join}/spec/#{recipe.values.join}_spec.rb") raise LoadSpecError, "#{recipe.to_a.join('::')} cookbook or spec does not exist." if target_list.empty? target_list.each do |target| recipes << " #{target}" end end recipes end