upm 0.1.12 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3bca79b16263ae9e7ac025695b61ec7bd88f81334b15564611e3f6977861ddcc
4
- data.tar.gz: cbba1be68aa1f5deb00d59a0ec72ef912a790f04f2cccb7f185f6931eb8d76ad
3
+ metadata.gz: 675637d1104dcbf53a07642dcce7385e24d83019730394a28662aba0146e6445
4
+ data.tar.gz: '04598f9d40c671d90ff4a129cae40426ed33c332632a570366d238159a4156fb'
5
5
  SHA512:
6
- metadata.gz: 9642d123de6aaf546cc328c18ef942e0883bc526d53fe6eefd28cc10573220dccc9a1e6a308e68559459b3d2e22b2161cbda623b147095b3114ba97f711b6126
7
- data.tar.gz: 9439866b904f66b394f9680c03bf8e77646bd493012696de2fd64335b38fed05263dda5ca04ed482dfd26a2d0e6a5628fbe57eb65da1c3409d54678b9bb552ef
6
+ metadata.gz: 1b7503c5afe5f88a482611ca8dc9b05a1189571522e4b7c5234e4651f15e418fe106e9ec627ab164aa0edc9bf6584004e1415bcbbc068e2cdff93bea5889eb94
7
+ data.tar.gz: 569590e5f1e8298a63ea04cfa784c52316868535acf40f1f74f8c1307b3708ffe5ae1cc0330f27efdd8359eb7a6e3f10279d51d146505d404dc9031071a422f7
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.12
1
+ 0.1.13
@@ -46,19 +46,42 @@ def lesspipe(*args)
46
46
  end
47
47
 
48
48
  params = []
49
- params << "-R" unless options[:color] == false
50
- params << "-S" unless options[:wrap] == true
51
- params << "-F" unless options[:always] == true
52
- params << "-X"
53
-
54
- if regexp = options[:search]
55
- params << "+/#{regexp}"
56
- elsif options[:tail] == true
57
- params << "+\\>"
58
- $stderr.puts "Seeking to end of stream..."
49
+
50
+ less_bin = File.which("less")
51
+
52
+ if File.symlink?(less_bin) and File.readlink(lessbin)[/busybox$/]
53
+ # busybox less only supports one option!
54
+ params << "-S" unless options[:wrap] == true
55
+ else
56
+ # authentic less
57
+ params << "-R" unless options[:color] == false
58
+ params << "-S" unless options[:wrap] == true
59
+ params << "-F" unless options[:always] == true
60
+ params << "-X"
61
+ params << "-I"
62
+
63
+ if regexp = options[:search]
64
+ params << "+/#{regexp}"
65
+ elsif options[:tail] == true
66
+ params << "+\\>"
67
+ $stderr.puts "Seeking to end of stream..."
68
+ end
59
69
  end
60
70
 
61
- IO.popen("less #{params * ' '}", "w") do |less|
71
+ env = {
72
+ "LESS_TERMCAP_mb" => "\e[01;31m",
73
+ "LESS_TERMCAP_md" => "\e[01;37m",
74
+ "LESS_TERMCAP_me" => "\e[0m",
75
+ "LESS_TERMCAP_se" => "\e[0m",
76
+ # "LESS_TERMCAP_so" => "\e[30;44m", # highlight: black on blue
77
+ "LESS_TERMCAP_so" => "\e[01;44;33m", # highlight: bright yellow on blue
78
+ # "LESS_TERMCAP_so" => "\e[30;43m", # highlight: black on yellow
79
+ "LESS_TERMCAP_ue" => "\e[0m",
80
+ "LESS_TERMCAP_us" => "\e[01;32m",
81
+ }
82
+
83
+ IO.popen(env, [less_bin, *params], "w") do |less|
84
+ # less.puts params.inspect
62
85
  if output
63
86
  less.puts output
64
87
  else
@@ -17,9 +17,9 @@ module UPM
17
17
  @cmds ||= {}
18
18
 
19
19
  if block_given?
20
-
20
+
21
21
  if root and Process.uid != 0
22
- exec("sudo", $PROGRAM_NAME, *ARGV)
22
+ @cmds[name] = proc { exec("sudo", $PROGRAM_NAME, *ARGV) }
23
23
  else
24
24
  @cmds[name] = block
25
25
  end
@@ -33,7 +33,7 @@ module UPM
33
33
  end
34
34
 
35
35
  @cmds[name] = proc do |args|
36
- query = highlight ? args.join("\\\\s+") : nil
36
+ query = highlight ? args.join("\\s+") : nil
37
37
  run(*shell_command, *args, paged: paged, root: root, highlight: query)
38
38
  end
39
39
 
@@ -0,0 +1,23 @@
1
+ UPM::Tool.new "apk" do
2
+
3
+ os "alpine"
4
+
5
+ command "install", "apk add", root: true
6
+ command "update", "apk update", root: true
7
+ command "upgrade", "apk upgrade", root: true
8
+
9
+ command "files", "apk info -L", paged: true
10
+ command "search", "apk search", paged: true
11
+
12
+ command "clean", "apk clean"
13
+
14
+ command "list" do |args|
15
+ if args.any?
16
+ query = args.join
17
+ run "apk", "info", grep: query, paged: true
18
+ else
19
+ run "apk", "info", paged: true
20
+ end
21
+ end
22
+
23
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: upm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - epitron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-30 00:00:00.000000000 Z
11
+ date: 2018-06-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Wrap all known command-line package tools with a consistent and pretty
14
14
  interface.
@@ -38,6 +38,7 @@ files:
38
38
  - lib/upm/tool.rb
39
39
  - lib/upm/tool_class_methods.rb
40
40
  - lib/upm/tool_dsl.rb
41
+ - lib/upm/tools/apk.rb
41
42
  - lib/upm/tools/apt.rb
42
43
  - lib/upm/tools/pacman.rb
43
44
  - lib/upm/tools/pkg.rb