arcanus 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/arcanus.rb +0 -1
- data/lib/arcanus/command/diff.rb +35 -0
- data/lib/arcanus/command/show.rb +6 -1
- data/lib/arcanus/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8575f8a22c444666c7442acbdd8c57e7f6b69097
|
4
|
+
data.tar.gz: 275c2b13e0cd12e4ab752e16995b733eac412823
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcf188423860de011f8baf0b51c0fd497c1a60a1121035000df44daade3300b673dbe7e33819dc9235e360ff683b3396a17bb47d67016244e6d82204b7c53082
|
7
|
+
data.tar.gz: 586375c09267f2b2c2339ef83f90f6f2f1593c6ef06d13cedc03f279d73f91766594ffe6464143f96a53c3b42c534278c964850e3ac3074c10875471e9cf1b03
|
data/lib/arcanus.rb
CHANGED
@@ -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
|
data/lib/arcanus/command/show.rb
CHANGED
@@ -14,7 +14,12 @@ module Arcanus::Command
|
|
14
14
|
|
15
15
|
if arguments.size > 1
|
16
16
|
# Print specific key
|
17
|
-
|
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)
|
data/lib/arcanus/version.rb
CHANGED
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.
|
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-
|
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
|