alm 0.2.0 → 0.3.1
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 +4 -4
- data/README.md +24 -16
- data/exe/alm +19 -8
- data/lib/alm/modules.rb +3 -8
- data/lib/alm/verifications.rb +7 -0
- data/lib/alm/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5f0966f2e3830ad0633d813fa97e82b3df87a5396e2147fd9255cf01c75768eb
|
|
4
|
+
data.tar.gz: 8a4269db1f99047e700d1a0940770825d37015f8696bf9648973f94dcdfa502b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6bc079b8c3bafc3ebd304c2c75c78a4a04cbe4e502b9171874bf668b8a37a20dfb777472426107db23cd14fd9a5dbd40afee37bf2cb798f03da09d208d4b812d
|
|
7
|
+
data.tar.gz: d867de2371f06d7e09cc9b8357a65734214cc49926f6aea566b15f2de60be0f64d7d7cead91404ebc139608ca8a736324a934438afb8b78f3cb21c4520ed1582
|
data/README.md
CHANGED
|
@@ -1,39 +1,47 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ALM (Appimage Linux Manager)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/alm`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
3
|
+
Alm is a lightweight Ruby CLI tool to manage AppImage files easily by adding or removing them from a user-local directory (`~/.local/appimage`). It automates permission granting and file moving without requiring root access, simplifying the handling of AppImages on Linux systems.
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Install the gem and add to the application's Gemfile by executing:
|
|
7
|
+
You can install the gem from RubyGems after its release by running:
|
|
12
8
|
|
|
13
9
|
```bash
|
|
14
|
-
|
|
10
|
+
gem install alm
|
|
15
11
|
```
|
|
16
12
|
|
|
17
|
-
|
|
13
|
+
Or add it to your application's Gemfile with:
|
|
18
14
|
|
|
19
15
|
```bash
|
|
20
|
-
|
|
16
|
+
bundle add alm
|
|
21
17
|
```
|
|
22
18
|
|
|
23
19
|
## Usage
|
|
24
20
|
|
|
25
|
-
|
|
21
|
+
The alm command accepts two main flags:
|
|
22
|
+
|
|
23
|
+
- ``--add <file>`` - Adds an AppImage file by moving it to ~/.local/appimage, granting it executable permissions automatically.
|
|
24
|
+
|
|
25
|
+
- ``--remove <file>`` - Removes an AppImage file from the ~/.local/appimage directory.
|
|
26
|
+
|
|
27
|
+
## Notes
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
The tool creates the directory ``~/.local/appimage`` if it doesn't exist.
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
**No root (sudo) permissions are required** as long as the destination directory is writable by the user.
|
|
32
|
+
|
|
33
|
+
To run AppImages directly, consider adding ``~/.local/appimage`` to your system PATH:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
export PATH="$HOME/.local/appimage:$PATH"
|
|
37
|
+
```
|
|
30
38
|
|
|
31
|
-
|
|
39
|
+
Add this line to your shell config (~/.bashrc, ~/.zshrc, etc.) to persist the change.
|
|
32
40
|
|
|
33
41
|
## Contributing
|
|
34
42
|
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
|
43
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mvguest/alm.
|
|
36
44
|
|
|
37
45
|
## License
|
|
38
46
|
|
|
39
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT)
|
|
47
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT)
|
data/exe/alm
CHANGED
|
@@ -26,14 +26,14 @@ end
|
|
|
26
26
|
begin
|
|
27
27
|
parser.parse!
|
|
28
28
|
rescue OptionParser::InvalidOption => e
|
|
29
|
-
puts "[ERROR | OPT_PARSER] - alm: #{e.message}"
|
|
29
|
+
puts "\e[31m[ERROR | OPT_PARSER] - alm: #{e.message}\e[0m"
|
|
30
30
|
puts parser
|
|
31
31
|
exit 1
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
# Post-Processing Verification (PPV)
|
|
35
35
|
unless options[:file]
|
|
36
|
-
puts "[ERROR | PPV] - alm: No file passed"
|
|
36
|
+
puts "\e[31m[ERROR | PPV] - alm: No file passed\n\e[0m"
|
|
37
37
|
puts parser
|
|
38
38
|
exit 1
|
|
39
39
|
end
|
|
@@ -41,24 +41,35 @@ end
|
|
|
41
41
|
file = options[:file]
|
|
42
42
|
file_path = File.expand_path(file, Dir.pwd)
|
|
43
43
|
|
|
44
|
+
appimg_dir = File.expand_path(file, "#{Dir.home}/.local/appimage")
|
|
45
|
+
|
|
44
46
|
case options[:action]
|
|
45
47
|
when :add
|
|
46
48
|
# ADD VERIFICATION PROCESS
|
|
47
|
-
avp_verification = Verifications::AVP.process(
|
|
49
|
+
avp_verification = Verifications::AVP.process(appimg_dir)
|
|
48
50
|
case avp_verification
|
|
49
51
|
when :AVP_PPR
|
|
50
52
|
Modules::ADD.start([file])
|
|
51
53
|
when :AVP_NEXIST
|
|
52
|
-
puts "[ERROR | AVP_NEXIST ] - alm: The file #{file} was NOT found in the current directory"
|
|
54
|
+
puts "\e[31m[ERROR | AVP_NEXIST ] - alm: The file #{file} was NOT found in the current directory\e[0m"
|
|
53
55
|
when :AVP_NAPPIMG
|
|
54
|
-
puts "[ERROR | AVP_NAPPIMG] - alm: The passed file is NOT an .AppImage file"
|
|
56
|
+
puts "\e[31m[ERROR | AVP_NAPPIMG] - alm: The passed file is NOT an .AppImage file\e[0m"
|
|
55
57
|
else
|
|
56
|
-
puts "[ERROR | AVP_FAILED ] - alm: AVP Verification failed unexpectedly
|
|
58
|
+
puts "\e[31m[ERROR | AVP_FAILED ] - alm: AVP Verification failed unexpectedly\e[0m"
|
|
57
59
|
end
|
|
58
60
|
when :remove
|
|
59
|
-
|
|
61
|
+
# REMOVE VERIFICATION PROCESS
|
|
62
|
+
rvp_verification = Verifications::RVP.process(file_path)
|
|
63
|
+
case rvp_verification
|
|
64
|
+
when :RVP_PPR
|
|
65
|
+
Modules::REMOVE.start([file])
|
|
66
|
+
when :RVP_NEXIST
|
|
67
|
+
puts "\e[31m[ERROR | RVP_NEXIST ] - alm: File #{file} not found in the AppImage directory\e[0m"
|
|
68
|
+
else
|
|
69
|
+
puts "\e[31m[ERROR | RVP_FAILED ] - alm: RVP Verification failed unexpectedly\e[0m"
|
|
70
|
+
end
|
|
60
71
|
else
|
|
61
|
-
puts "[ERROR | CMD] - alm: No valid action (--add or --remove) provided"
|
|
72
|
+
puts "\e[31m[ERROR | CMD] - alm: No valid action (--add or --remove) provided\e[0m"
|
|
62
73
|
puts parser
|
|
63
74
|
exit 1
|
|
64
75
|
end
|
data/lib/alm/modules.rb
CHANGED
|
@@ -31,11 +31,10 @@ module Modules
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
if system("mv '#{file_path}' '#{appimg_path}'")
|
|
34
|
-
puts "
|
|
34
|
+
puts ">>> - alm: #{file_arg} successfully added to #{appimg_path}\n"
|
|
35
35
|
else
|
|
36
36
|
puts "\e[31m[ERROR | RUNTIME_ERROR] - alm: Failed to move #{file_arg} to #{appimg_path}\e[0m"
|
|
37
37
|
end
|
|
38
|
-
|
|
39
38
|
rescue Errno::EACCES
|
|
40
39
|
puts "\e[31m[ERROR | PERMISSION] - alm: Permission denied while accessing #{appimg_path}\e[0m"
|
|
41
40
|
rescue => e
|
|
@@ -53,12 +52,8 @@ module Modules
|
|
|
53
52
|
file_path = File.join(appimg_path, File.basename(file_arg))
|
|
54
53
|
|
|
55
54
|
begin
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
puts "\n>>> - alm: #{File.basename(file_arg)} successfully removed from #{appimg_path}\n"
|
|
59
|
-
else
|
|
60
|
-
puts "\e[31m[ERROR] - alm: File #{File.basename(file_arg)} not found in #{appimg_path}\e[0m"
|
|
61
|
-
end
|
|
55
|
+
File.delete(file_path)
|
|
56
|
+
puts "\n>>> - alm: #{File.basename(file_arg)} successfully removed from #{appimg_path}\n"
|
|
62
57
|
rescue Errno::EACCES
|
|
63
58
|
puts "\e[31m[ERROR | PERMISSION] - alm: Permission denied while trying to delete #{file_path}\e[0m"
|
|
64
59
|
rescue => e
|
data/lib/alm/verifications.rb
CHANGED
|
@@ -7,4 +7,11 @@ module Verifications
|
|
|
7
7
|
:AVP_PPR # Add Verification Process (Positive Process Return)
|
|
8
8
|
end
|
|
9
9
|
end
|
|
10
|
+
|
|
11
|
+
class RVP
|
|
12
|
+
def self.process(path)
|
|
13
|
+
return :RVP_NEXIST unless File.exist?(path)
|
|
14
|
+
:RVP_PPR # Remove Verification Process (Positive Process Return)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
10
17
|
end
|
data/lib/alm/version.rb
CHANGED