sym 2.8.0 → 2.8.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6053432fc439cae6524efafc83f10ef5eba1478b
4
- data.tar.gz: 07a5849debd54dbbbe0716ec72ce21de69b8947e
3
+ metadata.gz: 6581f31745ebc7a392cfe15954cca70429cd0074
4
+ data.tar.gz: befd74e55bbbe51c598247c0d5225e63d324cbaa
5
5
  SHA512:
6
- metadata.gz: 05dd00292348432a11a38fa22964016c949148e093ad8f0f5d71927455024aaf4d7b7ed113f71024d12e62858b9dceb75994f1281b7d0ee09eed4498c6238d6d
7
- data.tar.gz: 9f69a6b471db6173ff6e7f57d43e99340ddd3e68805e24374233048c686ed04bbb9bc79c7d2ae0eb5f32ab078c1abd2fdc43d907ba7a65b33dea160fc6a69007
6
+ metadata.gz: 41611c7b109e847d34df5fffa8ae575a68b199ca71eabb85e9569046fd71623146ba3dd08954c40c2d5802e2452b48913d776dd2d154986681c3b6615cd4d6cb
7
+ data.tar.gz: c1738bf30bd0e3c4b3870181759d12c9b9642c92940cbebd8ef0acbac5c3ace69ffe49c02685635ec7ca992366e4c954d6d00c345a6753fa750fdf4837601320
data/.circleci/config.yml CHANGED
@@ -25,7 +25,7 @@ jobs:
25
25
 
26
26
  - save_cache:
27
27
  paths:
28
- - ./vendor/bundle
28
+ - ./vendor/bundle
29
29
  key: v1-dependencies-{{ checksum "Gemfile.lock" }}
30
30
 
31
31
  - run:
@@ -36,8 +36,6 @@ jobs:
36
36
  memcached -d || true
37
37
  echo "checking if memcached is running...."
38
38
  ps -ef | grep [m]emcached
39
- # echo 'stats' | nc localhost 11211
40
- # echo "if we see the stats, memcached is running!"
41
39
 
42
40
  - run:
43
41
  name: install sym bash helpers
@@ -11,21 +11,14 @@
11
11
  ( [[ -n $ZSH_EVAL_CONTEXT && $ZSH_EVAL_CONTEXT =~ :file$ ]] || \
12
12
  [[ -n $BASH_VERSION && $0 != "$BASH_SOURCE" ]]) && _s_=1 || _s_=0
13
13
 
14
- bash_version=$(/usr/bin/env bash --version | awk '{FS="version"}{print $4}')
14
+ bash_version=$(bash --version | awk '{FS="version"}{print $4}')
15
15
  bash_version=${bash_version:0:1}
16
16
 
17
- if [[ "${bash_version}" -lt 4 ]]; then
18
- echo "Sym BASH helpers are incompatible with BASH version 3 or older."
19
- echo "Please upgrade your BASH to version 4+ released in 2009. Srsly."
20
- (( $_s_ )) && return 1
21
- (( $_s_ )) || exit 1
22
- fi
23
-
24
17
  declare -a bash_completion_locations=(/usr/local/etc/bash_completion /usr/etc/bash_completion /etc/bash_completion)
25
18
  loaded=false
26
19
  for file in ${bash_completion_locations[@]}; do
