code_lister 0.1.6 → 0.1.7

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: dfde1ca13e9439d3c3a32f17e99162355cb98dee
4
- data.tar.gz: 105d46aaeb7abb5bfd55d3c1b539474fe3614037
3
+ metadata.gz: e5802e933d268745ca6bc5c5f7f6e90cc2266b0c
4
+ data.tar.gz: c4b931df8b7538838f259c3f86df8b0163276f57
5
5
  SHA512:
6
- metadata.gz: 745702c17b9c5c68649907f280fc33e0955365382d5b760454c475a8fdce17e12881c7c0952f5b3110aa6a8574a4cb0739580e5c8ea2c74a9eb4235e73e8a37f
7
- data.tar.gz: d3c35b8ba4bc9209726bb169409dc193f1df13e63f219475e430190b3662a7762b159eb4ef3b4a10c822e8c93e09b65ee32c7e2d5dba3317677740a906954080
6
+ metadata.gz: ddbb984454b699da9a01c65aa88ca79bebcce6cd64f7a652e59bb5c1557439c02afeb664d87fa2cc61e8f706add4d37273f21b53afeddf5976ad0bcd5fce9389
7
+ data.tar.gz: 8e69327acbbc1278a14efafd6440fb2c167dacfa18dec1453e95ffc76aaaba40045affe6f5bc9744b6b08689ddd8d347259056f898246d3f9e253aa659ec90ff
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ### Changelogs
2
2
 
3
+ #### 0.1.7
4
+
5
+ - Add new api `files_from_shell` that replaces `prefix` with `.` string
6
+
3
7
  #### 0.1.6
4
8
 
5
9
  - Add internal api for getting input files from shell command
@@ -25,6 +25,20 @@ module CodeLister
25
25
  return []
26
26
  end
27
27
 
28
+ # Extract list of files from a given shell command
29
+ #
30
+ # @param [String] command the input command e.g. 'find . -type f -iname .."
31
+ # @param [String] prefix the prefix directory that will be replaced by '.' (dot string)
32
+ # @return [Array<String>] empty list or file list of the form ["./Gemfile", "./lib/codelister.rb", ..]
33
+ def files_from_shell(command, prefix)
34
+ prefix = File.expand_path(prefix) if prefix
35
+ unless prefix && File.directory?(prefix)
36
+ raise "'#{prefix}' is not valid prefix directory!"
37
+ end
38
+ files = files_from_command(command)
39
+ files.map! { |file| file.gsub(File.expand_path(prefix), ".") }
40
+ end
41
+
28
42
  # List files base on multiple simple criteria
29
43
  #
30
44
  # @param [Hash<Symbol>,<Object>] args argument hash
@@ -1,3 +1,3 @@
1
1
  module CodeLister
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code_lister
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Burin Choomnuan