pkg-maintainer 1.1.14 → 1.1.15
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/Gemfile.lock +1 -1
- data/README.md +54 -1
- data/lib/maintainer_core/commandRunner.rb +2 -4
- data/lib/maintainer_core/commands.rb +1 -1
- data/lib/maintainer_core/pipRunner.rb +4 -5
- data/lib/maintainer_core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9e7269affb685917b58beb84c3185bc698ffe5eacbdcd34bc0ca337e666bd120
|
|
4
|
+
data.tar.gz: 75767bdd65a9110aae0e03abf6b7d6534083730e60df99639bab8f7b21b96c3f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9962486e0772c56ff6f2f2bca64f675d06b046de4e102317c716acf84b45a21d5478c50c2535fd566968452e00d08426dd065734741c6afa47ed3495350c9ea3
|
|
7
|
+
data.tar.gz: e58b254631dd2ddf9c54a63a6019d2b7969047cc8f96dbbffbbb137da626ec8abd2fc4fa87e8b208cb46886e8ac046697503847b08951a34715422567eec6f0b
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -34,6 +34,10 @@ Or install it yourself as:
|
|
|
34
34
|
| pod `podname`| Install a pod |
|
|
35
35
|
| install cocoapods| Installs cocoapods |
|
|
36
36
|
| uninstall cocoapods| Uninstalls cocoapods|
|
|
37
|
+
| pip `package`| Install a python package|
|
|
38
|
+
| install pip| Installs pip|
|
|
39
|
+
| uninstall pip| Uninstalls pip|
|
|
40
|
+
|
|
37
41
|
|
|
38
42
|
## Development
|
|
39
43
|
|
|
@@ -43,7 +47,56 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
|
43
47
|
|
|
44
48
|
## Contributing
|
|
45
49
|
|
|
46
|
-
|
|
50
|
+
### Overview
|
|
51
|
+
|
|
52
|
+
Any project, be it big or small, usually makes use of someone elses code. Your options to add this outside code into your project are:
|
|
53
|
+
|
|
54
|
+
- Add the source code to your codebase
|
|
55
|
+
- Use a package manager
|
|
56
|
+
|
|
57
|
+
Typically, developers use the 2nd option.
|
|
58
|
+
|
|
59
|
+
When installing python packages, developers use the `pip` package manager
|
|
60
|
+
When installing ruby packages, developers use the `gems` or `bundler` package manager
|
|
61
|
+
When installing swift/obj-c packages, developers use `SPM` or `Cocoapods`
|
|
62
|
+
|
|
63
|
+
and this list goes on.
|
|
64
|
+
|
|
65
|
+
Clearly we have a bunch of independent packages managers, all of which must be kept up to date. All of which have their own unique commands.
|
|
66
|
+
|
|
67
|
+
The maintainer is a single layer of abstraction, a wrapper, that makes installing packages, or dependencies, easy.
|
|
68
|
+
|
|
69
|
+
### How it works
|
|
70
|
+
|
|
71
|
+
Remember, the maintainer is only a wrapper. Under the hood you will still be using `pip`, `npm`, `gems`, `bundler`, `cocoapods`, `spm`..etc but since the maintainer deals with them, you don't have to. If you try to install a `pip` package without pip installed the maintainer will proceed the package installation with an installation of pip itself.
|
|
72
|
+
|
|
73
|
+
Lets take an example:
|
|
74
|
+
|
|
75
|
+
You want to install the `pip` package `numpy`
|
|
76
|
+
|
|
77
|
+
Without the maintainer you would:
|
|
78
|
+
|
|
79
|
+
1. Install `pip`
|
|
80
|
+
2. Install `numpy`
|
|
81
|
+
|
|
82
|
+
With mainatiner you would:
|
|
83
|
+
|
|
84
|
+
1. Install `numpy`
|
|
85
|
+
|
|
86
|
+
How do you install `pip`? Does not matter. We know, and we have taught the maintainer to do it.
|
|
87
|
+
|
|
88
|
+
The maintainer also allows for enhanced control such as updating all your Pods and Pip packages, installing multiple packages as a time across multiple langauges and more. Even updating a dependency that occurs across multiple projects (For example, lets say it had a security flaw).
|
|
89
|
+
|
|
90
|
+
### How to building process works
|
|
91
|
+
|
|
92
|
+
The steps are pretty simple and thats the main goal. Since all package managers contain similar abilties we want to make the process of adding new package managers a breeze.
|
|
93
|
+
|
|
94
|
+
The `/bin/maintain` file is where everything begins. A user will type `maintain <cmd>` to use the maintainer. It looks like an executable but if you right-click and open with your text-editor youll see its just ruby :D. The `/bin/maintain` files only job so far is read the arguments and call the Runner class inside the `maintainer` file to run the proper command. From there you can follow the functions to see what they do.
|
|
95
|
+
|
|
96
|
+
The process of installing works as follows:
|
|
97
|
+
|
|
98
|
+
In the `commands.rb` file there are many similar classes which contain inner-classes that have a `require_sudo` and `command!` function. The `requires_sudo` is a boolean that tells the commandRunner if it needs to run this command in sudo, the `command!` function should, check which OS the user is running (using the `OS` class) and then return an array of strings where each string is a command to run in that perticular order. Later down the line these inner-classes will become more complex, able to handle errors thrown etc.
|
|
99
|
+
|
|
47
100
|
|
|
48
101
|
## License
|
|
49
102
|
|
|
@@ -71,12 +71,10 @@ module Maintainer
|
|
|
71
71
|
|
|
72
72
|
output = []
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
Writer.write(message: "#{cmd}")
|
|
74
|
+
Writer.write(message: "#{command}")
|
|
77
75
|
|
|
78
76
|
begin
|
|
79
|
-
status = Maintainer::MaintainerPty.spawn(
|
|
77
|
+
status = Maintainer::MaintainerPty.spawn(command) do |command_stdout, command_stdin, pid|
|
|
80
78
|
command_stdout.each do |l|
|
|
81
79
|
line = l.strip # strip so that \n gets removed
|
|
82
80
|
output << line
|
|
@@ -14,20 +14,19 @@ module Maintainer
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def install(pkg: nil)
|
|
17
|
-
if not self.is_pip_installed!
|
|
18
|
-
|
|
19
|
-
end
|
|
17
|
+
# if not self.is_pip_installed!
|
|
18
|
+
# self.install_pip!
|
|
19
|
+
# end
|
|
20
20
|
CommandRunner.execute(command: "pip3 install #{pkg}", error: nil)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def is_pip_installed!()
|
|
24
24
|
version = CommandRunner.execute(command: Commands::Pip::Version, error: nil)
|
|
25
|
-
|
|
26
25
|
if /^(\d+)(.\d+)?(.\d+)?$/ =~ version
|
|
27
26
|
return true
|
|
28
27
|
end
|
|
29
28
|
puts "pip not installed"
|
|
30
|
-
return
|
|
29
|
+
return true
|
|
31
30
|
end
|
|
32
31
|
end
|
|
33
32
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pkg-maintainer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.15
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ehud Adler
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-01-
|
|
11
|
+
date: 2019-01-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: commander
|