slack-utils 0.5.1 → 0.5.2

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.
@@ -38,7 +38,7 @@ TODO:
38
38
  == Installation
39
39
 
40
40
  To install the gem
41
- sudo gem install pkg/slack-utils-0.5.0.gem
41
+ sudo gem install pkg/slack-utils-0.5.2.gem
42
42
 
43
43
  == Quick Start
44
44
 
data/bin/slf CHANGED
@@ -1,29 +1,56 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'optparse'
3
4
  require 'rubygems'
4
- require 'trollop'
5
5
  require 'slackware/utils'
6
6
 
7
- opts = Trollop::options do
8
- banner <<-EOS
7
+ options = {}
8
+ begin
9
+ OptionParser.new do |opts|
10
+ opts.banner = <<-EOS
9
11
 
10
- search for a file within installed Slackware package's FILE LIST.
12
+ Search for a file within installed Slackware package's FILE LIST.
11
13
 
12
14
  Usage:
13
- slf [options] [pkg search flags] <one of more files>
15
+ #{File.basename(__FILE__)} [options] [pkg search flags] <one or more files>
14
16
 
15
17
  one or more files must be list
16
18
  if no search flags, only names, then those only those matching entries are listed
17
19
  EOS
18
- opt :pkg, "Package PKGNAME (loose match)", :type => :string
19
- opt :Version, "Package VERSION (loose match)", :type => :string
20
- opt :arch, "Package ARCH (exact match)", :type => :string
21
- opt :build, "Package BUILD (exact match)", :type => :string
22
- opt :tag, "Package TAG (loose match)", :type => :string
20
+ opts.on("-c", "--color", "Colorize output") do |o|
21
+ options[:color] = o
22
+ end
23
+ opts.on("-p", "--pkg [NAME]", "Package PKGNAME (loose match)") do |o|
24
+ options[:pkg] = o
25
+ end
26
+ opts.on("-V", "--Version [VERSION]", "Package VERSION (loose match)") do |o|
27
+ options[:version] = o
28
+ end
29
+ opts.on("-a", "--arch [ARCH]", "Package ARCH (exact match)") do |o|
30
+ options[:arch] = o
31
+ end
32
+ opts.on("-b", "--build [BUILD]", "Package BUILD (exact match)") do |o|
33
+ options[:build] = o
34
+ end
35
+ opts.on("-t", "--tag [TAG]", "Package TAG (loose match)") do |o|
36
+ options[:tag] = o
37
+ end
38
+ opts.on("-v", "--version", "Display version of this software") do |o|
39
+ printf("slack-utils (%s) version: %s, Slackware version: %s\n",
40
+ File.basename(__FILE__),
41
+ Slackware::UTILS_VERSION,
42
+ Slackware::System.version
43
+ )
44
+ exit()
45
+ end
46
+ end.parse!
47
+ rescue OptionParser::InvalidOption => e
48
+ $stderr.write("ERROR: #{e.message}, see --help\n")
49
+ exit 1
23
50
  end
24
51
 
25
52
  if (ARGV.count > 0)
26
- opts[:all] = true
53
+ options[:all] = true
27
54
  end
28
55
 
29
56
  if (ARGV.count == 0)
@@ -31,7 +58,7 @@ if (ARGV.count == 0)
31
58
  end
32
59
 
33
60
  begin
34
- print_package_searched_files(build_packages(opts, []), ARGV)
61
+ print_package_searched_files(build_packages(options, []), ARGV)
35
62
  rescue Interrupt
36
63
  exit 0
37
64
  rescue Exception => e
data/bin/sll CHANGED
@@ -1,37 +1,65 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'optparse'
3
4
  require 'rubygems'
4
- require 'trollop'
5
5
  require 'slackware/utils'
6
6
 
7
- opts = Trollop::options do
8
- banner <<-EOS
7
+ options = {}
8
+ begin
9
+ OptionParser.new do |opts|
10
+ opts.banner = <<-EOS
9
11
 
10
- List owned files for a given Slackware package.
12
+ List owned for files for a given Slackware package.
11
13
 
12
14
  Usage:
13
- sll [options] [search flags] [list of names]
15
+ #{File.basename(__FILE__)} [search flags] [list of names]
14
16
 
15
17
  if no search flags, only names, then those only those matching entries are listed
16
18
 
17
19
  EOS
18
- opt :pkg, "Package PKGNAME (loose match)", :type => :string
19
- opt :Version, "Package VERSION (loose match)", :type => :string
20
- opt :arch, "Package ARCH (exact match)", :type => :string
21
- opt :build, "Package BUILD (exact match)", :type => :string
22
- opt :tag, "Package TAG (loose match)", :type => :string
23
- opt :force, "force me to show all files", :type => :boolean
20
+ opts.on("-p", "--pkg [NAME]", "Package PKGNAME (loose match)") do |o|
21
+ options[:pkg] = o
22
+ end
23
+ opts.on("-V", "--Version [VERSION]", "Package VERSION (loose match)") do |o|
24
+ options[:version] = o
25
+ end
26
+ opts.on("-a", "--arch [ARCH]", "Package ARCH (exact match)") do |o|
27
+ options[:arch] = o
28
+ end
29
+ opts.on("-b", "--build [BUILD]", "Package BUILD (exact match)") do |o|
30
+ options[:build] = o
31
+ end
32
+ opts.on("-t", "--tag [TAG]", "Package TAG (loose match)") do |o|
33
+ options[:tag] = o
34
+ end
35
+ opts.on("-f", "--force", "force me to show all files") do |o|
36
+ options[:force] = o
37
+ end
38
+ opts.on("-v", "--version", "Display version of this software") do |o|
39
+ printf("slack-utils (%s) version: %s, Slackware version: %s\n",
40
+ File.basename(__FILE__),
41
+ Slackware::UTILS_VERSION,
42
+ Slackware::System.version
43
+ )
44
+ exit()
45
+ end
46
+ end.parse!
47
+ rescue OptionParser::InvalidOption => e
48
+ $stderr.write("ERROR: #{e.message}, see --help\n")
49
+ exit 1
50
+ end
51
+
52
+ if ((options.keys & %w{pkg Version arch build tag}.map {|a| :"#{a}" }).count == 0 && not(options[:force]))
53
+ $stderr.write("force me if you really want to see all files ...\nsee --help for more info\n")
54
+ exit 1
24
55
  end
25
56
 
26
57
  # handing through that we are listing owned files
27
- opts[:list_files] = true
58
+ options[:list_files] = true
28
59
 
29
- if (opts.keys.grep(/[pkg|Version|arch|build|tag]_given$/).count == 0 && not(opts[:force]))
30
- Trollop::die("force me if you really want to see all files ...")
31
- end
32
60
 
33
61
  begin
34
- print_package_file_list(build_packages(opts, ARGV))
62
+ print_package_file_list(build_packages(options, ARGV))
35
63
  rescue Interrupt
36
64
  exit 0
37
65
  end
data/bin/slp CHANGED
@@ -1,36 +1,63 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'optparse'
3
4
  require 'rubygems'
4
- require 'trollop'
5
5
  require 'slackware/utils'
6
6
 
7
- opts = Trollop::options do
8
- banner <<-EOS
7
+ options = {}
8
+ begin
9
+ OptionParser.new do |opts|
10
+ opts.banner = <<-EOS
9
11
 
10
12
  List installed Slackware packages.
11
13
 
12
14
  Usage:
13
- slp [options] [search flags] [list of names]
15
+ #{File.basename(__FILE__)} [options] [search flags] [list of names]
14
16
 
15
17
  if no flags are used, then all entries are listed
16
18
  if no search flags, only names, then those only those matching entries are listed
17
19
 
18
20
  EOS
19
- opt :color, "Colorize output", :type => :boolean
20
- opt :pkg, "Package PKGNAME (loose match)", :type => :string
21
- opt :Version, "Package VERSION (loose match)", :type => :string
22
- opt :arch, "Package ARCH (exact match)", :type => :string
23
- opt :build, "Package BUILD (exact match)", :type => :string
24
- opt :tag, "Package TAG (loose match)", :type => :string
21
+ opts.on("-c", "--color", "Colorize output") do |o|
22
+ options[:color] = o
23
+ end
24
+ opts.on("-p", "--pkg [NAME]", "Package PKGNAME (loose match)") do |o|
25
+ options[:pkg] = o
26
+ end
27
+ opts.on("-V", "--Version [VERSION]", "Package VERSION (loose match)") do |o|
28
+ options[:version] = o
29
+ end
30
+ opts.on("-a", "--arch [ARCH]", "Package ARCH (exact match)") do |o|
31
+ options[:arch] = o
32
+ end
33
+ opts.on("-b", "--build [BUILD]", "Package BUILD (exact match)") do |o|
34
+ options[:build] = o
35
+ end
36
+ opts.on("-t", "--tag [TAG]", "Package TAG (loose match)") do |o|
37
+ options[:tag] = o
38
+ end
39
+ opts.on("-v", "--version", "Display version of this software") do |o|
40
+ printf("slack-utils (%s) version: %s, Slackware version: %s\n",
41
+ File.basename(__FILE__),
42
+ Slackware::UTILS_VERSION,
43
+ Slackware::System.version
44
+ )
45
+ exit()
46
+ end
47
+ end.parse!
48
+ rescue OptionParser::InvalidOption => e
49
+ $stderr.write("ERROR: #{e.message}, see --help\n")
50
+ exit 1
25
51
  end
