rise-cli 0.2.3 → 0.2.4

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: 19e77425e03eb395280293bd2bc937fd61097425
4
- data.tar.gz: b46a75c6fcf17c3e2c1ba6d4edb82c956e2d5e94
3
+ metadata.gz: d5162dbadabf1ce5e3c6cae30d4b499299f3af19
4
+ data.tar.gz: 9ad01e3cea0111f1a63997e3a4f89dea21076915
5
5
  SHA512:
6
- metadata.gz: 95af0749ea3c6d1177ade8f38e58490ef58466a044dfddc919691ba085e9d68c9c315eb3a36045b0af2b1698e6ef8de9a0c5c2e430a735f1223161f7c81c7b76
7
- data.tar.gz: 755c0afff754ca0932721b0b66963af59a346e14d03992e994f47fad7826d3e1cb3335d681e2d95da9bce21b5c024d54d291d6b646dcd54f08bac1af3ac16a67
6
+ metadata.gz: 38948ebe69253939884b25738398480f3782ea87976401039d5d04e169418a64f49b3f686c9aa89f38ef0dcfe3c58136bd4790c78161ef14102277b65cd9f246
7
+ data.tar.gz: 96e5996ca8e4e98505e39f753cdced60255bca2d983e546c3d8266ab5999082f8bebd2ee583699c5e7370dcc46b8d3094cbc4ff3442c519372a02028b25ce5ba
data/.rspec_status ADDED
@@ -0,0 +1,7 @@
1
+ example_id | status | run_time |
2
+ ---------------------------- | ------ | --------------- |
3
+ ./spec/rise/cli_spec.rb[1:1] | passed | 0.00077 seconds |
4
+ ./spec/rise/cli_spec.rb[1:2] | passed | 0.00046 seconds |
5
+ ./spec/rise/cli_spec.rb[1:3] | passed | 0.00011 seconds |
6
+ ./spec/rise/cli_spec.rb[1:4] | passed | 0.00011 seconds |
7
+ ./spec/rise/cli_spec.rb[1:5] | passed | 0.08637 seconds |
data/Gemfile CHANGED
@@ -11,4 +11,5 @@ gem 'rex-text'
11
11
  gem 'rspec'
12
12
  gem 'rspec-core'
13
13
  gem 'rubocop'
14
+ gem 'subcommand'
14
15
  gem 'whirly'
data/Gemfile.lock CHANGED
@@ -50,6 +50,7 @@ GEM
50
50
  ruby-progressbar (~> 1.7)
51
51
  unicode-display_width (~> 1.0, >= 1.0.1)
52
52
  ruby-progressbar (1.9.0)
53
+ subcommand (1.0.6)
53
54
  unf (0.1.4)
54
55
  unf_ext
55
56
  unf_ext (0.0.7.4)
@@ -72,6 +73,7 @@ DEPENDENCIES
72
73
  rspec
73
74
  rspec-core
74
75
  rubocop
76
+ subcommand
75
77
  whirly
76
78
 
77
79
  BUNDLED WITH
data/bin/rise CHANGED
@@ -1,12 +1,11 @@
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
- # TODO
4
- # => Try to fix spinner bug on Windows (may be a weird interaction with \r)
5
3
  require 'core'
6
4
 
7
5
  options = {}
8
6
  options[:open] = false
9
7
  options[:ignore_files] = nil
8
+ # TODO: convert the tasks to use thor or Rex::Parser::Arguments from 'rex'
10
9
  OptionParser.new do |opts|
11
10
  opts.banner = "Usage: #{$PROGRAM_NAME} [options]\nRise version: #{Rise::Constants::VERSION}"
12
11
  opts.separator Paint["\nGeneral Options: ", '#95a5a6']
@@ -21,7 +20,7 @@ OptionParser.new do |opts|
21
20
  end
22
21
 
23
22
  opts.on('--verbose', 'Run verbosely') do |v|
24
- options[:verbose] = v
23
+ ENV['RISE_VERBOSE'] = 'yes'
25
24
  end
26
25
 
27
26
  opts.on('-i', '--ignore FILES', Array, 'Ignore the given files in the upload. These will be ignored if there is a .riseignore file.') do |a|
@@ -42,6 +41,14 @@ OptionParser.new do |opts|
42
41
  puts opts
43
42
  exit
44
43
  end
