hackmac 1.4.0 → 1.4.2

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
  SHA256:
3
- metadata.gz: 7b280a3a7695d3ca2acc44f274d9602bcfccb8f24ea43a6e49b490830efed1e0
4
- data.tar.gz: a8fdf6d9ccaf9cf736218a10e462c4522139e938ef0677234fe48af3ea278179
3
+ metadata.gz: 6edb17b3e73dbb6bc5112bfd85a8bb50c32c9be7e860cc97d11f98bb6a2e9d04
4
+ data.tar.gz: 120072142fb649a5d2cd933e27c0f9b0aeaa6c0d68721ed392e1b39478ae66dd
5
5
  SHA512:
6
- metadata.gz: 6cb72a600ddd93ac37f453b952b49e748a40626f1405d89803a64401c8aee7331c800d5b07d699ec45132ce1a26aa0288f2969798a1dcb6b1ee7598e1a090584
7
- data.tar.gz: 32d42271e8814c01c80ac2ecb63d15080042abc9a2f265fccd82536680dbcfd17e595ba2cee78c05ee73a6595c41e0212a6ed834ca9c52929cb3ab40f595c633
6
+ metadata.gz: 5e78be62b57bdfe29961dd9ce3d334cfa7d6e1abdad8b30be9ecc9c2cd265d5543f992e0eaaf234b490e681e63c5b3f93252cd3c924c43ca3df1beb21df7d814
7
+ data.tar.gz: 219d7eaa6be7ad7776bc13417d5b6314f4b7cfaa99df876b84c33b2960cc60a331577abed1e6d7825feb4209e549de5eacf64c40fbe8b9535da40019f08a8d28
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.0
1
+ 1.4.2
data/hackmac.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: hackmac 1.4.0 ruby lib
2
+ # stub: hackmac 1.4.2 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "hackmac".freeze
6
- s.version = "1.4.0"
6
+ s.version = "1.4.2"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
@@ -2,22 +2,24 @@ require 'complex_config/shortcuts'
2
2
  require 'tins/xt/secure_write'
3
3
  require 'fileutils'
4
4
  require 'pathname'
5
+ require 'term/ansicolor'
5
6
 
6
7
  module Hackmac
7
8
  module Config
8
9
  extend FileUtils
9
10
  extend ComplexConfig::Provider::Shortcuts
11
+ extend Term::ANSIColor
10
12
 
11
13
  DEFAULT = File.read(File.join(File.dirname(__FILE__), 'hackmac.yml'))
12
14
 
13
- def self.load(path: ENV.fetch('CONFIG_PATH', '~/.config/hackmac/hackmac.yml'))
15
+ def self.load(path: ENV.fetch('HACKMAC_CONFIG', '~/.config/hackmac/hackmac.yml'))
14
16
  path = Pathname.new(path).expand_path
15
17
  mkdir_p path.dirname
16
18
  ComplexConfig::Provider.config_dir = path.dirname
17
19
  unless path.exist?
18
20
  File.secure_write(path.to_s, DEFAULT)
19
21
  end
20
- puts "Loading config from #{path.to_s.inspect}."
22
+ puts "Loading config from #{color(33) { path.to_s.inspect} }."
21
23
  ComplexConfig::Provider[path.basename.to_s.sub(/\..*?\z/, '')]
22
24
  end
23
25
  end
data/lib/hackmac/utils.rb CHANGED
@@ -13,17 +13,17 @@ module Hackmac
13
13
 
14
14
  def x(cmd, verbose: true)
15
15
  prompt = cmd =~ /\A\s*sudo/ ? ?# : ?$
16
+ print "#{prompt} #{cmd}".color(27)
17
+ puts verbose ? "" : " >/dev/null".yellow
16
18
  output = `#{cmd} 2>&1`
17
19
  if $?.success?
18
- print "#{prompt} #{cmd}".green
19
- puts verbose ? "" : " >/dev/null".yellow
20
+ puts " Command succeded!".green
20
21
  else
21
- print "#{prompt} #{cmd}".red
22
- puts verbose ? "" : " >/dev/null".yellow
23
- STDERR.puts "command #{cmd.inspect} failed with exit status #{$?.exitstatus}".on_red.white
22
+ puts "⚠️ Command #{cmd.inspect} failed with exit status #{$?.exitstatus}".on_red.white
23
+ exit $?.exitstatus
24
24
  end
25
25
  if verbose
26
- print output.italic
26
+ puts output.italic
27
27
  end
28
28
  output
29
29
  end
@@ -1,6 +1,6 @@
1
1
  module Hackmac
2
2
  # Hackmac version
3
- VERSION = '1.4.0'
3
+ VERSION = '1.4.2'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hackmac
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank