dist_diff 0.1.0
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 +7 -0
- data/lib/dist_diff/file_reader.rb +25 -0
- data/lib/dist_diff.rb +43 -0
- metadata +46 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b76a51cdc235b3a1f539fe20b719a4690a469c31
|
4
|
+
data.tar.gz: ec226befc2f46b8ac21b513ba79b95d857eabef8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5a4b69498da35e9940af94230dda2e5b751c02cd4d3b11f97d5bc565b9cf12efb2f9e4b53a9789348a5558a10bd650fc8d78e860d975986fff9e20fcca3d8270
|
7
|
+
data.tar.gz: 9285677665c86079c2aefbb5b0b47de8faa27e109284034f912641ac4801cb50f33852b771751e1d0f6fef8dad6012f6f8ab5a055f709fdf12f199289ef454fc
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Reads a Ubuntu Iso manifest file and output the package names
|
2
|
+
class FileReader
|
3
|
+
attr_reader :manifest_file
|
4
|
+
|
5
|
+
def initialize(manifest_file)
|
6
|
+
@manifest_file = manifest_file
|
7
|
+
end
|
8
|
+
|
9
|
+
def package_names
|
10
|
+
file_content = readfile(manifest_file)
|
11
|
+
extract_package_names_into_array(file_content)
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def readfile(filename)
|
17
|
+
File.open(filename, 'r') do |f|
|
18
|
+
f.read
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def extract_package_names_into_array(file_content)
|
23
|
+
file_content.split(' ').select.with_index { |_, i| i.even? }
|
24
|
+
end
|
25
|
+
end
|
data/lib/dist_diff.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# For getting the difference in package names between two Ubuntu distribution
|
2
|
+
# using Ubuntu manifest file
|
3
|
+
class DistDiff
|
4
|
+
attr_reader :manifest_from, :manifest_to
|
5
|
+
|
6
|
+
def initialize(manifest_from, manifest_to)
|
7
|
+
@manifest_from = manifest_from
|
8
|
+
@manifest_to = manifest_to
|
9
|
+
end
|
10
|
+
|
11
|
+
def extra_packages
|
12
|
+
read_manifest_files
|
13
|
+
list_diff
|
14
|
+
end
|
15
|
+
|
16
|
+
def reverse_extra_packages
|
17
|
+
read_manifest_files if (to_pkgs and from_pkgs).nil?
|
18
|
+
list_diff(true)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
attr_reader :to_pkgs, :from_pkgs
|
24
|
+
|
25
|
+
def list_diff(reverse = false)
|
26
|
+
unless reverse
|
27
|
+
to_pkgs - from_pkgs
|
28
|
+
else
|
29
|
+
from_pkgs - to_pkgs
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def read_manifest_files
|
34
|
+
@from_pkgs = read_packages_of(manifest_from)
|
35
|
+
@to_pkgs = read_packages_of(manifest_to)
|
36
|
+
end
|
37
|
+
|
38
|
+
def read_packages_of(manifest_file)
|
39
|
+
FileReader.new(manifest_file).package_names
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
require 'dist_diff/file_reader'
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dist_diff
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mohammad Anwar Shah
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-12 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple gem to extract the differences of package names between Ubuntu
|
14
|
+
derivatives so that it becomes easy to switch from one Ubuntu derivative to another
|
15
|
+
email: mohammadanwarshah@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/dist_diff.rb
|
21
|
+
- lib/dist_diff/file_reader.rb
|
22
|
+
homepage: http://rubygems.org/gems/dist_diff
|
23
|
+
licenses:
|
24
|
+
- MIT
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.4.8
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: A gem for finding the packages need to be installed to switch Ubuntu derivatives
|
46
|
+
test_files: []
|