micro_install 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 699159d6205ef44705c6fb74a9df412fbf9c6f753213acf12945c767a7b7ff79
4
- data.tar.gz: ab616b77824fd1a26570c8f22123f1c68e07e0204ecb42f3ae3dfee5193c4e3e
3
+ metadata.gz: a560d92ac077fb3e1b2551980a72107d0f296fdb1d2553063f5619292dec8bce
4
+ data.tar.gz: d23b62d8d855377e61bc4a18281abc0323cde65de30409e89edf04f3751b251d
5
5
  SHA512:
6
- metadata.gz: 20c49a2d2b17c294087e60400e714ceb6473b05890b7dc491df17107fc6803519609b8ee9db854ff4a8d8f4ae8339e292a8b6b5bf9222f2686e6bc5c5185a8d9
7
- data.tar.gz: 332f45f938a84d0d3c836f363cedb7d66400ad82388715f8eb191d97aa4ee3016ded6a41e4d31b160074b0c62048504f7aa0f14337f997ce290a71aa8c2bf694
6
+ metadata.gz: e453d25de1f0649b1a512c09d96b389a6cf7c8eaedb093e62adf6b91f59d5395b829709e3185f7b6271c02d721742a49dcbea10ba044749f1877516d7763002f
7
+ data.tar.gz: 443edf25d3ba57dd297a348c9c59d83d48ed7786c1c5bf16568d1b42a0a8b57b6708518582abdd9acb70f35ac7937398e65dc91f10ff51f777d5ef1678d4a9aa
@@ -38,5 +38,23 @@ else
38
38
  hl.say "#{Paint['Warning', 'orange']}: #{Dir.home}/.local/bin is not in $PATH,"
39
39
  installer.is_installed_but_no_bin
40
40
  end
41
+ if @arch == 'arm-linux'
42
+ note = <<~NOTE
43
+ #{Paint['NOTE','orange']}: Termux, while being the only linux subsystem
44
+ for android that micro_install supports, is a bit wonky when it
45
+ comes to shebangs and Bash startup.
46
+
47
+ 1. If you haven't already, create a '.bashrc' in '~'
48
+ 2. Add the next line into your bashrc after everything else
49
+ having to do with paths.
41
50
 
51
+ export PATH="#{Dir.home}/.local/bin:$PATH"
42
52
 
53
+ 3. Restart your bash session, or re-source your .bashrc
54
+
55
+ 'source ~/.bashrc'
56
+
57
+
58
+ NOTE
59
+ hl.say note
60
+ end
@@ -7,13 +7,13 @@ require 'paint'
7
7
  module MicroInstall
8
8
  class LookupError < Exception
9
9
  end
10
-
10
+
11
11
  class Installer
12
-
12
+ attr :arch
13
13
  def initialize(hl = HighLine.new($stdin, $stdout))
14
14
  @hl = hl
15
15
  end
16
-
16
+
17
17
  def latesttag(hl = @hl)
18
18
  begin
19
19
  hl.say "#{Paint["Getting Latest Tag", 'green']}"
@@ -23,57 +23,60 @@ module MicroInstall
23
23
  }
24
24
  hl.say "#{Paint['Latest Tag', 'green']}: #{Paint[@tag, 'yellow']}"
25
25
  rescue
26
- hl.say "#{Paint['Error', 'red']}: Unable to retrieve latest release."
26
+ hl.say "#{Paint['Error', 'red']}: Unable to retrieve latest release."
27
27
  end
28
28
  end
29
-
29
+
30
30
  def get_arch(hl = @hl)
31
31
  begin
32
32
  host_os = OS.config['host_os']
33
33
  bits = OS.bits.to_s
34
34
  case host_os
