cheftacular 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87ef04da7a57c27f4d32d916d3a1a150703ad141
4
- data.tar.gz: 01a0e89d89622d64ef6850c9435fa043235cc73c
3
+ metadata.gz: de48354bd1ec85f816c861050cd49feafabdc874
4
+ data.tar.gz: 6b7870f9aaf06cc78e48a6628302e64cfdfefe0a
5
5
  SHA512:
6
- metadata.gz: 474988b6d52df16f2d31f9f3597035b05bb94691ee5e27b43b44b01bad916efee713807574c98b53bc4a7fedb997c08b6db7b59302a35fbe993b0d50e69de8ed
7
- data.tar.gz: 825348d57504b5abc2a2665fcf26fdfb2197739bab7d3e2d729d2980ce91e5267dca0cfd1cf28a0da1af0d511308ab04261dcf9fa2b11efcc2fb39d548623898
6
+ metadata.gz: 2c465e268d416e318c181ea3f67bb15aeb554bd5c6f6b96b2cecdeefdb5694b3903e6a007cf9804626a4250cf9fda8f1d124e18eef0353607835e56b265c3fed
7
+ data.tar.gz: eea0fd5fd016033c479b5595b25327600f84eb441dc078df685e75be4eec7fc627319ecb1f8c5c6548d8038d758e093ab74ea9a0571863cc3de3af19ed78ef56
@@ -40,6 +40,8 @@ class Cheftacular
40
40
 
41
41
  ret_hash
42
42
  rescue StandardError => exception
43
+ @config['helper'].cleanup_file_caches('current-audit-only')
44
+
43
45
  @config['helper'].exception_output "Unable to finish parsing auditing hash", exception
44
46
  end
45
47
  end
@@ -239,7 +239,7 @@ class Cheftacular
239
239
  current_file_path 'node_cache'
240
240
  end
241
241
 
242
- def cleanup_file_caches mode='old'
242
+ def cleanup_file_caches mode='old', check_current_day_entry=false
243
243
  base_dir = File.join( @config['locs']['app-root'], 'tmp', declassify )
244
244
 
245
245
  Dir.entries(base_dir).each do |entry|
@@ -248,10 +248,10 @@ class Cheftacular
248
248
  case mode
249
249
  when 'old'
250
250
  FileUtils.rm("#{ base_dir }/#{ entry }") if File.file?("#{ base_dir }/#{ entry }") && !entry.include?(Time.now.strftime("%Y%m%d"))
251
-
252
- check_current_day_entry = false
253
251
  when 'current'
254
252
  check_current_day_entry = true
253
+ when 'current-audit-only'
254
+ FileUtils.rm("#{ base_dir }/#{ entry }") if File.file?("#{ base_dir }/#{ entry }") && entry.include?(Time.now.strftime("%Y%m%d"))
255
255
  end
256
256
 
257
257
 
@@ -13,13 +13,15 @@ class Cheftacular
13
13
 
14
14
  class StatelessAction
15
15
  def help inference_modes=[]
16
- target_command = @options['command'] == 'help' ? ARGV[1] : ARGV[0]
17
- target_command = @config['cheftacular']['mode'] if target_command == 'current'
16
+ target_command = @options['command'] == 'help' ? ARGV[1] : ARGV[0]
17
+ target_command = @config['cheftacular']['mode'] if target_command == 'current'
18
+ target_command ||= ''
18
19
 
19
20
  case target_command
20
21
  when 'action' then inference_modes << 'action'
21
22
  when 'application' || 'devops' then inference_modes << 'both'
22
23
  when 'stateless_action' then inference_modes << 'stateless_action'
24
+ when '' then inference_modes << 'both'
23
25
  end
24
26
 
25
27
  if @config['helper'].is_command? target_command
@@ -38,7 +40,7 @@ class Cheftacular
38
40
 
39
41
  end if inference_modes.include?('action') || inference_modes.include?('both')
40
42
 
41
- @config['stateless_action_documentation'].instance_methods(false).each do |method|
43
+ @config['stateless_action_documentation'].public_methods(false).each do |method|
42
44
  @config['stateless_action_documentation'].send(method)
43
45
 
44
46
  end if inference_modes.include?('stateless_action') || inference_modes.include?('both')
@@ -49,15 +51,13 @@ class Cheftacular
49
51
 
50
52
  puts @config['helper'].compile_documentation_lines('stateless_action').flatten.join("\n\n") if target_command == 'stateless_action'
51
53
 
52
- puts @config['helper'].compile_documentation_lines('application').flatten.join("\n\n") if target_command == 'application'
54
+ puts @config['helper'].compile_documentation_lines('application').flatten.join("\n\n") if target_command == 'application' || target_command.empty?
53
55
 
54
56
  puts @config['helper'].compile_documentation_lines('devops').flatten.join("\n\n") if target_command == 'devops'
55
57
 
56
58
  if inference_modes.empty? && @config['helper'].is_not_command_or_stateless_command?(target_command)
57
59
  methods = @config['action_documentation'].public_methods(false) + @config['action_documentation'].public_methods(false)
58
60
 
59
- puts methods.sort
60
-
61
61
  sorted_methods = methods.uniq.sort_by { |method| @config['helper'].compare_strings(target_command, method.to_s)}
62
62
 
63
63
  puts "Unable to find documentation for #{ target_command }, did you mean:"
@@ -1,5 +1,5 @@
1
1
  class Cheftacular
2
2
  #major_version.minor_version.bugfixes
3
- VERSION = "2.0.1"
3
+ VERSION = "2.0.2"
4
4
  RUBY_VERSION = "2.2.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cheftacular
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Louis Alridge