rise-cli 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/core/constants.rb +5 -4
- data/lib/core/transport.rb +1 -1
- data/lib/core/util.rb +47 -22
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45bf66600ed73d3196237da7baf820fc7f5d70b0
|
4
|
+
data.tar.gz: 829875b55c1c519238ce8a1cc11d094e9c5be679
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4eb1cfd3a0c32b6743f2fe5f641c44a29056ce3e747c9263cc45516f6eb5da15aca42b2bb6fb769c075699de0ef0d753ecb59e5e6c2d42306ab7ac538a3a26d0
|
7
|
+
data.tar.gz: 7b588ad2f036ac8f1db48fa8b534c9cfea6ad6e16991ceb1d5099f9b4f924c9c10c159ea3efa8b3935077d80c7c63ee1f9283d48d9f3d75cc7ed32c0bc0a1a61
|
data/lib/core/constants.rb
CHANGED
@@ -8,9 +8,10 @@ module Rise
|
|
8
8
|
# Holds constants used throughout the framework
|
9
9
|
#
|
10
10
|
module Constants
|
11
|
-
VERSION
|
12
|
-
EMAIL
|
13
|
-
AUTHORS
|
14
|
-
NAME
|
11
|
+
VERSION = '0.2.0'.freeze
|
12
|
+
EMAIL = '0xCB@protonmail.com'.freeze
|
13
|
+
AUTHORS = ['Carter Brainerd']
|
14
|
+
NAME = 'rise-cli'.freeze
|
15
|
+
RISE_DIR = File.join(File.dirname(__FILE__), '..', '..')
|
15
16
|
end
|
16
17
|
end
|
data/lib/core/transport.rb
CHANGED
data/lib/core/util.rb
CHANGED
@@ -4,9 +4,9 @@ require 'json'
|
|
4
4
|
require 'http'
|
5
5
|
require 'digest'
|
6
6
|
require 'io/console'
|
7
|
-
require 'tempfile'
|
8
7
|
require 'whirly'
|
9
8
|
require 'os'
|
9
|
+
require 'json'
|
10
10
|
require_relative 'constants'
|
11
11
|
|
12
12
|
module Rise
|
@@ -25,34 +25,39 @@ module Rise
|
|
25
25
|
# Check for a new version of the gem
|
26
26
|
#
|
27
27
|
def self.check_for_update!
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
28
|
+
src = git_or_gem
|
29
|
+
begin
|
30
|
+
if src == 2 # if the gem was downloaded from rubygems
|
31
|
+
current_version = JSON.parse(HTTP.get('https://rubygems.org/api/v1/versions/rise-cli/latest.json'))['version']
|
32
|
+
if current_version != Rise::Constants::VERSION
|
33
|
+
Whirly.start(
|
34
|
+
spinner: 'line',
|
35
|
+
status: "New version available (#{Paint[Rise::Constants::VERSION, 'red']} -> #{Paint[current_version, '#3498db']}), updating..."
|
36
|
+
) do
|
37
|
+
system("gem uninstall rise-cli -v #{Rise::Constants::VERSION} > /dev/null")
|
38
|
+
system("gem install rise-cli > /dev/null")
|
39
|
+
puts Paint["Update complete, just run #{Paint['`rise`', '#3498db']} to deploy"]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
elsif src == 1
|
43
|
+
if `git log HEAD..origin/master --oneline` != ''
|
44
|
+
puts "It seems you're on bleeding edge, fetching new changes..."
|
45
|
+
vputs("Updating from #{`git show --no-color --oneline -s`.split(' ')[0]} to #{`git rev-parse --short HEAD`}")
|
46
|
+
`git pull`
|
47
|
+
puts Paint["Update complete, just run #{Paint['`rise`', '#3498db']} to deploy"]
|
48
|
+
end
|
41
49
|
end
|
50
|
+
rescue StandardError => e
|
51
|
+
puts "Unable to check for updates. Error: #{Paint[e.message, 'red']}"
|
52
|
+
exit 1
|
42
53
|
end
|
43
|
-
rescue StandardError => e
|
44
|
-
puts "Unable to check for updates. Error: #{Paint[e.message, 'red']}"
|
45
|
-
exit 1
|
46
|
-
ensure
|
47
|
-
temp.close
|
48
|
-
temp.unlink
|
49
54
|
end
|
50
55
|
|
51
56
|
#
|
52
57
|
# Creates all of the necessary files and login information
|
53
58
|
#
|
54
59
|
def self.setup
|
55
|
-
puts Paint['Detected first time
|
60
|
+
puts Paint['Detected first time run, creating necessary files...', :blue]
|
56
61
|
FileUtils.mkdir(RISE_DATA_DIR)
|
57
62
|
FileUtils.mkdir(File.join(RISE_DATA_DIR, 'auth'))
|
58
63
|
|
@@ -76,7 +81,7 @@ module Rise
|
|
76
81
|
#
|
77
82
|
# Opens +url+ in a web browser if possible
|
78
83
|
#
|
79
|
-
def open_deployment_in_browser(url)
|
84
|
+
def self.open_deployment_in_browser(url)
|
80
85
|
if OS.windows?
|
81
86
|
system("START \"\" \"#{url}\"")
|
82
87
|
else
|
@@ -84,5 +89,25 @@ module Rise
|
|
84
89
|
end
|
85
90
|
end
|
86
91
|
|
92
|
+
|
93
|
+
|
94
|
+
protected
|
95
|
+
#
|
96
|
+
# 1 = git, 2 = gem, 3 = unknown
|
97
|
+
#
|
98
|
+
def git_or_gem
|
99
|
+
gem = nil
|
100
|
+
1 if File.exist?(File.join(Rise::Constants::VERSION, '.git'))
|
101
|
+
if OS.windows?
|
102
|
+
gem = system('which gem > NUL')
|
103
|
+
else
|
104
|
+
gem = system('which gem > /dev/null')
|
105
|
+
end
|
106
|
+
|
107
|
+
2 if gem == true
|
108
|
+
3
|
109
|
+
end
|
110
|
+
|
111
|
+
|
87
112
|
end
|
88
113
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rise-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carter Brainerd
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clipboard
|