pkg-maintainer 1.1.11 → 1.1.12

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: 4ace0aae0f6689ba039ce0e2cb80002fe96913d4fe9e9bf561cff438ff53b9bc
4
- data.tar.gz: 1c9a96ba66e9c47a9cb111141eb39b000b648af947d5ed3afa71de37005f587c
3
+ metadata.gz: 95d1e258fab05de232373d3ff3cb7266a546059839c065f1fe50c6415748bbbc
4
+ data.tar.gz: 6d013f37b553660a07dabed9cc7ec93c4bceb4f42cf168504f17a93f4fa17c50
5
5
  SHA512:
6
- metadata.gz: 98184588dbc66158d5cc930dceb9118222672376e9791ec5370a4487ac8037560dff61b5119a968001f473e6121a19585f695377d466332638fb12b95b9e5a32
7
- data.tar.gz: c406f646c5405335f2113aa13b76cecb52e967a640db42b3a673c25acaebbaa2fe4de767ad5742cd46b8f1e41e4f0ead7423c99e38ea98b7e6bbda99fd3b50e3
6
+ metadata.gz: 269acf2317a60bc5373998b610c02f5012d4db673945d237b514bab6f320500a899623c5252913bf8dde94946ce038522300aa97663f9b54efc8b61ef83c8e76
7
+ data.tar.gz: 73bb0234f0954a58d4685b161af904bbafc9e3049783ff93aa37ffe073ada81681e1ee3ae544ca84eba87d11d38d837556f17e8464d008a55cc44b81d97d7078
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pkg-maintainer (1.1.11)
4
+ pkg-maintainer (1.1.12)
5
5
  colorize
6
6
  commander
7
7
 
data/bin/maintain CHANGED
@@ -35,6 +35,8 @@ module Maintainer
35
35
  Maintainer::Runner.install_cocoapods
36
36
  elsif args[0] == "git"
37
37
  Maintainer::Runner.install_git
38
+ elsif args[0] == "pip"
39
+ Maintainer::Runner.install_pip
38
40
  end
39
41
  end
40
42
  end
@@ -52,6 +54,17 @@ module Maintainer
52
54
  end
53
55
  end
54
56
 
57
+ command :pip do |c|
58
+ c.syntax = 'maintainer pod [options]'
59
+ c.summary = ''
60
+ c.description = ''
61
+ c.example 'description', 'command example'
62
+ c.option '--some-switch', 'Some switch that does something'
63
+ c.action do |args, options|
64
+ Maintainer::Runner.pip(pkg: "#{args[0]}")
65
+ end
66
+ end
67
+
55
68
  command :pod do |c|
56
69
  c.syntax = 'maintainer pod [options]'
57
70
  c.summary = ''
data/lib/maintainer.rb CHANGED
@@ -1,5 +1,9 @@
1
1
  require_relative './maintainer_core/writer'
2
2
  require_relative './maintainer_core/setup'
3
+ require_relative './maintainer_core/cocoapodRunner'
4
+ require_relative './maintainer_core/gitRunner'
5
+ require_relative './maintainer_core/pipRunner'
6
+ require_relative './maintainer_core/updater'
3
7
 
4
8
  module Maintainer
5
9
  class Runner
@@ -31,6 +35,14 @@ module Maintainer
31
35
  def uninstall_git
32
36
  GitRunner.uninstall_git!
33
37
  end
38
+ def pip(pkg: nil)
39
+ Writer.write(message: "Adding the package: #{pkg}")
40
+ PipRunner.install(pkg: pkg)
41
+ end
42
+ def install_pip()
43
+ Writer.write(message: "Installing pip..")
44
+ PipRunner.install_pip!
45
+ end
34
46
  end
35
47
  end
36
48
  end
