central 0.2.9 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/central +15 -2
  3. data/lib/central.rb +17 -1
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ecf6eb46fbc67795241445bc38629214a0d9eb2b63237f3ade4ccc5009b2eb4f
4
- data.tar.gz: d105df04c79771d9ae767c471185ec80147fbf7db6d552affa7d01185e4fe965
3
+ metadata.gz: 9ac8e8ea400a706c511823313cf3832bc3fde937077e8388e0b79e03ccb6f2e3
4
+ data.tar.gz: 8174b7da6cadf72d7c3aa3c5a1ed11fe87ed11413029e7de71712c307746e0ac
5
5
  SHA512:
6
- metadata.gz: b3ec6fa7e823098fc75b55c66399b25da990bc3bdb58d9f54b1c9cb7f26b00eb123699c6772800cfc54aa68826b6152b61284c76555dd248183fbb2d9b497010
7
- data.tar.gz: 5501d4249660a4d1d288aa6421439045f1ba66da1c316c62517a09d0ed1e7fb14f99f40fbef82966ae7d12ce411c61d0411f64872e4ace77bfdd2c52087ddd11
6
+ metadata.gz: 270220f138029359a37a99d8b79d22a9484d05fd8a0a01efea438031f17b10a3497c98a845a98ba9ef2f36838557f81b2a00f3e318e8ee2eb93cbbf4a5c2223d
7
+ data.tar.gz: 6d6b11e171213305af47dcc4dd351c8f1abe4ab841f37ca870d549ed6251bff677766dc49ec7263baa33c34282a416061b8c5d7cf85b0166fa839d209f38f916
@@ -9,7 +9,7 @@
9
9
  require 'central'
10
10
  require 'optparse'
11
11
 
12
- VERSION = 'v0.2.9'
12
+ VERSION = 'v0.3.0'
13
13
 
14
14
  options = {:color => true}
15
15
  OptionParser.new do |opts|
@@ -22,6 +22,10 @@ Description: if directory is specified it will use configuration.rb file inside
22
22
  it will use configuration.rb in current working directory
23
23
 
24
24
  Options:}
25
+ opts.on("-i", "--irb", "Start interactive IRB REPL") do |_|
26
+ options[:irb] = true
27
+ end
28
+
25
29
  opts.on("-m", "--monitor", "Monitor erb files for changes and reprocess them automatically") do |_|
26
30
  options[:monitor] = true
27
31
  end
@@ -36,7 +40,16 @@ Options:}
36
40
  end
37
41
  end.parse!
38
42
 
39
- if options[:monitor]
43
+ if options[:irb]
44
+ require 'irb'
45
+ $colored = true
46
+ $colored = options[:color] if options[:color]
47
+ info "Welcome to central #{VERSION} IRB repl, interactive playground for your dotcentral configuration"
48
+ info "Please ignore warning below as central has source function, and IRB tries to create alias for irb_source"
49
+ info "In order to use IRB's source functionality just call it without alias as irb_source"
50
+ ARGV.clear
51
+ IRB.start(__FILE__)
52
+ elsif options[:monitor]
40
53
  run_central(ARGV,options[:color])
41
54
  run_monitors
42
55
  else
@@ -72,6 +72,10 @@ def osx?
72
72
  os == 'osx'
73
73
  end
74
74
 
75
+ def macos?
76
+ os == 'osx'
77
+ end
78
+
75
79
  def freebsd?
76
80
  os == 'freebsd'
77
81
  end
@@ -202,7 +206,19 @@ def dir_exists?(path)
202
206
  Dir.exist?(path)
203
207
  end
204
208
 
205
- # get directory name of a file
209
+ # get file name of a path, optionally strip suffix if needed
210
+ def file_name(path, strip_suffix: '')
211
+ File.basename(abs(path), strip_suffix)
212
+ end
213
+
214
+ # get file suffix of a path
215
+ def file_suffix(path)
216
+ path = file_name(path)
217
+ suffix_index = path =~ /\.[^.]+$/
218
+ return path[suffix_index, path.size - suffix_index] if suffix_index
219
+ end
220
+
221
+ # get directory name of a path
206
222
  def file_dir(path)
207
223
  File.dirname(abs(path))
208
224
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: central
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Geurkov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-31 00:00:00.000000000 Z
11
+ date: 2021-01-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: central dotfile management system
14
14
  email: d.geurkov@gmail.com
@@ -38,7 +38,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
40
  requirements: []
41
- rubygems_version: 3.1.4
41
+ rubygems_version: 3.2.3
42
42
  signing_key:
43
43
  specification_version: 4
44
44
  summary: central dotfile management