upm 0.1.14 → 0.1.15

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: d35aa5412644879ebc18e848569dff6bf7274e09831a5733d63ab5fedffa1916
4
- data.tar.gz: '09b5f1c4461fea7e092cc3ce630e7586c5bd127e849e173245f4c00c9df1d79f'
3
+ metadata.gz: ded1341ceb284ef951e745cdf22974c5b0c34dfaf17f7a74653afea5b238f6d7
4
+ data.tar.gz: c46841d0f417d6598bf7df85eb873aca164827cfd0087ce41c174c61b0a20430
5
5
  SHA512:
6
- metadata.gz: d7837f1491c9bdfa1c08fd8a5bcad5f265bbef08d26c0bdfc2b8ee526d1ad50106b6b598edb92c7af658c8c9df6602e26ac94516a7502261a368d405e3894bfc
7
- data.tar.gz: 35a96cabe424135bafbab8b760b4cfc2de04b4c2d9811420c004625ab9cb8aea67bbfa1108c8ddaf68d3324eea94fe808b9ce3674100779d6ba4495c61588b75
6
+ metadata.gz: 2dd4bdc0b5f8bfd5341d126b5faf834f25a131b15b9c1c1bb0445c10cdf3fa57444169bcc65607d2d65b8fc8bffd7ce199aa936c013987d3c8a35fda33bea33b
7
+ data.tar.gz: 54a92a1a0c91bfdf7d48c26c2ca10f6ec2a2a112f32eb6e8fc2571d3c771d7503dff0f5fa3b66e9904dad984c21e99e4cbbc76ecc010909e36bc0c73a03a2ca7
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.14
1
+ 0.1.15
@@ -10,9 +10,10 @@ module UPM
10
10
 
11
11
  def os_release
12
12
  @os_release ||= begin
13
- open("/etc/os-release") do |io|
13
+ pairs = open("/etc/os-release") do |io|
14
14
  io.read.scan(/^(\w+)="?(.+?)"?$/)
15
- end.to_h
15
+ end
16
+ Hash[pairs]
16
17
  rescue Errno::ENOENT
17
18
  {}
18
19
  end
@@ -44,14 +45,14 @@ module UPM
44
45
  tool = nil
45
46
 
46
47
  if os_names.any?
47
- tool = @@tools.find { |name, tool| os_names.any? { |name| tool.os.include? name } }&.last
48
+ tool = @@tools.find { |name, tool| os_names.any? { |name| tool.os.include? name } }
48
49
  end
49
50
 
50
51
  if tool.nil?
51
- tool = @@tools.find { |name, tool| File.which(tool.identifying_binary) }&.last
52
+ tool = @@tools.find { |name, tool| File.which(tool.identifying_binary) }
52
53
  end
53
54
 
54
- tool
55
+ tool.last
55
56
  end
56
57
 
57
58
  end
@@ -44,8 +44,8 @@ module UPM
44
44
  end
45
45
  end
46
46
 
47
- def os(*names)
48
- names.any? ? @os = names : @os
47
+ def os(*args)
48
+ args.any? ? @os = args : @os
49
49
  end
50
50
 
51
51
  ## Helpers
@@ -0,0 +1,26 @@
1
+ UPM::Tool.new "opkg" do
2
+
3
+ os "openwrt", "lede"
4
+
5
+ command "install", "opkg install", root: true
6
+ command "update", "opkg update", root: true
7
+ command "upgrade", root: true do |args|
8
+ pkgs = `opkg list-upgradable`.each_line.map { |line| line.split.first }
9
+ run "opkg", "upgrade", *pkgs
10
+ end
11
+
12
+ command "search" do |args|
13
+ query = args.join
14
+ run "opkg", "list", grep: query, paged: true
15
+ end
16
+
17
+ command "list" do |args|
18
+ if args.any?
19
+ query = args.join
20
+ run "opkg", "list-installed", grep: query, paged: true
21
+ else
22
+ run "opkg", "list-installed", paged: true
23
+ end
24
+ end
25
+
26
+ end
@@ -0,0 +1,27 @@
1
+ UPM::Tool.new "yum" do
2
+
3
+ os "centos", "fedora", "rhel"
4
+
5
+ command "install", "yum install", root: true
6
+ command "remove", "yum remove", root: true
7
+ command "update", "yum update", root: true
8
+ command "upgrade", "yum upgrade", root: true
9
+ command "clean", "yum clean", root: true
10
+
11
+ command "files", "rpm -ql", paged: true
12
+ command "search" do |args|
13
+ query = args.join(".+")
14
+ run "yum", "search", *args, sort: true, paged: true, highlight: query
15
+ end
16
+
17
+ command "list" do |args|
18
+ if args.any?
19
+ highlight_query = args.join(".+")
20
+ grep_query = /#{highlight_query}/
21
+ run "yum", "list", "installed", grep: grep_query, highlight: highlight_query, paged: true
22
+ else
23
+ run "yum", "list", "installed", paged: true
24
+ end
25
+ end
26
+
27
+ 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.14
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - epitron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-05 00:00:00.000000000 Z
11
+ date: 2018-07-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.
@@ -40,9 +40,11 @@ files:
40
40
  - lib/upm/tool_dsl.rb
41
41
  - lib/upm/tools/apk.rb
42
42
  - lib/upm/tools/apt.rb
43
+ - lib/upm/tools/opkg.rb
43
44
  - lib/upm/tools/pacman.rb
44
45
  - lib/upm/tools/pkg.rb
45
46
  - lib/upm/tools/xbps.rb
47
+ - lib/upm/tools/yum.rb
46
48
  - spec/core_ext_spec.rb
47
49
  - spec/spec_helper.rb
48
50
  homepage: http://github.com/epitron/upm/