26
52
 
27
53
  if (ARGV.count > 0)
28
- opts[:all] = true
54
+ options[:all] = true
29
55
  end
30
56
 
31
57
  begin
32
- print_packages(build_packages(opts, ARGV))
58
+ print_packages(build_packages(options, ARGV))
33
59
  rescue Interrupt
34
60
  exit 0
35
61
  end
36
62
 
63
+
data/bin/slt CHANGED
@@ -1,40 +1,71 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'optparse'
3
4
  require 'rubygems'
4
- require 'trollop'
5
5
  require 'slackware/utils'
6
6
 
7
- opts = Trollop::options do
8
- banner <<-EOS
7
+ options = {}
8
+ begin
9
+ OptionParser.new do |opts|
10
+ opts.banner = <<-EOS
9
11
 
10
12
  List (and search) installed Slackware package's times.
11
13
 
12
14
  Usage:
13
- slt [options] [search flags] [list of names]
15
+ #{File.basename(__FILE__)} [pkg search flags] [list of names]
14
16
 
15
17
  if no flags are used, then all entries are listed
16
18
  if no search flags, only names, then those only those matching entries are listed
17
19
 
18
20
  EOS
19
- opt :color, "Colorize output", :default => false, :type => :boolean
20
- opt :epoch, "show time in seconds since 1970-01-01 00:00:00 UTC", :type => :boolean
21
- opt :pkg, "Package PKGNAME (loose match)", :type => :string
22
- opt :Version, "Package VERSION (loose match)", :type => :string
23
- opt :arch, "Package ARCH (exact match)", :type => :string
24
- opt :build, "Package BUILD (exact match)", :type => :string
25
- opt :tag, "Package TAG (loose match)", :type => :string
21
+ opts.on("-c", "--color", "Colorize output") do |o|
22
+ options[:color] = o
23
+ end
24
+ opts.on("-e", "--epock", "") do |o|
25
+ options[:epoch] = o
26
+ end
27
+ opts.on("-p", "--pkg [NAME]", "Package PKGNAME (loose match)") do |o|
28
+ options[:pkg] = o
29
+ end
30
+ opts.on("-V", "--Version [VERSION]", "Package VERSION (loose match)") do |o|
31
+ options[:version] = o
32
+ end
33
+ opts.on("-a", "--arch [ARCH]", "Package ARCH (exact match)") do |o|
34
+ options[:arch] = o
35
+ end
36
+ opts.on("-b", "--build [BUILD]", "Package BUILD (exact match)") do |o|
37
+ options[:build] = o
38
+ end
39
+ opts.on("-t", "--tag [TAG]", "Package TAG (loose match)") do |o|
40
+ options[:tag] = o
41
+ end
42
+ opts.on("-v", "--version", "Display version of this software") do |o|
43
+ printf("slack-utils (%s) version: %s, Slackware version: %s\n",
44
+ File.basename(__FILE__),
45
+ Slackware::UTILS_VERSION,
46
+ Slackware::System.version
47
+ )
48
+ exit()
49
+ end
50
+ end.parse!
51
+ rescue OptionParser::InvalidOption => e
52
+ $stderr.write("ERROR: #{e.message}, see --help\n")
53
+ exit 1
26
54
  end
27
55
 
28
56
  # handing through that we are gathering times too
29
- opts[:time] = true
57
+ options[:time] = true
30
58
 
31
- if (opts.keys.grep(/[pkg|Version|arch|build|tag]_given$/).count == 0)
32
- opts[:all] = true
59
+ if (ARGV.count > 0)
60
+ options[:all] = true
33
61
  end
34
62
 
35
63
  begin
36
- print_packages_times(build_packages(opts, ARGV), opts[:epoch])
64
+ print_packages_times(build_packages(options, ARGV), options[:epoch])
37
65
  rescue Interrupt
38
66
  exit 0
67
+ rescue Exception => e
68
+ puts "ERROR: #{e.message}"
69
+ exit 1
39
70
  end
40
71
 
@@ -1,3 +1,5 @@
1
+
2
+ require 'slackware/version'
1
3
  require 'slackware/package'
2
4
  require 'slackware/system'
3
5
  require 'slackware/repo'
@@ -1,16 +1,8 @@
1
1
 
2
+ require 'slackware/version'
2
3
  require 'slackware/package'
3
4
 
