rise-cli 0.2.4 → 0.2.5

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
  SHA1:
3
- metadata.gz: d5162dbadabf1ce5e3c6cae30d4b499299f3af19
4
- data.tar.gz: 9ad01e3cea0111f1a63997e3a4f89dea21076915
3
+ metadata.gz: 18cc23e94cacadc5a5ad1ab7eb0faab43adbb646
4
+ data.tar.gz: 5c12e3d417413766fdafd92bd802ebdcaa8b9334
5
5
  SHA512:
6
- metadata.gz: 38948ebe69253939884b25738398480f3782ea87976401039d5d04e169418a64f49b3f686c9aa89f38ef0dcfe3c58136bd4790c78161ef14102277b65cd9f246
7
- data.tar.gz: 96e5996ca8e4e98505e39f753cdced60255bca2d983e546c3d8266ab5999082f8bebd2ee583699c5e7370dcc46b8d3094cbc4ff3442c519372a02028b25ce5ba
6
+ metadata.gz: fa22c89d20b82f85988da5e9af41c0734f882fc950fe2b5443248cc8915edcde881613ece2d9845068be712a76bd68fa9962b65d34d33d0e1b6ca8eb4d6b2d5f
7
+ data.tar.gz: 03e0c1a1aad929627a4b7b946ee8dae6b3f31947a34af97e3d662d91d98a3721cdab42caa856ed0fc1ba0c7070e4043d9d1aa9e6dd146811f5efe83b572abf19
data/bin/rise CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  $LOAD_PATH.unshift(File.expand_path(File.join('..', 'lib'))) unless $LOAD_PATH.include?(File.expand_path(File.join('..', 'lib')))
3
+
3
4
  require 'core'
4
5
 
5
6
  options = {}
@@ -10,7 +11,7 @@ OptionParser.new do |opts|
10
11
  opts.banner = "Usage: #{$PROGRAM_NAME} [options]\nRise version: #{Rise::Constants::VERSION}"
11
12
  opts.separator Paint["\nGeneral Options: ", '#95a5a6']
12
13
 
13
- opts.on('-d DIR', '--dir DIR', String, 'Upload files in DIR') do |d|
14
+ opts.on('-d DIR', '--dir DIR', String, 'Upload files in DIR (Defaults to the current directory)') do |d|
14
15
  options[:directory] = d unless d.nil?
15
16
  end
16
17
 
@@ -39,22 +40,31 @@ OptionParser.new do |opts|
39
40
 
40
41
  opts.on('-h', '--help', 'Show this help message') do
41
42
  puts opts
43
+ puts Rise::Text::TASKS_HELP
42
44
  exit
43
45
  end
44
46
 
45
47
  opts.separator Paint["\nTasks: ", '#95a5a6']
46
- opts.on('--init', 'Reinitialize your password hash. (You will lose you old hash FOREVER)') do
48
+
49
+ end.parse!(ARGV)
50
+
51
+ # Ladies and gentlemen, this is what
52
+ # happens when optparse doesn't have
53
+ # good subcommand/task syntax support
54
+ while opt = ARGV.shift do
55
+ case opt
56
+ when 'init'
47
57
  Rise::Util.setup(false)
48
- puts "\nPlease run the `rise` command again to upload your files using your new password."
58
+ exit 0
59
+ when 'update'
60
+ Rise::Util.check_for_update!
49
61
  exit 0
50
62
  end
51
-
52
- end.parse!(ARGV)
63
+ end
53
64
 
54
65
 
55
66
  if Rise::Util.first_run?
56
67
  Rise::Util.setup
57
- puts "\nPlease run the `rise` command again to upload your files."
58
68
  exit 0
59
69
  end
60
70
  Rise::Util.check_for_update!
@@ -8,7 +8,7 @@ module Rise
8
8
  # Holds constants used throughout the framework
9
9
  #
10
10
  module Constants
11
- VERSION = '0.2.4'.freeze
11
+ VERSION = '0.2.5'.freeze
12
12
  EMAIL = '0xCB@protonmail.com'.freeze