44
+
45
+ opts.separator Paint["\nTasks: ", '#95a5a6']
46
+ opts.on('--init', 'Reinitialize your password hash. (You will lose you old hash FOREVER)') do
47
+ Rise::Util.setup(false)
48
+ puts "\nPlease run the `rise` command again to upload your files using your new password."
49
+ exit 0
50
+ end
51
+
45
52
  end.parse!(ARGV)
46
53
 
47
54
 
@@ -8,7 +8,7 @@ module Rise
8
8
  # Holds constants used throughout the framework
9
9
  #
10
10
  module Constants
11
- VERSION = '0.2.3'.freeze
11
+ VERSION = '0.2.4'.freeze
12
12
  EMAIL = '0xCB@protonmail.com'.freeze
13
13
  AUTHORS = ['Carter Brainerd']
14
14
  NAME = 'rise-cli'.freeze
@@ -17,15 +17,14 @@ module Rise
17
17
  def initialize(folder_path, excluded_files = [], include_folder = true)
18
18
  excluded_files.map! do |a|
19
19
  File.join(File.absolute_path(folder_path), a)
20
- end unless excluded_files == []
20
+ end unless excluded_files.nil?
21
21
  @folder_path = folder_path
22
22
  @files = Dir.glob("#{File.absolute_path(folder_path)}/**/*")
23
- @files -= excluded_files
23
+ @files -= excluded_files unless excluded_files.nil?
24
24
  @total_files = @files.length
25
25
  @total_files_size = calculate_files_size
26
26
  @include_folder = include_folder
27
27
  @uuid = "#{File.basename(File.absolute_path(folder_path)).gsub('_', '-')}-#{Rex::Text.rand_text_alphanumeric(8)}" # Structure: foldername-8RNDLTRS
28
- puts @files
29
28
  end
30
29
 
31
30
  #
data/lib/core/util.rb CHANGED
@@ -72,27 +72,31 @@ module Rise
72
72
  #
73
73
  # Creates all of the necessary files and login information
74
74
  #
75
- def self.setup
76
- puts Paint['Detected first time setup, creating necessary files...', :blue]
77
- FileUtils.mkdir(RISE_DATA_DIR)
78
- FileUtils.mkdir(File.join(RISE_DATA_DIR, 'auth'))
75
+ def self.setup(first = true)
76
+ if first
77
+ puts Paint['Detected first time setup, creating necessary files...', :blue]
78
+ FileUtils.mkdir(RISE_DATA_DIR)
79
+ FileUtils.mkdir(File.join(RISE_DATA_DIR, 'auth'))
80
+ end
79
81
 
80
82
  puts Paint['Create a password to secure your uploads.', :bold]
81
- pw = signup
82
- while pw.length < 9
83
+ pw = Rise::Util.signup
84
+ while true
85
+ break if pw.length > 8
83
86
  puts Paint['Password not long enough,
84
87
  it has to be longer than 8 characters', :red]
85
- pw = signup
88
+ pw = Rise::Util.signup
86
89
  end
87
- File.open(File.join(RISE_DATA_DIR, 'auth', 'creds.json')) do |f|
88
- creds_hash = { 'hash' => BCrypt::Password.new(pw) }
90
+ File.open(File.join(RISE_DATA_DIR, 'auth', 'creds.json'), 'w') do |f|
91
+ vputs('Writing hash to creds.json...')
92
+ creds_hash = { 'hash' => BCrypt::Password.create(pw) }
89
93
  f.puts(JSON.pretty_generate(creds_hash))
90
94
  end
91
95
  end
92
96
 
93
- def signup
97
+ def self.signup
94
98
  print 'Password: '
95
- STDIN.noecho(&:gets)
99
+ STDIN.noecho(&:gets).chomp
96
100
  end
97
101
 
98
102
  #
data/lib/core.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  # Gems
2
2
  require 'clipboard'
3
3
  require 'rex/text'
4
- require 'optparse'
4
+ require 'subcommand'
5
5
 
6
6
  # lib files
7
7
  require 'core/transport'
8
8
  require 'core/util'
9
9
  require 'core/constants'
10
+ require 'core/text'
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.3
4
+ version: 0.2.4
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-29 00:00:00.000000000 Z
11
+ date: 2017-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard
@@ -88,6 +88,7 @@ extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
90
  - ".gitignore"
91
+ - ".rspec_status"
91
92
  - ".rubocop.yml"
92
93
  - ".travis.yml"
93
94
  - CONTRIBUTING.md