4
5
  module Slackware
5
-
6
- VERSION = begin
7
- data = File.read("/etc/slackware-version")
8
- data =~ /Slackware\s(.*)/
9
- $1
10
- rescue
11
- nil
12
- end
13
-
14
6
  DIR_INSTALLED_PACKAGES = "/var/log/packages"
15
7
  DIR_REMOVED_PACKAGES = "/var/log/removed_packages"
16
8
  DIR_INSTALLED_SCRIPTS = "/var/log/scripts"
@@ -19,7 +11,7 @@ module Slackware
19
11
  RE_BUILD_TAG = /^([[:digit:]]+)([[:alpha:]]+)$/
20
12
 
21
13
  def self::version
22
- VERSION
14
+ Slackware::VERSION
23
15
  end
24
16
 
25
17
  class System
@@ -157,7 +149,7 @@ module Slackware
157
149
 
158
150
  # Return the version of Slackware Linux currently installed
159
151
  def self::version
160
- VERSION
152
+ Slackware::VERSION
161
153
  end
162
154
  end
163
155
 
@@ -33,7 +33,7 @@ def build_packages(opts = {}, args = [])
33
33
  selected_pkgs = nil
34
34
  end
35
35
  end
36
- if (opts[:pkg_given])
36
+ if (opts[:pkg])
37
37
  pkgs = pkgs.map {|p|
38
38
  re = /#{opts[:pkg]}/i
39
39
  if p.name =~ re
@@ -44,7 +44,7 @@ def build_packages(opts = {}, args = [])
44
44
  end
45
45
  }.compact
46
46
  end
47
- if (opts[:Version_given])
47
+ if (opts[:Version])
48
48
  pkgs = pkgs.map {|p|
49
49
  re = Regexp.new(Regexp.escape(opts[:Version]))
50
50
  if p.version =~ re
@@ -55,7 +55,7 @@ def build_packages(opts = {}, args = [])
55
55
  end
56
56
  }.compact
57
57
  end
58
- if (opts[:arch_given])
58
+ if (opts[:arch])
59
59
  pkgs = pkgs.map {|p|
60
60
  re = /#{opts[:arch]}/
61
61
  if p.arch =~ re
@@ -66,7 +66,7 @@ def build_packages(opts = {}, args = [])
66
66
  end
67
67
  }.compact
68
68
  end
69
- if (opts[:build_given])
69
+ if (opts[:build])
70
70
  pkgs = pkgs.map {|p|
71
71
  re = /#{opts[:build]}/
72
72
  if p.build =~ re
@@ -77,7 +77,7 @@ def build_packages(opts = {}, args = [])
77
77
  end
78
78
  }.compact
79
79
  end
80
- if (opts[:tag_given])
80
+ if (opts[:tag])
81
81
  pkgs = pkgs.map {|p|
82
82
  re = /#{opts[:tag]}/i
83
83
  if p.tag =~ re
@@ -0,0 +1,12 @@
1
+
2
+ module Slackware
3
+ VERSION = begin
4
+ data = File.read("/etc/slackware-version")
5
+ data =~ /Slackware\s(.*)/
6
+ $1
7
+ rescue
8
+ nil
9
+ end
10
+ UTILS_VERSION = "0.5.2"
11
+ end
12
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-utils
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 1
10
- version: 0.5.1
9
+ - 2
10
+ version: 0.5.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Vincent Batts
@@ -17,21 +17,8 @@ cert_chain: []
17
17
 
18
18
  date: 2011-11-19 00:00:00 -05:00
19
19
  default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- name: trollop
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
33
- type: :runtime
34
- version_requirements: *id001
20
+ dependencies: []
21
+
35
22
  description: " slack-utils is a means by which to access \n\
36
23
  package information on the Slackware Linux OS. \n\
37
24
  See the examples/ for more information.\n "
@@ -63,6 +50,7 @@ files:
63
50
  - lib/slackware/utils.rb
64
51
  - lib/slackware/package.rb
65
52
  - lib/slackware/repo.rb
53
+ - lib/slackware/version.rb
66
54
  - lib/slackware/system.rb
67
55
  has_rdoc: true
68
56
  homepage: https://github.com/vbatts/slack-utils/
@@ -73,7 +61,7 @@ rdoc_options:
73
61
  - --main=README.rdoc
74
62
  - --line-numbers
75
63
  - --inline-source
76
- - --title=Slackware utils (slack-utils) 0.5.1 Documentation
64
+ - --title=Slackware utils (slack-utils) 0.5.2 Documentation
77
65
  require_paths:
78
66
  - lib
79
67
  required_ruby_version: !ruby/object:Gem::Requirement