13
13
  AUTHORS = ['Carter Brainerd']
14
14
  NAME = 'rise-cli'.freeze
data/lib/core/text.rb ADDED
@@ -0,0 +1,24 @@
1
+ require 'paint'
2
+ #
3
+ # Text and printing utility methods
4
+ #
5
+ module Rise
6
+ module Text
7
+
8
+ TASKS_HELP =
9
+ %Q{ init Reinitialize your password hash. (You will lose you old hash FOREVER)
10
+ update Updates the current rise-cli installation (aliased by -u)
11
+
12
+ Examples:
13
+ #{Paint['$ rise init -v', '#2ecc71']} Reinitializes your password with verbose output
14
+ #{Paint['$ rise -d ../my-project -o', '#2ecc71']} Will upload all files in `../my-project` and open it in a browser
15
+ }
16
+
17
+ #
18
+ # Prints +msg+ if the +RISE_VERBOSE+ environment variable is true (set with --verbose)
19
+ #
20
+ def self.vputs(msg='')
21
+ puts msg if ENV['RISE_VERBOSE'] == 'yes'
22
+ end
23
+ end
24
+ end
data/lib/core/util.rb CHANGED
@@ -50,18 +50,15 @@ module Rise
50
50
  spinner: 'line',
51
51
  status: "New version available (#{Paint[Rise::Constants::VERSION, 'red']} -> #{Paint[current_version, '#3498db']}), updating..."
52
52
  ) do
53
- system("gem uninstall rise-cli -v #{Rise::Constants::VERSION} > /dev/null")
54
- system("gem install rise-cli > /dev/null")
53
+ system("gem install rise-cli")
55
54
  puts Paint["Update complete, just run #{Paint['`rise`', '#3498db']} to deploy"]
56
55
  end
57
56
  end
58
57
  elsif src == 1
59
- if `git log HEAD..origin/master --oneline` != ''
60
- puts "It seems you're on bleeding edge, fetching new changes..."
61
- vputs("Updating from #{`git show --no-color --oneline -s`.split(' ')[0]} to #{`git rev-parse --short HEAD`}")
62
- `git pull`
63
- puts Paint["Update complete, just run #{Paint['`rise`', '#3498db']} to deploy"]
64
- end
58
+ puts "It seems you're on bleeding edge, fetching new changes..."
59
+ Rise::Text.vputs("Updating from #{`git show --no-color --oneline -s`.split(' ')[0]} to #{`git rev-parse --short HEAD`}")
60
+ `git pull`
61
+ puts Paint["Update complete, just run #{Paint['`rise`', '#3498db']} to deploy"]
65
62
  end
66
63
  rescue StandardError => e
67
64
  puts "Unable to check for updates. Error: #{Paint[e.message, 'red']}"
@@ -88,10 +85,11 @@ module Rise
88
85
  pw = Rise::Util.signup
89
86
  end
90
87
  File.open(File.join(RISE_DATA_DIR, 'auth', 'creds.json'), 'w') do |f|
91
- vputs('Writing hash to creds.json...')
88
+ Rise::Text.vputs('Writing hash to creds.json...')
92
89
  creds_hash = { 'hash' => BCrypt::Password.create(pw) }
93
90
  f.puts(JSON.pretty_generate(creds_hash))
94
91
  end
92
+ puts "\nAll done!\nPlease run the `rise` command again to upload your files."
95
93
  end
96
94
 
97
95
  def self.signup
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.2.4
4
+ version: 0.2.5
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-30 00:00:00.000000000 Z
11
+ date: 2017-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard
@@ -104,6 +104,7 @@ files:
104
104
  - img/rise_logo.png
105
105
  - lib/core.rb
106
106
  - lib/core/constants.rb
107
+ - lib/core/text.rb
107
108
  - lib/core/transport.rb
108
109
  - lib/core/util.rb
109
110
  - rise-cli.gemspec