@@ -0,0 +1,22 @@
1
+ module Maintainer
2
+ class OS
3
+ class << self
4
+
5
+ def unix?
6
+ !OS.isWindows?
7
+ end
8
+
9
+ def isLinix?
10
+ OS.unix? and not OS.isMac?
11
+ end
12
+
13
+ def isMac?
14
+ (/darwin/ =~ RUBY_PLATFORM) != nil
15
+ end
16
+
17
+ def isWindows?
18
+ (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
19
+ end
20
+ end
21
+ end
22
+ end
@@ -55,7 +55,7 @@ module Maintainer
55
55
  end
56
56
 
57
57
  def execute(command: nil, error:nil)
58
- if command.kind_of?(String)
58
+ if command.is_a? String
59
59
  _execute(command: command, error: error)
60
60
  else
61
61
  command.command!.each do |item|
@@ -71,22 +71,10 @@ module Maintainer
71
71
 
72
72
  output = []
73
73
 
74
- if command.kind_of?(String)
75
- cmd = command
76
- else
77
- cmd = command.command!
78
- if command.requires_sudo!
79
- self.execute_sudo(command: cmd)
80
- return
81
- end
82
- end
83
-
84
- cmd = command.command!.join(" ") if command.command!.kind_of?(Array)
85
-
86
- Writer.write(message: "#{cmd}")
74
+ Writer.write(message: "#{command}")
87
75
 
88
76
  begin
89
- status = Maintainer::MaintainerPty.spawn(cmd) do |command_stdout, command_stdin, pid|
77
+ status = Maintainer::MaintainerPty.spawn(command) do |command_stdout, command_stdin, pid|
90
78
  command_stdout.each do |l|
91
79
  line = l.strip # strip so that \n gets removed
92
80
  output << line
@@ -1,6 +1,58 @@
1
+
2
+ require_relative './OS'
3
+
1
4
  module Maintainer
2
5
  class Commands
3
6
 
7
+ class Pip
8
+ class Install
9
+ class << self
10
+ def requires_sudo!()
11
+ return true
12
+ end
13
+ def command!()
14
+ if OS.isLinix?
15
+ return ['apt-get install python3-pip']
16
+ elsif OS.isMac?
17
+ return ['brew install python', 'brew unlink python && brew link python']
18
+ elsif OS.isWindows?
19
+ puts "Windows is not currently supported"
20
+ end
21
+ end
22
+ end
23
+ end
24
+ class Uninstall
25
+ class << self
26
+ def requires_sudo!()
27
+ return true
28
+ end
29
+ def command!()
30
+ return ['gem uninstall cocoapods']
31
+ end
32
+ end
33
+ end
34
+ class Version
35
+ class << self
36
+ def requires_sudo!()
37
+ return false
38
+ end
39
+ def command!()
40
+ return ['pip --version']
41
+ end
42
+ end
43
+ end
44
+ class Update
45
+ class << self
46
+ def requires_sudo!()
47
+ return false
48
+ end
49
+ def command!()
50
+ return ['pip update']
51
+ end
52
+ end
53
+ end
54
+ end
55
+
4
56
  class Cocoapods
5
57
  class Install
6
58
  class << self
@@ -12,7 +64,7 @@ module Maintainer
12
64
  end
13
65
  end
14
66
  end
15
- class Uinstall
67
+ class Uninstall
16
68
  class << self
17
69
  def requires_sudo!()
18
70
  return true
@@ -0,0 +1,34 @@
1
+
2
+ require_relative './commandRunner'
3
+ require_relative './commands'
4
+
5
+ module Maintainer
6
+ class PipRunner
7
+ class << self
8
+ def uninstall_pip!()
9
+ CommandRunner.execute(command: Commands::Pip::Uninstall, error: nil)
10
+ end
11
+
12
+ def install_pip!()
13
+ CommandRunner.execute(command: Commands::Pip::Install, error: nil)
14
+ end
15
+
16
+ def install(pkg: nil)
17
+ if not self.is_pip_installed!
18
+ self.install_pip!
19
+ end
20
+ CommandRunner.execute(command: "pip3 install #{pkg}", error: nil)
21
+ end
22
+
23
+ def is_pip_installed!()
24
+ version = CommandRunner.execute(command: Commands::Pip::Version, error: nil)
25
+
26
+ if /^(\d+)(.\d+)?(.\d+)?$/ =~ version
27
+ return true
28
+ end
29
+ puts "pip not installed"
30
+ return false
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,3 +1,3 @@
1
1
  module Maintainer
2
- VERSION = "1.1.11"
2
+ VERSION = "1.1.12"
3
3
  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.11
4
+ version: 1.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ehud Adler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-31 00:00:00.000000000 Z
11
+ date: 2019-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
@@ -59,11 +59,13 @@ files:
59
59
  - bin/maintain
60
60
  - bin/setup
61
61
  - lib/maintainer.rb
62
+ - lib/maintainer_core/OS.rb
62
63
  - lib/maintainer_core/cocoapodRunner.rb
63
64
  - lib/maintainer_core/commandRunner.rb
64
65
  - lib/maintainer_core/commands.rb
65
66
  - lib/maintainer_core/gitRunner.rb
66
67
  - lib/maintainer_core/maintainFileUpdater.rb
68
+ - lib/maintainer_core/pipRunner.rb
67
69
  - lib/maintainer_core/setup.rb
68
70
  - lib/maintainer_core/updater.rb
69
71
  - lib/maintainer_core/version.rb