apti 0.6
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/AUTHORS +2 -0
- data/COPYING +674 -0
- data/README.md +42 -0
- data/TODO.md +7 -0
- data/bin/apti +70 -0
- data/changelog.xml +53 -0
- data/initial_config.yml +83 -0
- data/locales/en.yml +44 -0
- data/locales/fr.yml +44 -0
- data/src/apti/Apti.rb +791 -0
- data/src/apti/Package.rb +103 -0
- data/src/apti/config/Color.rb +223 -0
- data/src/apti/config/Colors.rb +85 -0
- data/src/apti/config/ColorsUpgrade.rb +65 -0
- data/src/apti/config/ColorsUpgradeRevision.rb +63 -0
- data/src/apti/config/ColorsUpgradeVersion.rb +64 -0
- data/src/apti/config/Config.rb +131 -0
- data/src/apti/config/Spaces.rb +85 -0
- data/src/apti/version.rb +6 -0
- metadata +78 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
#===============================================================================
|
|
3
|
+
#
|
|
4
|
+
# This file is part of Apti.
|
|
5
|
+
#
|
|
6
|
+
# Copyright (C) 2014 by Florent Lévigne <florent.levigne at mailoo dot com>
|
|
7
|
+
# Copyright (C) 2014 by Julien Rosset <jul.rosset at gmail dot com>
|
|
8
|
+
#
|
|
9
|
+
#
|
|
10
|
+
# Apti is free software: you can redistribute it and/or modify
|
|
11
|
+
# it under the terms of the GNU General Public License as published by
|
|
12
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
13
|
+
# (at your option) any later version.
|
|
14
|
+
#
|
|
15
|
+
# Apti is distributed in the hope that it will be useful,
|
|
16
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18
|
+
# GNU General Public License for more details.
|
|
19
|
+
#
|
|
20
|
+
# You should have received a copy of the GNU General Public License
|
|
21
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
22
|
+
#
|
|
23
|
+
#===============================================================================
|
|
24
|
+
|
|
25
|
+
module Apti
|
|
26
|
+
|
|
27
|
+
module Config
|
|
28
|
+
|
|
29
|
+
require_relative 'ColorsUpgradeVersion'
|
|
30
|
+
|
|
31
|
+
# Colors to use in apti.
|
|
32
|
+
class ColorsUpgradeRevision < ColorsUpgradeVersion
|
|
33
|
+
|
|
34
|
+
#
|
|
35
|
+
# @!attribute static [r]
|
|
36
|
+
# @return [Apti::Config::Color] Color of static part of version (upgrade).
|
|
37
|
+
attr_reader :static
|
|
38
|
+
|
|
39
|
+
# Initialize colors to default.
|
|
40
|
+
def initialize
|
|
41
|
+
require_relative 'Color'
|
|
42
|
+
|
|
43
|
+
super()
|
|
44
|
+
@static = Color.new(Color::TEXT_WHITE, nil, Color::EFFECT_BOLD)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Read upgrade-version colors from a YAML configuration (itself from a configuration file).
|
|
48
|
+
#
|
|
49
|
+
# @param revision [Hash{String => String, Fixnum}] YAML colors part.
|
|
50
|
+
def read_from(revision)
|
|
51
|
+
if revision.nil?
|
|
52
|
+
return
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
super(revision)
|
|
56
|
+
@static.read_from(revision['static'])
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
#===============================================================================
|
|
3
|
+
#
|
|
4
|
+
# This file is part of Apti.
|
|
5
|
+
#
|
|
6
|
+
# Copyright (C) 2014 by Florent Lévigne <florent.levigne at mailoo dot com>
|
|
7
|
+
# Copyright (C) 2013-2014 by Julien Rosset <jul.rosset at gmail dot com>
|
|
8
|
+
#
|
|
9
|
+
#
|
|
10
|
+
# Apti is free software: you can redistribute it and/or modify
|
|
11
|
+
# it under the terms of the GNU General Public License as published by
|
|
12
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
13
|
+
# (at your option) any later version.
|
|
14
|
+
#
|
|
15
|
+
# Apti is distributed in the hope that it will be useful,
|
|
16
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18
|
+
# GNU General Public License for more details.
|
|
19
|
+
#
|
|
20
|
+
# You should have received a copy of the GNU General Public License
|
|
21
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
22
|
+
#
|
|
23
|
+
#===============================================================================
|
|
24
|
+
|
|
25
|
+
module Apti
|
|
26
|
+
|
|
27
|
+
module Config
|
|
28
|
+
|
|
29
|
+
# Colors to use in apti.
|
|
30
|
+
class ColorsUpgradeVersion
|
|
31
|
+
|
|
32
|
+
#
|
|
33
|
+
# @!attribute old [r]
|
|
34
|
+
# @return [Apti::Config::Color] Color of old version (upgrade).
|
|
35
|
+
#
|
|
36
|
+
# @!attribute new [r]
|
|
37
|
+
# @return [Apti::Config::Color] Color of new version (upgrade).
|
|
38
|
+
attr_reader :old, :new
|
|
39
|
+
|
|
40
|
+
# Initialize colors to default.
|
|
41
|
+
def initialize
|
|
42
|
+
require_relative 'Color'
|
|
43
|
+
|
|
44
|
+
@old = Color.new(Color::TEXT_RED, nil, Color::EFFECT_BOLD)
|
|
45
|
+
@new = Color.new(Color::TEXT_GREEN, nil, Color::EFFECT_BOLD)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Read upgrade-version colors from a YAML configuration (itself from a configuration file).
|
|
49
|
+
#
|
|
50
|
+
# @param version [Hash{String => String, Fixnum}] YAML colors part.
|
|
51
|
+
def read_from(version)
|
|
52
|
+
if version.nil?
|
|
53
|
+
return
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
@old.read_from(version['old'])
|
|
57
|
+
@new.read_from(version['new'])
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
end
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
#===============================================================================
|
|
2
|
+
#
|
|
3
|
+
# This file is part of Apti.
|
|
4
|
+
#
|
|
5
|
+
# Copyright (C) 2013-2014 by Florent Lévigne <florent.levigne at mailoo dot com>
|
|
6
|
+
# Copyright (C) 2013-2014 by Julien Rosset <jul.rosset at gmail dot com>
|
|
7
|
+
#
|
|
8
|
+
#
|
|
9
|
+
# Apti is free software: you can redistribute it and/or modify
|
|
10
|
+
# it under the terms of the GNU General Public License as published by
|
|
11
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
# (at your option) any later version.
|
|
13
|
+
#
|
|
14
|
+
# Apti is distributed in the hope that it will be useful,
|
|
15
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
# GNU General Public License for more details.
|
|
18
|
+
#
|
|
19
|
+
# You should have received a copy of the GNU General Public License
|
|
20
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
+
#
|
|
22
|
+
#===============================================================================
|
|
23
|
+
|
|
24
|
+
module Apti
|
|
25
|
+
|
|
26
|
+
# Apti configuration module.
|
|
27
|
+
module Config
|
|
28
|
+
|
|
29
|
+
# Apti general configuration.
|
|
30
|
+
class Config
|
|
31
|
+
#
|
|
32
|
+
# @!attribute colors [r]
|
|
33
|
+
# @return [Colors] Colors.
|
|
34
|
+
#
|
|
35
|
+
# @!attribute display_size [r]
|
|
36
|
+
# @return [Boolean] Display packages size or not?
|
|
37
|
+
#
|
|
38
|
+
# @!attribute spaces [r]
|
|
39
|
+
# @return [Spaces] Spaces.
|
|
40
|
+
#
|
|
41
|
+
# @!attribute no_confirm [r]
|
|
42
|
+
# @return [String] Ask operation confirmation or not?
|
|
43
|
+
attr_reader :colors, :display_size, :spaces, :no_confirm
|
|
44
|
+
|
|
45
|
+
# Initialize configuration: read configuration file or, if not exists, create it with default configuration.
|
|
46
|
+
#
|
|
47
|
+
# @param file [String] Configuration filename (without path).
|
|
48
|
+
def initialize(file = 'aptirc.yml')
|
|
49
|
+
require_relative 'Colors'
|
|
50
|
+
require_relative 'Spaces'
|
|
51
|
+
|
|
52
|
+
@colors = Colors.new
|
|
53
|
+
@display_size = true
|
|
54
|
+
@spaces = Spaces.new
|
|
55
|
+
@no_confirm = false
|
|
56
|
+
|
|
57
|
+
path = get_dir + file
|
|
58
|
+
if !File.exist?(path)
|
|
59
|
+
write_to(file)
|
|
60
|
+
else
|
|
61
|
+
read_from(file)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Read a configuration file (it must exists).
|
|
67
|
+
#
|
|
68
|
+
# @param file [String] Filename (without path) to read.
|
|
69
|
+
def read_from(file)
|
|
70
|
+
require 'yaml'
|
|
71
|
+
|
|
72
|
+
config = YAML::load_file("#{get_dir}#{file}")
|
|
73
|
+
|
|
74
|
+
@colors.read_from(config['colors'])
|
|
75
|
+
@spaces.read_from(config['spaces'])
|
|
76
|
+
|
|
77
|
+
@display_size = read_boolean(config['display_size'], @display_size)
|
|
78
|
+
@no_confirm = read_boolean(config['no_confirm'], @no_confirm)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Write to a configuration file.
|
|
82
|
+
#
|
|
83
|
+
# @param filename [String] Filename (without path) of configuration file to create.
|
|
84
|
+
def write_to(filename)
|
|
85
|
+
require 'fileutils'
|
|
86
|
+
|
|
87
|
+
if !File.directory?(get_dir)
|
|
88
|
+
FileUtils.mkdir_p(get_dir)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
FileUtils.cp("#{File.dirname("#{__FILE__}")}/../../../initial_config.yml", "#{get_dir}#{filename}");
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
private
|
|
95
|
+
|
|
96
|
+
# Get path to Apti configuration directory.
|
|
97
|
+
#
|
|
98
|
+
# @return [String] Path of Apti configuration directory.
|
|
99
|
+
def get_dir
|
|
100
|
+
get_env_dir + '/apti/'
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Get path to system configuration directory.
|
|
104
|
+
#
|
|
105
|
+
# @return [String] Path of sytem configuration directory.
|
|
106
|
+
def get_env_dir
|
|
107
|
+
if ENV['XDG_CONFIG_HOME'].nil?
|
|
108
|
+
return "#{ENV['HOME']}/.config"
|
|
109
|
+
else
|
|
110
|
+
return ENV['XDG_CONFIG_HOME']
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Get correct value of boolean from YAML configuration (cf. read_from).
|
|
115
|
+
#
|
|
116
|
+
# @param bool [Boolean] The value to "read".
|
|
117
|
+
# @param default_value [Boolean] Default value to use if bool is not valid.
|
|
118
|
+
#
|
|
119
|
+
# @return [Boolean] The correct value.
|
|
120
|
+
def read_boolean(bool, default_value)
|
|
121
|
+
if bool.nil?
|
|
122
|
+
return default_value
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
bool
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#===============================================================================
|
|
2
|
+
#
|
|
3
|
+
# This file is part of Apti.
|
|
4
|
+
#
|
|
5
|
+
# Copyright (C) 2013-2014 by Florent Lévigne <florent.levigne at mailoo dot com>
|
|
6
|
+
# Copyright (C) 2013-2014 by Julien Rosset <jul.rosset at gmail dot com>
|
|
7
|
+
#
|
|
8
|
+
#
|
|
9
|
+
# Apti is free software: you can redistribute it and/or modify
|
|
10
|
+
# it under the terms of the GNU General Public License as published by
|
|
11
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
# (at your option) any later version.
|
|
13
|
+
#
|
|
14
|
+
# Apti is distributed in the hope that it will be useful,
|
|
15
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
# GNU General Public License for more details.
|
|
18
|
+
#
|
|
19
|
+
# You should have received a copy of the GNU General Public License
|
|
20
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
+
#
|
|
22
|
+
#===============================================================================
|
|
23
|
+
|
|
24
|
+
module Apti
|
|
25
|
+
|
|
26
|
+
module Config
|
|
27
|
+
|
|
28
|
+
# Spaces between elements to use in apti.
|
|
29
|
+
class Spaces
|
|
30
|
+
#
|
|
31
|
+
# @!attribute columns [r]
|
|
32
|
+
# @return [Fixnum] Number of spaces between two columns.
|
|
33
|
+
#
|
|
34
|
+
# @!attribute unit [r]
|
|
35
|
+
# @return [Fixnum] Number of spaces before size unit.
|
|
36
|
+
#
|
|
37
|
+
# @!attribute search [r]
|
|
38
|
+
# @return [Fixnum] Number of spaces with "search" between package name and his description.
|
|
39
|
+
attr_reader :columns, :unit, :search
|
|
40
|
+
|
|
41
|
+
# Initialize spaces to default.
|
|
42
|
+
def initialize
|
|
43
|
+
@columns = 3
|
|
44
|
+
@unit = 1
|
|
45
|
+
@search = 40
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Read spaces from a YAML configuration (itself from a configuration file).
|
|
49
|
+
#
|
|
50
|
+
# @param spaces [Hash{String => Fixnum}] YAML spaces part.
|
|
51
|
+
def read_from(spaces)
|
|
52
|
+
if spaces.nil?
|
|
53
|
+
return
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
@columns = read_space(spaces['columns'], @columns)
|
|
57
|
+
@unit = read_space(spaces['unit'], @unit)
|
|
58
|
+
@search = read_space(spaces['search'], @search)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
private
|
|
62
|
+
|
|
63
|
+
# Get correct value of space from YAML configuration (cf. read_from).
|
|
64
|
+
#
|
|
65
|
+
# @param space [Fixnum] The "space" to read.
|
|
66
|
+
# @param default_value [Fixnum] The default value to use if *space* is not valid.
|
|
67
|
+
#
|
|
68
|
+
# @return [Fixnum] The correct space.
|
|
69
|
+
def read_space(space, default_value)
|
|
70
|
+
if space.nil?
|
|
71
|
+
return default_value
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
if !(space.to_s =~ /^[[:digit:]]+$/).nil?
|
|
75
|
+
return space
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
puts "Configuration : Unable to get number of spaces from \"#{space}\""
|
|
79
|
+
default_value
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
end
|
data/src/apti/version.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: apti
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: '0.6'
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Florent Lévigne
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-03-16 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: i18n
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ~>
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0.6'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ~>
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0.6'
|
|
27
|
+
description: Apti is a frontend of aptitude (Debian's package manager) with improved
|
|
28
|
+
presentation of packages.
|
|
29
|
+
email: florent.levigne@mailoo.org
|
|
30
|
+
executables:
|
|
31
|
+
- apti
|
|
32
|
+
extensions: []
|
|
33
|
+
extra_rdoc_files: []
|
|
34
|
+
files:
|
|
35
|
+
- README.md
|
|
36
|
+
- COPYING
|
|
37
|
+
- AUTHORS
|
|
38
|
+
- TODO.md
|
|
39
|
+
- src/apti/version.rb
|
|
40
|
+
- src/apti/config/ColorsUpgradeRevision.rb
|
|
41
|
+
- src/apti/config/Config.rb
|
|
42
|
+
- src/apti/config/Color.rb
|
|
43
|
+
- src/apti/config/Spaces.rb
|
|
44
|
+
- src/apti/config/ColorsUpgradeVersion.rb
|
|
45
|
+
- src/apti/config/ColorsUpgrade.rb
|
|
46
|
+
- src/apti/config/Colors.rb
|
|
47
|
+
- src/apti/Package.rb
|
|
48
|
+
- src/apti/Apti.rb
|
|
49
|
+
- locales/fr.yml
|
|
50
|
+
- locales/en.yml
|
|
51
|
+
- initial_config.yml
|
|
52
|
+
- changelog.xml
|
|
53
|
+
- bin/apti
|
|
54
|
+
homepage: https://gitorious.org/apti
|
|
55
|
+
licenses:
|
|
56
|
+
- GPL3
|
|
57
|
+
metadata: {}
|
|
58
|
+
post_install_message:
|
|
59
|
+
rdoc_options: []
|
|
60
|
+
require_paths:
|
|
61
|
+
- src
|
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
63
|
+
requirements:
|
|
64
|
+
- - '>='
|
|
65
|
+
- !ruby/object:Gem::Version
|
|
66
|
+
version: '0'
|
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
|
+
requirements:
|
|
69
|
+
- - '>='
|
|
70
|
+
- !ruby/object:Gem::Version
|
|
71
|
+
version: '0'
|
|
72
|
+
requirements: []
|
|
73
|
+
rubyforge_project:
|
|
74
|
+
rubygems_version: 2.0.14
|
|
75
|
+
signing_key:
|
|
76
|
+
specification_version: 4
|
|
77
|
+
summary: Apti is a frontend for aptitude with improved presentation of packages.
|
|
78
|
+
test_files: []
|