pathdude 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/bin/pathdude +58 -0
  3. metadata +45 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2f123b2060a8ce3e8230730ba4deb6483e5464ef
4
+ data.tar.gz: 7c92e153e8b7729c316f430e6eaeab1ef8e3b0b6
5
+ SHA512:
6
+ metadata.gz: 37bc3390d7b65d07a8ab35414ace4e2e0f16e8b40c126e19b52e9f4382d87bd1e0951e32473aad9b776802a9f0d0b2882aeb1e1e32a43c8351e9eb005edcf4c0
7
+ data.tar.gz: 2502fc44dc42e26b03bdda6534fcdb99db3d47ebc7d8fdac7a6493c3dc23f78d4e5481119c50cbf32e26afc9832cb14e9511b4c1f2ebf300556b36b44a369fac
data/bin/pathdude ADDED
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'yaml'
4
+
5
+ HOME = ENV['HOME']
6
+ if not HOME then
7
+ print "$HOME unknown. You must have it set\n"
8
+ exit 1
9
+ end
10
+ CFG = HOME + "/.pathdude.yml"
11
+
12
+ only_abs = false
13
+ ARGV.each do |arg|
14
+ if arg =~ /--only-absolute/ then
15
+ only_abs = true
16
+ end
17
+ end
18
+
19
+ if not File.exists?(CFG) then
20
+ File.open(CFG, "w") do |f|
21
+ f.write("commands:\n")
22
+ f.write(" - git add\n")
23
+ f.write(" - git rm -rf\n")
24
+ end
25
+ end
26
+
27
+ g_config = []
28
+ File.open(CFG, "r") do |f|
29
+ g_config = YAML.load(f.read())
30
+ end
31
+
32
+ g_files = []
33
+ while line = $stdin.gets
34
+ chunks_raw = line.split(/[ \n\r\t]/)
35
+ g_files += chunks_raw.select{ |f| File.exists?(f) }
36
+ end
37
+
38
+ if g_config["header"] then
39
+ g_config["header"].each do |hdr|
40
+ print "# " + hdr + "\n"
41
+ end
42
+ end
43
+
44
+ print "# Path:\n"
45
+ g_files.each { |p| print "%s\n" % [File.realpath(p) ] }
46
+ exit 0 if only_abs
47
+
48
+ fst = true
49
+ g_config["commands"].each do |template|
50
+ if not fst then
51
+ print "\n\n# }}}\n"
52
+ end
53
+ fst = false
54
+ print "# --------------- #{template} --------------------- {{{\n"
55
+ g_files.each do |fn|
56
+ print "# #{template} #{fn}\n"
57
+ end
58
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pathdude
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Wojciech A. Koszek
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-09-17 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Pipe output of a command to PathDude, edit it and execute in the shell
14
+ email: wojciech@koszek.com
15
+ executables:
16
+ - pathdude
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/pathdude
21
+ homepage: http://github.com/wkoszek/pathdude
22
+ licenses:
23
+ - BSD
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.0.14
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: PathDude solves the problem of executing a command on multiple files
45
+ test_files: []