arcanus 0.8.0 → 0.9.0

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: 0622bb6c08b521200c277db4f6e39f6efcc12d67
4
- data.tar.gz: 89dcd338be1abb4bbbcba841b7f3df3f11ac13ba
3
+ metadata.gz: 8575f8a22c444666c7442acbdd8c57e7f6b69097
4
+ data.tar.gz: 275c2b13e0cd12e4ab752e16995b733eac412823
5
5
  SHA512:
6
- metadata.gz: 4fdfbba87c123002c65861704d34a5be103af1c3df81c7cdf17abe9ac65eb8e5341b1b604822ed716cb850d9db7f62a9f0de12ecb2a9d6b2d85b0ad04caf5598
7
- data.tar.gz: 9a92ac4f7892d688e23b64b3f257f0f950ffdbac05ae1f2510bc97b9c7d5ea3abcdf89149c0845f00d4885fa4f58455f996f5c47a7ec617f937d9c416c97a0e4
6
+ metadata.gz: fcf188423860de011f8baf0b51c0fd497c1a60a1121035000df44daade3300b673dbe7e33819dc9235e360ff683b3396a17bb47d67016244e6d82204b7c53082
7
+ data.tar.gz: 586375c09267f2b2c2339ef83f90f6f2f1593c6ef06d13cedc03f279d73f91766594ffe6464143f96a53c3b42c534278c964850e3ac3074c10875471e9cf1b03
@@ -41,7 +41,6 @@ module Arcanus
41
41
  key = Arcanus::Key.from_file(@repo.unlocked_key_path)
42
42
  elsif ENV['ARCANUS_PASSWORD']
43
43
  key = Arcanus::Key.from_protected_file(@repo.locked_key_path, ENV['ARCANUS_PASSWORD'])
44
- ENV.delete('ARCANUS_PASSWORD') # Scrub so child processes don't inherit
45
44
  else
46
45
  raise Errors::UsageError,
47
46
  'Arcanus key has not been unlocked. ' \
@@ -0,0 +1,35 @@
1
+ require_relative 'shared/ensure_key'
2
+ require 'diffy'
3
+ require 'tempfile'
4
+
5
+ module Arcanus::Command
6
+ class Diff < Base
7
+ include Shared::EnsureKey
8
+
9
+ description 'Shows what was changed in the chest'
10
+
11
+ def execute
12
+ ensure_key_unlocked
13
+
14
+ ref = arguments[1] || 'HEAD'
15
+
16
+ tempfile = ::Tempfile.new(['old-arcanus-chest', '.yaml']).tap do |file|
17
+ # This will gracefully return an empty string if it doesn't exist
18
+ old_content = `git show #{ref}:#{Arcanus::CHEST_FILE_PATH} 2>/dev/null`.strip
19
+
20
+ file.sync = true
21
+ if old_content.empty?
22
+ file.write({}.to_yaml)
23
+ else
24
+ file.write(old_content)
25
+ end
26
+ end
27
+
28
+ key = Arcanus::Key.from_file(repo.unlocked_key_path)
29
+ old = Arcanus::Chest.new(key: key, chest_file_path: tempfile).to_yaml
30
+ current = Arcanus::Chest.new(key: key, chest_file_path: repo.chest_file_path).to_yaml
31
+
32
+ ui.print(::Diffy::Diff.new(old, current, context: 1).to_s(:color), newline: false)
33
+ end
34
+ end
35
+ end
@@ -14,7 +14,12 @@ module Arcanus::Command
14
14
 
15
15
  if arguments.size > 1
16
16
  # Print specific key
17
- ui.print chest.get(arguments[1])
17
+ value = chest.get(arguments[1])
18
+ if value.is_a?(Hash)
19
+ output_colored_hash(value)
20
+ else
21
+ ui.print value
22
+ end
18
23
  else
19
24
  # Print entire hash
20
25
  output_colored_hash(chest.to_hash)
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module Arcanus
5
- VERSION = '0.8.0'.freeze
5
+ VERSION = '0.9.0'.freeze
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arcanus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane da Silva
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-02 00:00:00.000000000 Z
11
+ date: 2016-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: childprocess
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.5.6
27
+ - !ruby/object:Gem::Dependency
28
+ name: diffy
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.1'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: tty
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -51,6 +65,7 @@ files:
51
65
  - lib/arcanus/chest.rb
52
66
  - lib/arcanus/cli.rb
53
67
  - lib/arcanus/command/base.rb
68
+ - lib/arcanus/command/diff.rb
54
69
  - lib/arcanus/command/edit.rb
55
70
  - lib/arcanus/command/export.rb
56
71
  - lib/arcanus/command/help.rb