27
- [[ -s $file ]] && {
28
- source $file
20
+ [[ -s ${file} ]] && {
21
+ source ${file}
29
22
  break
30
23
  }
31
24
  done
@@ -49,14 +49,6 @@
49
49
  (( $_s_ )) && _is_sourced=1
50
50
  (( $_s_ )) || _is_sourced=0
51
51
 
52
- bash_version=$(/usr/bin/env bash --version | awk '{FS="version"}{print $4}')
53
- bash_version=${bash_version:0:1}
54
-
55
- if [[ "${bash_version}" -lt 4 ]]; then
56
- (( $_s_ )) && return 1
57
- (( $_s_ )) || exit 1
58
- fi
59
-
60
52
  function __lib::color::setup() {
61
53
  if [[ -z "${setup_colors_loaded}" ]]; then
62
54
 
@@ -106,6 +98,21 @@ function __lib::color::setup() {
106
98
  fi
107
99
  }
108
100
 
101
+ ((${setup_colors_loaded})) ||__lib::color::setup
102
+
103
+ (( $_s_ )) || {
104
+ printf "${bldred}This script is meant to be sourced into your environment,\n"
105
+ printf "not run on a command line.${clr} \n\n"
106
+
107
+ printf "Please add 'source $0' to your BASH initialization file,\n"
108
+ printf "or run the following command:\n\n"
109
+
110
+ printf " \$ ${bldgrn}sym -B ~/.bash_profile${clr}\n\n"
111
+
112
+ printf "${bldblu}Thanks for using Sym!${clr}\n"
113
+ exit 1
114
+ }
115
+
109
116
  function __lib::color::hr() {
110
117
  local cols=${1:-${COLUMNS}}
111
118
  local char=${2:-"—"}
@@ -137,23 +144,6 @@ function __lib::color::cursor_to_row() {
137
144
  echo -en "\e[${position}H"
138
145
  }
139
146
 
140
- ((${setup_colors_loaded})) ||__lib::color::setup
141
-
142
-
143
- (( $_s_ )) || {
144
- printf "${bldred}This script is meant to be sourced into your environment,\n"
145
- printf "not run on a command line.${clr} \n\n"
146
-
147
- printf "Please add 'source $0' to your BASH initialization file,\n"
148
- printf "or run the following command:\n\n"
149
-
150
- printf " \$ ${bldgrn}sym -B ~/.bash_profile${clr}\n\n"
151
-
152
- printf "${bldblu}Thanks for using Sym!${clr}\n"
153
- exit 1
154
-
155
- }
156
-
157
147
  function __symit::init() {
158
148
  export SYMIT__EXTENSION=${SYMIT__EXTENSION:-'.enc'}
159
149
  export SYMIT__FOLDER=${SYMIT__FOLDER:-'.'}
@@ -282,6 +272,7 @@ function __symit::install::gem() {
282
272
  fi
283
273
  fi
284
274
  }
275
+
285
276
  function __symit::files() {
286
277
  eval $(__symit::files::cmd)
287
278
  }
@@ -392,7 +383,6 @@ function __symit::validate_args() {
392
383
  }
393
384
 
394
385
  function __symit::run() {
395
-
396
386
  __symit::cleanup
397
387
  __symit::init
398
388
 
@@ -560,6 +550,7 @@ function __symit::run() {
560
550
  fi
561
551
  fi
562
552
  }
553
+
563
554
  function symit() {
564
555
  __symit::run $@
565
556
  }
@@ -8,7 +8,7 @@ module Sym
8
8
  try_after :generate_key, :open_editor, :encrypt, :decrypt
9
9
 
10
10
  def ok
11
- '[OK]'.bold.green
11
+ ' '.bold.green
12
12
  end
13
13
 
14
14
  def execute
@@ -17,12 +17,15 @@ module Sym
17
17
  out = ''
18
18
  Sym::Constants::Bash::Config.each_pair do |key, config|
19
19
  script_name = key.to_s
20
- if (!File.exist?(config[:dest])) ||
21
- (File.exist?(config[:dest]) && !FileUtils.identical?(config[:source], config[:dest]))
22
- FileUtils.cp(config[:source], config[:dest])
23
- out << "#{} installing #{config[:dest].bold.blue }...\n"
24
- else
20
+
21
+ # This removes the old version of this file.
22
+ remove_old_version(out, config[:dest])
23
+
24
+ if File.exist?(config[:dest]) && File.read(config[:source]) == File.read(config[:dest])
25
25
  out << "#{ok} file #{config[:dest].bold.blue } exists, and is up to date.\n"
26
+ else
27
+ FileUtils.cp(config[:source], config[:dest])
28
+ out << "#{ok} installing #{config[:dest].bold.blue }...\n"
26
29
  end
27
30
 
28
31
  out << if File.exist?(file)
@@ -51,6 +54,15 @@ module Sym
51
54
  end
52
55
  end
53
56
 
57
+ def remove_old_version(out, file)
58
+ if file =~ /\.bash$/
59
+ old_file = file.gsub(/\.bash$/, '')
60
+ if File.exist?(old_file)
61
+ out << "Removing old version — #{old_file.bold.magenta}..."
62
+ FileUtils.rm_f old_file
63
+ end
64
+ end
65
+ end
54
66
  end
55
67
  end
56
68
  end
data/lib/sym/constants.rb CHANGED
@@ -2,19 +2,33 @@ require 'logger'
2
2
  module Sym
3
3
  module Constants
4
4
  module Bash
5
+
6
+ BASH_FILES = Dir.glob("#{File.expand_path('../../../bin', __FILE__)}/sym.*.bash").freeze
7
+
5
8
  Config = {}
6
9
 
7
- BASH_FILES = Dir.glob("#{File.expand_path('../../../bin', __FILE__)}/sym.*").freeze
8
- BASH_FILES.each do |bash_file|
9
- source_file = File.basename(bash_file)
10
- home_file = "#{ENV['HOME']}/.#{source_file}"
10
+ class << self
11
+ def register_bash_files!
12
+ BASH_FILES.each do |bash_file|
13
+ register_bash_extension bash_file, Config
14
+ end
15
+ end
16
+
17
+ private
11
18
 
12
- Config[source_file.gsub(/sym\./, '').to_sym] = {
13
- dest: home_file,
14
- source: bash_file,
15
- script: "[[ -f #{home_file} ]] && source #{home_file}"
16
- }
19
+ def register_bash_extension(bash_file, hash)
20
+ source_file = File.basename(bash_file)
21
+ home_file = "#{Dir.home}/.#{source_file}"
22
+
23
+ hash[source_file.gsub(/sym\./, '').gsub(/\.bash/, '').to_sym] = {
24
+ dest: home_file,
25
+ source: bash_file,
26
+ script: "[[ -f #{home_file} ]] && source #{home_file}"
27
+ }
28
+ end
17
29
  end
30
+
31
+ self.register_bash_files!
18
32
  end
19
33
 
20
34
  module Log
@@ -24,5 +38,6 @@ module Sym
24
38
 
25
39
  ENV_ARGS_VARIABLE_NAME = 'SYM_ARGS'.freeze
26
40
  SYM_KEY_FILE = "#{ENV['HOME']}/.sym.key"
41
+
27
42
  end
28
43
  end
data/lib/sym/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Sym
2
- VERSION = '2.8.0'
2
+ VERSION = '2.8.1'
3
3
  DESCRIPTION = <<-eof
4
4
  Sym is a ruby library (gem) that offers both the command line interface (CLI) and a set of rich Ruby APIs, which make it rather trivial to add encryption and decryption of sensitive data to your development or deployment flow. As a layer of additional security, you can encrypt the private key itself with a password. Unlike many other existing encryption tools, Sym focuses on getting out of the way — by offering its streamlined interface, hoping to make encryption of application secrets nearly completely transparent to the developers. For the data encryption Sym uses a symmetric 256-bit key with the AES-256-CBC cipher, same cipher as used by the US Government. For password-protecting the key Sym uses AES-128-CBC cipher. The resulting data is zlib-compressed and base64-encoded. The keys are also base64 encoded for easy copying/pasting/etc.
5
5
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sym
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.0
4
+ version: 2.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Gredeskoul
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-06 00:00:00.000000000 Z
11
+ date: 2018-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored2
@@ -270,8 +270,8 @@ files:
270
270
  - SYM-CLI.md
271
271
  - bin/console
272
272
  - bin/setup
273
- - bin/sym.completion
274
- - bin/sym.symit
273
+ - bin/sym.completion.bash
274
+ - bin/sym.symit.bash
275
275
  - design/ascii-cinema.png
276
276
  - design/sym-class-dependency-future-refactor.png
277
277
  - design/sym-class-dependency.graffle