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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31c1dfda6cae9629b240bd083ffc64a68565095c268622b6ecb990e76c220c89
4
- data.tar.gz: e2ab3c276039a2086524e18e500873d99b29e71f49ac0c9088cc08dfedd214f3
3
+ metadata.gz: 5f0966f2e3830ad0633d813fa97e82b3df87a5396e2147fd9255cf01c75768eb
4
+ data.tar.gz: 8a4269db1f99047e700d1a0940770825d37015f8696bf9648973f94dcdfa502b
5
5
  SHA512:
6
- metadata.gz: 37ce126b7de676fb89ccc5e03df27ce28c6348e3165f6885865c2b2c63da8d2bdbbfd387b3148d2a886a27d45eb5dab249401ebfced5f0710439b45f7f572daa
7
- data.tar.gz: ff456a7d8377eb846e195999966562005b717765e9a618cac0a1cc2855216d4652f94bf7c7b8a1d6815ddde35fdc0d1dad527a3c8f47e0551fb3127d428d4d41
6
+ metadata.gz: 6bc079b8c3bafc3ebd304c2c75c78a4a04cbe4e502b9171874bf668b8a37a20dfb777472426107db23cd14fd9a5dbd40afee37bf2cb798f03da09d208d4b812d
7
+ data.tar.gz: d867de2371f06d7e09cc9b8357a65734214cc49926f6aea566b15f2de60be0f64d7d7cead91404ebc139608ca8a736324a934438afb8b78f3cb21c4520ed1582
data/README.md CHANGED
@@ -1,39 +1,47 @@
1
- # Alm
1
+ # ALM (Appimage Linux Manager)
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
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
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
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
- bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
10
+ gem install alm
15
11
  ```
16
12
 
17
- If bundler is not being used to manage dependencies, install the gem by executing:
13
+ Or add it to your application's Gemfile with:
18
14
 
19
15
  ```bash
20
- gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
16
+ bundle add alm
21
17
  ```
22
18
 
23
19
  ## Usage
24
20
 
25
- TODO: Write usage instructions here
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
- ## Development
29
+ The tool creates the directory ``~/.local/appimage`` if it doesn't exist.
28
30
 
29
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
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
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
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/[USERNAME]/alm.
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(file_path)
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
- Modules::REMOVE.start([file])
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 "\n>>> - alm: #{file_arg} successfully added to #{appimg_path}\n"
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
- if File.exist?(file_path)
57
- File.delete(file_path)
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
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alm
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - mvguest