35
- when "linux-gnu"
36
- if bits == "64"
37
- @arch = 'linux64'
38
- elsif bits == "32"
39
- @arch = 'linux32'
40
- end
41
- when "darwin"
42
- @arch = 'osx'
43
- when "freebsd"
44
- if bits == "64"
45
- @arch = 'freebsd64'
46
- elsif bits == "32"
47
- @arch = 'freebsd32'
48
- end
49
- when "openbsd"
50
- if bits == "64"
51
- @arch = 'openbsd64'
52
- elsif bits == "32"
53
- @arch = 'openbsd32'
54
- end
55
- when "netbsd"
56
- if bits == "64"
57
- @arch = 'netbsd64'
58
- elsif bits == "32"
59
- @arch = 'netbsd32'
60
- end
35
+ when "linux-gnu"
36
+ if bits == "64"
37
+ @arch = 'linux64'
38
+ elsif bits == "32"
39
+ @arch = 'linux32'
40
+ end
41
+ when "darwin"
42
+ @arch = 'osx'
43
+ when "freebsd"
44
+ if bits == "64"
45
+ @arch = 'freebsd64'
46
+ elsif bits == "32"
47
+ @arch = 'freebsd32'
48
+ end
49
+ when "openbsd"
50
+ if bits == "64"
51
+ @arch = 'openbsd64'
52
+ elsif bits == "32"
53
+ @arch = 'openbsd32'
54
+ end
55
+ when "netbsd"
56
+ if bits == "64"
57
+ @arch = 'netbsd64'
58
+ elsif bits == "32"
59
+ @arch = 'netbsd32'
60
+ end
61
61
 
62
62
  end
63
63
  if OS.config['host_cpu'] == 'arm' or OS.config['host_os'] =~ /linux-arm/ or OS.config['host_os'] =~ /arm-linux/
64
64
  @arch = 'linux-arm'
65
65
  end
66
+ if @arch.nil?
67
+ raise MicroInstall::LookupError.new 'Unable to determine your system'
68
+ end
66
69
  rescue MicroInstall::LookupError => e
67
70
  hl.say "#{Paint['Error', 'red']}: #{e}"
68
71
  end
69
-
72
+
70
73
  end
71
-
74
+
72
75
  def download_url(hl = @hl)
73
76
  @download_url = "https://github.com/zyedidia/micro/releases/download/v#{@tag}/micro-#{@tag}-#{@arch}.tar.gz"
74
77
  hl.say("#{Paint['URL', 'yellow']}: #{@download_url}")
75
78
  end
76
-
79
+
77
80
  def download_micro_tar(hl = @hl)
78
81
  hl.say "Downloading... "
79
82
  MicroInstall.show_wait_spinner {
@@ -86,7 +89,7 @@ module MicroInstall
86
89
  }
87
90
  print "\n"
88
91
  end
89
-
92
+
90
93
  def extract_micro(hl = @hl)
91
94
  begin
92
95
  hl.say Paint["Extracting micro-#{@tag}-#{@arch}.tar.gz", 'yellow']
@@ -111,11 +114,11 @@ module MicroInstall
111
114
  end
112
115
  rescue
113
116
  hl.say "#{Paint['Error']}: Could not extract micro due to an error."
114
-
117
+
115
118
  end
116
-
119
+
117
120
  end
118
-
121
+
119
122
  def install_micro(hl = @hl)
120
123
  hl.say "#{Paint['Checking if ~/.local/bin exists.', 'yellow']}"
121
124
  if Dir.exist? Pathname(Dir.home).join('.local/bin')
@@ -146,17 +149,19 @@ module MicroInstall
146
149
  hl.say "#{Paint['Error', 'red']}: #{e}"
147
150
  end
148
151
  end
152
+
149
153
  def is_installed(hl = @hl)
150
154
  hl.say [
151
155
  "Micro has been installed to your ~/.local/bin/ directory. You can run it with:",
152
156
  "'micro'"
153
157
  ].join
154
158
  end
159
+
155
160
  def is_installed_but_no_bin(hl = @hl)
156
161
  hl.say [
157
- "Micro is installed to ~/.local/bin/, but can't run,",
158
- "Please check your ~/.bashrc and/or ~/.profile and see",
159
- "if '~/.local/bin/' is being added to the PATH variable"
162
+ "Micro is installed to ~/.local/bin/, but can't run,",
163
+ "Please check your ~/.bashrc and/or ~/.profile and see",
164
+ "if '~/.local/bin/' is being added to the PATH variable"
160
165
  ]
161
166
  end
162
167
  end
@@ -1,3 +1,3 @@
1
1
  module MicroInstall
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: micro_install
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken Spencer