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 +4 -4
 - data/.rspec_status +7 -0
 - data/Gemfile +1 -0
 - data/Gemfile.lock +2 -0
 - data/bin/rise +10 -3
 - data/lib/core/constants.rb +1 -1
 - data/lib/core/transport.rb +2 -3
 - data/lib/core/util.rb +15 -11
 - data/lib/core.rb +2 -1
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: d5162dbadabf1ce5e3c6cae30d4b499299f3af19
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 9ad01e3cea0111f1a63997e3a4f89dea21076915
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 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
    
    
    
        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 
     | 
    
         
            -
                 
     | 
| 
      
 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 
     | 
    
         | 
    
        data/lib/core/constants.rb
    CHANGED
    
    
    
        data/lib/core/transport.rb
    CHANGED
    
    | 
         @@ -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 
     | 
    
         
            -
                   
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
      
 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  
     | 
| 
      
 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 
     | 
    
         
            -
                     
     | 
| 
      
 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
    
    
    
        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 
     | 
    
         
            +
              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- 
     | 
| 
      
 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
         
     |