terraspace 0.3.5 → 0.3.6

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
  SHA256:
3
- metadata.gz: 7bb02485a9ee2b429e36b562fc8ba36946472776c1cabd234db2d0fd210c830b
4
- data.tar.gz: 972a0074d2528352bfcb596f608e883fb47a673202db1a00ef6de25d6d63408f
3
+ metadata.gz: 28bdb53824befd6a98263c63612db913c5496546ef751ed408500b4140ac57c4
4
+ data.tar.gz: fe844bdeb2dacfbecfa954a912bfa4ef3e5b4e6265d2eea697d072d8533b2fd5
5
5
  SHA512:
6
- metadata.gz: 06c10d199374f6d9b1ceac52f89fddc1b3b57402037e212e357622e7647c37a31959098cde5ecbee9f42b501f792bab85b702641bbb3ae692fe86b8e96fbdb07
7
- data.tar.gz: 8b8e1cf28734fc14ac8e4aa27ba626bb82f5f685ac39688f737ceacfdf6fcfef59ac7a4198292ce41b314d3b73faed166c50bc22ebb00a05d0b305d195160053
6
+ metadata.gz: 7e01f4b80088de2c7a3f3f1c8ac81a401b4a999cbb3fbc4af78651ee8e1788246dcb8b889172b94ea5ff7a7932a4874f27e225f66dedac2603a5752a20fb383c
7
+ data.tar.gz: c0ca89b09e3d8ca3f36f6d2f513fedbaa29aad071af4c4c6e99c38438b8c2002582adaa49b2f7105becde5e2ac21785a7f5617b9c5fd1fd60ea25fbaadda7a54
@@ -3,6 +3,9 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [0.3.6]
7
+ * #44 improve logs management commands: `terraspace logs remove` and `terraspace logs truncate`
8
+
6
9
  ## [0.3.5]
7
10
  * #43 rename `terraform_output` helper to `output`. Keep `terraform_output` for backwards compatibility
8
11
  * to_ruby natural interface to access output with full power of Ruby
@@ -1,5 +1,7 @@
1
1
  class Terraspace::CLI
2
2
  class Logs < Terraspace::Command
3
+ class_option :yes, aliases: :y, type: :boolean, desc: "bypass are you sure prompt"
4
+
3
5
  desc "truncate", "Truncates logs. IE: Keeps the files but removes contents and zero bytes the files."
4
6
  long_desc Help.text("logs/truncate")
5
7
  def truncate
@@ -1,17 +1,21 @@
1
1
  class Terraspace::CLI::Logs
2
2
  class Tasks
3
+ include Terraspace::Util::Sure
4
+
3
5
  def initialize(options={})
4
6
  @options = options
7
+ Terraspace.check_project!
5
8
  end
6
9
 
7
10
  def truncate
8
- puts "Truncating log files in #{pretty_log_root}/" unless @options[:mute]
11
+ are_you_sure?("truncate")
9
12
  log_files.each do |path|
10
13
  File.open(path, "w").close # truncates files
11
14
  end
12
15
  end
13
16
 
14
17
  def remove
18
+ are_you_sure?("remove")
15
19
  puts "Removing all files in #{pretty_log_root}/" unless @options[:mute]
16
20
  FileUtils.rm_rf(log_root)
17
21
  FileUtils.mkdir_p(log_root)
@@ -28,5 +32,13 @@ class Terraspace::CLI::Logs
28
32
  def log_root
29
33
  Terraspace.config.log.root
30
34
  end
35
+
36
+ def are_you_sure?(action)
37
+ message = <<~EOL.chomp
38
+ Will #{action} all the log files in #{pretty_log_root}/ folder
39
+ Are you sure?
40
+ EOL
41
+ sure?(message) # from Util::Sure
42
+ end
31
43
  end
32
44
  end
@@ -1,3 +1,3 @@
1
1
  module Terraspace
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terraspace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-29 00:00:00.000000000 Z
11
+ date: 2020-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport