rise-cli 0.2.1 → 0.2.3

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
  SHA1:
3
- metadata.gz: be2ded779e6eb515dec6f7a0a19a48c61b62b8d3
4
- data.tar.gz: ca6c31875c60f74d5d7d32c27d9782d6ff116b7d
3
+ metadata.gz: 19e77425e03eb395280293bd2bc937fd61097425
4
+ data.tar.gz: b46a75c6fcf17c3e2c1ba6d4edb82c956e2d5e94
5
5
  SHA512:
6
- metadata.gz: 3b7e2c3c13155c08a19e6a2b2289d83f567e9482b4d2c5825b1665c0c191c2183929d88201accdfe007798f468e03d39b02bee6de2bdfd01eae9aff0deaec6d1
7
- data.tar.gz: de0455fd745e927b93a3b2f1e05599a544cb9b0d2fa7058003e81420756da9fa93a9e9af1adc1863501c68fb1fbe0973dba9817a075317ef1545022c6c6007b1
6
+ metadata.gz: 95af0749ea3c6d1177ade8f38e58490ef58466a044dfddc919691ba085e9d68c9c315eb3a36045b0af2b1698e6ef8de9a0c5c2e430a735f1223161f7c81c7b76
7
+ data.tar.gz: 755c0afff754ca0932721b0b66963af59a346e14d03992e994f47fad7826d3e1cb3335d681e2d95da9bce21b5c024d54d291d6b646dcd54f08bac1af3ac16a67
data/.gitignore CHANGED
@@ -1,2 +1,2 @@
1
- # Old html files
2
- views
1
+ # Old html files
2
+ views
data/.rubocop.yml ADDED
@@ -0,0 +1,2 @@
1
+ Metrics/LineLength:
2
+ Max: 100
data/.travis.yml CHANGED
@@ -1,9 +1,9 @@
1
- language: ruby
2
- dist: trusty
3
- rvm:
4
- - 2.4
5
-
6
- script:
7
- - bundle && bundle install
8
- - bundle exec rspec
9
- - bundle exec rubocop --fail-level W
1
+ language: ruby
2
+ dist: trusty
3
+ rvm:
4
+ - 2.4
5
+
6
+ script:
7
+ - bundle && bundle install
8
+ - bundle exec rspec
9
+ - bundle exec rubocop --fail-level W
data/CONTRIBUTING.md CHANGED
@@ -1,27 +1,27 @@
1
- ## Thanks!
2
- Thank you for wanting to contribute to rise!
3
- If you want to contribute, there are a few guidelines that
4
- should generally be followed.
5
-
6
- ### How the contributing process goes
7
- 1. You create a pull request doing your best to follow the do's and dont's outlined below
8
- 2. I will review your code if it needs to be reviewed
9
- 3. If travis and codeclimate OK the changes, your code will be merged onto master and eventually shipped with the next gem release
10
-
11
- ### Code contributions
12
- * **Do** your best to stick to the [Ruby style guide]
13
- * **Do** follow the [50/72 rule] for Git commit messages.
14
- * **Do** make sure that there are no rubocop warnings on your new code (using `--fail-level W`)
15
-
16
- ### Pull Requests
17
- * **Do** have a clear, concise title
18
- * **Do** include as many details as possible in the pull request body
19
- * **Do** include console output (if applicable) in your pull request (asciinema if possible)
20
- * **Do** `require` your new file in `lib/core.rb` and place the file in `lib/core/`if you are adding new library code.
21
- * **Don't** leave your pull request descriptions blank.
22
- * **Don't** go radio silent on pull requests, try to reply fast so we can land your code quicker
23
- * **Dont't** get agitated if your request is not accepted.
24
-
25
-
26
- [Ruby style guide]:https://github.com/bbatsov/ruby-style-guide
27
- [50/72 rule]:http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
1
+ ## Thanks!
2
+ Thank you for wanting to contribute to rise!
3
+ If you want to contribute, there are a few guidelines that
4
+ should generally be followed.
5
+
6
+ ### How the contributing process goes
7
+ 1. You create a pull request doing your best to follow the do's and dont's outlined below
8
+ 2. I will review your code if it needs to be reviewed
9
+ 3. If travis and codeclimate OK the changes, your code will be merged onto master and eventually shipped with the next gem release
10
+
11
+ ### Code contributions
12
+ * **Do** your best to stick to the [Ruby style guide]
13
+ * **Do** follow the [50/72 rule] for Git commit messages.
14
+ * **Do** make sure that there are no rubocop warnings on your new code (using `--fail-level W`)
15
+
16
+ ### Pull Requests
17
+ * **Do** have a clear, concise title
18
+ * **Do** include as many details as possible in the pull request body
19
+ * **Do** include console output (if applicable) in your pull request (asciinema if possible)
20
+ * **Do** `require` your new file in `lib/core.rb` and place the file in `lib/core/`if you are adding new library code.
21
+ * **Don't** leave your pull request descriptions blank.
22
+ * **Don't** go radio silent on pull requests, try to reply fast so we can land your code quicker
23
+ * **Dont't** get agitated if your request is not accepted.
24
+
25
+
26
+ [Ruby style guide]:https://github.com/bbatsov/ruby-style-guide
27
+ [50/72 rule]:http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
data/Gemfile CHANGED
@@ -1,13 +1,14 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gem 'clipboard'
6
- gem 'http'
7
- gem 'os'
8
- gem 'paint'
9
- gem 'rex-text'
10
- gem 'rspec'
11
- gem 'rspec-core'
12
- gem 'rubocop'
13
- gem 'whirly'
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gem 'bcrypt', platforms: :ruby
6
+ gem 'clipboard'
7
+ gem 'http'
8
+ gem 'os'
9
+ gem 'paint'
10
+ gem 'rex-text'
11
+ gem 'rspec'
12
+ gem 'rspec-core'
13
+ gem 'rubocop'
14
+ gem 'whirly'
data/Gemfile.lock CHANGED
@@ -1,76 +1,78 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- addressable (2.5.2)
5
- public_suffix (>= 2.0.2, < 4.0)
6
- ast (2.3.0)
7
- clipboard (1.1.1)
8
- diff-lcs (1.3)
9
- domain_name (0.5.20170404)
10
- unf (>= 0.0.5, < 1.0.0)
11
- http (3.0.0)
12
- addressable (~> 2.3)
13
- http-cookie (~> 1.0)
14
- http-form_data (>= 2.0.0.pre.pre2, < 3)
15
- http_parser.rb (~> 0.6.0)
16
- http-cookie (1.0.3)
17
- domain_name (~> 0.5)
18
- http-form_data (2.0.0)
19
- http_parser.rb (0.6.0)
20
- os (1.0.0)
21
- paint (2.0.0)
22
- parallel (1.12.0)
23
- parser (2.4.0.0)
24
- ast (~> 2.2)
25
- powerpack (0.1.1)
26
- public_suffix (3.0.0)
27
- rainbow (2.2.2)
28
- rake
29
- rake (12.0.0)
30
- rex-text (0.2.15)
31
- rspec (3.6.0)
32
- rspec-core (~> 3.6.0)
33
- rspec-expectations (~> 3.6.0)
34
- rspec-mocks (~> 3.6.0)
35
- rspec-core (3.6.0)
36
- rspec-support (~> 3.6.0)
37
- rspec-expectations (3.6.0)
38
- diff-lcs (>= 1.2.0, < 2.0)
39
- rspec-support (~> 3.6.0)
40
- rspec-mocks (3.6.0)
41
- diff-lcs (>= 1.2.0, < 2.0)
42
- rspec-support (~> 3.6.0)
43
- rspec-support (3.6.0)
44
- rubocop (0.50.0)
45
- parallel (~> 1.10)
46
- parser (>= 2.3.3.1, < 3.0)
47
- powerpack (~> 0.1)
48
- rainbow (>= 2.2.2, < 3.0)
49
- ruby-progressbar (~> 1.7)
50
- unicode-display_width (~> 1.0, >= 1.0.1)
51
- ruby-progressbar (1.9.0)
52
- unf (0.1.4)
53
- unf_ext
54
- unf_ext (0.0.7.4)
55
- unf_ext (0.0.7.4-x64-mingw32)
56
- unicode-display_width (1.3.0)
57
- whirly (0.2.5)
58
- unicode-display_width (~> 1.1)
59
-
60
- PLATFORMS
61
- ruby
62
- x64-mingw32
63
-
64
- DEPENDENCIES
65
- clipboard
66
- http
67
- os
68
- paint
69
- rex-text
70
- rspec
71
- rspec-core
72
- rubocop
73
- whirly
74
-
75
- BUNDLED WITH
76
- 1.15.4
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ addressable (2.5.2)
5
+ public_suffix (>= 2.0.2, < 4.0)
6
+ ast (2.3.0)
7
+ bcrypt (3.1.11)
8
+ clipboard (1.1.1)
9
+ diff-lcs (1.3)
10
+ domain_name (0.5.20170404)
11
+ unf (>= 0.0.5, < 1.0.0)
12
+ http (3.0.0)
13
+ addressable (~> 2.3)
14
+ http-cookie (~> 1.0)
15
+ http-form_data (>= 2.0.0.pre.pre2, < 3)
16
+ http_parser.rb (~> 0.6.0)
17
+ http-cookie (1.0.3)
18
+ domain_name (~> 0.5)
19
+ http-form_data (2.0.0)
20
+ http_parser.rb (0.6.0)
21
+ os (1.0.0)
22
+ paint (2.0.0)
23
+ parallel (1.12.0)
24
+ parser (2.4.0.0)
25
+ ast (~> 2.2)
26
+ powerpack (0.1.1)
27
+ public_suffix (3.0.0)
28
+ rainbow (2.2.2)
29
+ rake
30
+ rake (12.0.0)
31
+ rex-text (0.2.15)
32
+ rspec (3.6.0)
33
+ rspec-core (~> 3.6.0)
34
+ rspec-expectations (~> 3.6.0)
35
+ rspec-mocks (~> 3.6.0)
36
+ rspec-core (3.6.0)
37
+ rspec-support (~> 3.6.0)
38
+ rspec-expectations (3.6.0)
39
+ diff-lcs (>= 1.2.0, < 2.0)
40
+ rspec-support (~> 3.6.0)
41
+ rspec-mocks (3.6.0)
42
+ diff-lcs (>= 1.2.0, < 2.0)
43
+ rspec-support (~> 3.6.0)
44
+ rspec-support (3.6.0)
45
+ rubocop (0.50.0)
46
+ parallel (~> 1.10)
47
+ parser (>= 2.3.3.1, < 3.0)
48
+ powerpack (~> 0.1)
49
+ rainbow (>= 2.2.2, < 3.0)
50
+ ruby-progressbar (~> 1.7)
51
+ unicode-display_width (~> 1.0, >= 1.0.1)
52
+ ruby-progressbar (1.9.0)
53
+ unf (0.1.4)
54
+ unf_ext
55
+ unf_ext (0.0.7.4)
56
+ unf_ext (0.0.7.4-x64-mingw32)
57
+ unicode-display_width (1.3.0)
58
+ whirly (0.2.5)
59
+ unicode-display_width (~> 1.1)
60
+
61
+ PLATFORMS
62
+ ruby
63
+ x64-mingw32
64
+
65
+ DEPENDENCIES
66
+ bcrypt
67
+ clipboard
68
+ http
69
+ os
70
+ paint
71
+ rex-text
72
+ rspec
73
+ rspec-core
74
+ rubocop
75
+ whirly
76
+
77
+ BUNDLED WITH
78
+ 1.15.4
data/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2017 Carter Brainerd
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Carter Brainerd
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,63 +1,63 @@
1
- ![rise](https://github.com/cbrnrd/rise/raw/master/img/rise_logo.png)
2
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
3
- [![Code Climate](https://img.shields.io/codeclimate/github/cbrnrd/rise.svg?style=flat-square)](https://codeclimate.com/github/cbrnrd/rise)
4
- [![Build Status](https://img.shields.io/travis/cbrnrd/rise.svg?style=flat-square)](https://travis-ci.org/cbrnrd/rise)
5
- [![Gem](https://img.shields.io/gem/v/rise-cli.svg?style=flat-square)](https://rubygems.org/gems/rise-cli)
6
- [![Gem](https://img.shields.io/gem/dt/rise-cli.svg?style=flat-square)](https://rubygems.org/gems/rise-cli)
7
- [![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square)](https://github.com/cbrnrd/rise/blob/master/LICENSE)
8
-
9
- # Usage
10
-
11
- Using rise is simple, just run the `rise` command
12
-
13
- [![asciicast](https://asciinema.org/a/Z7aigs1yAaqJWYqL1fQaqv9yt.png)](https://asciinema.org/a/Z7aigs1yAaqJWYqL1fQaqv9yt)
14
-
15
- ## Installing
16
-
17
- In order to get rise up and running, there's 2 ways you can install it.
18
-
19
- 1. Download the gem
20
-
21
- ```
22
- gem install rise-cli
23
- ```
24
-
25
- 2. Build from source
26
-
27
- ```
28
- $ git clone https://github.com/cbrnrd/rise
29
- $ bundle install
30
- ```
31
-
32
- ## Built With
33
-
34
- - [RubyGems](https://rubygems.org) - the Ruby community's gem hosting service
35
- - [Atom](https://atom.io/) - A hackable text editor for the 21st Century
36
- - [DigitalOcean](https://digitalocean.com) - Used for server hosting
37
-
38
- ## Contributing
39
-
40
- Please read [CONTRIBUTING.md](https://github.com/cbrnrd/rise/blob/master/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting a pull requests.
41
-
42
- ## Features
43
- - No need to install git, svn, or any other version control software.
44
- - No complex cloud setup
45
- - Extremely fast upload speeds
46
- - Unlimited unique URL's
47
- - No manual setup of websites
48
- - Your services are always served over a secure connection
49
- - Open source so that you can know exactly what code is runnning on your computer.
50
-
51
- ## Coming soon
52
- - gzip file transfer
53
- - actual use of the password hash for secure uploads
54
-
55
- ## Authors
56
-
57
- - **Carter Brainerd** - [Website](https://carterbrainerd.me)
58
-
59
- See also the list of [contributors](https://github.com/cbrnrd/rise/contributors) who participated in this project.
60
-
61
- ## License
62
-
63
- This project is licensed under the MIT License - see the [LICENSE](https://github.com/cbrnrd/rise/blob/master/LICENSE) file for details
1
+ [![rise](https://github.com/cbrnrd/rise/raw/master/img/rise_logo.png)](https://rise.sh)
2
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
3
+ [![Code Climate](https://img.shields.io/codeclimate/github/cbrnrd/rise.svg?style=flat-square)](https://codeclimate.com/github/cbrnrd/rise)
4
+ [![Build Status](https://img.shields.io/travis/cbrnrd/rise.svg?style=flat-square)](https://travis-ci.org/cbrnrd/rise)
5
+ [![Gem](https://img.shields.io/gem/v/rise-cli.svg?style=flat-square)](https://rubygems.org/gems/rise-cli)
6
+ [![Gem](https://img.shields.io/gem/dt/rise-cli.svg?style=flat-square)](https://rubygems.org/gems/rise-cli)
7
+ [![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square)](https://github.com/cbrnrd/rise/blob/master/LICENSE)
8
+
9
+ # Usage
10
+
11
+ Using rise is simple, just run the `rise` command
12
+
13
+ [![asciicast](https://asciinema.org/a/Z7aigs1yAaqJWYqL1fQaqv9yt.png)](https://asciinema.org/a/Z7aigs1yAaqJWYqL1fQaqv9yt)
14
+
15
+ ## Installing
16
+
17
+ In order to get rise up and running, there's 2 ways you can install it.
18
+
19
+ 1. Download the gem
20
+
21
+ ```
22
+ gem install rise-cli
23
+ ```
24
+
25
+ 2. Build from source
26
+
27
+ ```
28
+ $ git clone https://github.com/cbrnrd/rise
29
+ $ bundle install
30
+ ```
31
+
32
+ ## Built With
33
+
34
+ - [RubyGems](https://rubygems.org) - the Ruby community's gem hosting service
35
+ - [Atom](https://atom.io/) - A hackable text editor for the 21st Century
36
+ - [DigitalOcean](https://digitalocean.com) - Used for server hosting
37
+
38
+ ## Contributing
39
+
40
+ Please read [CONTRIBUTING.md](https://github.com/cbrnrd/rise/blob/master/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting a pull requests.
41
+
42
+ ## Features
43
+ - No need to install git, svn, or any other version control software.
44
+ - No complex cloud setup
45
+ - Extremely fast upload speeds
46
+ - Unlimited unique URL's
47
+ - No manual setup of websites
48
+ - Your services are always served over a secure connection
49
+ - Open source so that you can know exactly what code is runnning on your computer.
50
+
51
+ ## Coming soon
52
+ - gzip file transfer
53
+ - actual use of the password hash for secure uploads
54
+
55
+ ## Authors
56
+
57
+ - **Carter Brainerd** - [Website](https://carterbrainerd.me)
58
+
59
+ See also the list of [contributors](https://github.com/cbrnrd/rise/contributors) who participated in this project.
60
+
61
+ ## License
62
+
63
+ This project is licensed under the MIT License - see the [LICENSE](https://github.com/cbrnrd/rise/blob/master/LICENSE) file for details
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task default: :spec
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/TODO.txt CHANGED
@@ -1,5 +1,6 @@
1
- TODO things for rise:
2
- * FIX THE DAMN AUTH ARCHITECTURE SO IT WORKS DAMN IT
3
- * Add a .keyfile to each upload containing a private key. This file will be used to make sure that the same uuid can't be uploaded to twice and for a future file deletion method.
4
- * Add said file deletion method
5
- * Add GZIP file uploads
1
+ TODO things for rise:
2
+ * FIX THE DAMN AUTH ARCHITECTURE SO IT WORKS DAMN IT
3
+ * Add a .keyfile to each upload containing a private key. This file will be used to make sure that the same uuid can't be uploaded to twice and for a future file deletion method.
4
+ * Add said file deletion method
5
+ * Add GZIP file uploads
6
+ * ADD .riseignore functionality
data/bin/console CHANGED
@@ -1,14 +1,14 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "rise"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rise"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/rise CHANGED
@@ -1,70 +1,85 @@
1
- #!/usr/bin/env ruby
2
-
3
- # TODO
4
- # => Try to fix spinner bug on Windows (may be a weird interaction with \r)
5
-
6
- require 'core'
7
-
8
- options = {}
9
- options[:open] = false
10
- OptionParser.new do |opts|
11
- opts.banner = "Usage: #{$PROGRAM_NAME} [options]\nRise version: #{Rise::Constants::VERSION}"
12
- opts.separator Paint["\nGeneral Options: ", '#95a5a6']
13
-
14
- opts.on('--version', 'Show the rise version and exit') do
15
- puts "Rise version: #{Paint[Rise::Constants::VERSION, '#2ecc71']}"
16
- exit 0
17
- end
18
-
19
- opts.on('-v', '--verbose', 'Run verbosely') do |v|
20
- options[:verbose] = v
21
- end
22
- # directory flag
23
- opts.on('-d DIR', '--dir DIR', String, 'Upload files in DIR') do |d|
24
- options[:directory] = d unless d.nil?
25
- end
26
-
27
- opts.on('-u', '--update', 'Check if rise has a newer version and install it') do
28
- Rise::Util.check_for_update!
29
- exit 0
30
- end
31
-
32
- opts.on('-o', '--open', 'Open the deployment in a browser if possible') do
33
- options[:open] = true
34
- end
35
-
36
- opts.on('-h', '--help', 'Show this help message') do
37
- puts opts
38
- exit
39
- end
40
- end.parse!(ARGV)
41
-
42
- if Rise::Util.first_run?
43
- Rise::Util.setup
44
- puts "\nPlease run the `rise` command again to upload your files."
45
- exit 0
46
- end
47
- Rise::Util.check_for_update!
48
- result_url = ''
49
- uploader = Rise::Transport::Uploader.new(options[:directory] || Dir.pwd)
50
-
51
- if uploader.total_files_size > 52428800
52
- puts Paint["Max file size reached (#{uploader.total_files_size} > 50MB)", '#FF0000']
53
- exit 0
54
- end
55
-
56
- puts Paint['Thanks for using Rise! Your local source for serverless deployment!', '#95a5a6']
57
-
58
- Whirly.start(spinner: 'dots', status: "Uploading files (#{uploader.total_files} total files)") do
59
- beginning_time = Time.now
60
- result_url = uploader.upload!(options[:verbose]) # Do the file upload
61
-
62
- Whirly.status = "Done!\n"
63
- Clipboard.copy(result_url)
64
- print Paint["Your url is: #{result_url} (copied to clipboard) ", :bold]
65
- puts Paint["[#{((Time.now - beginning_time)).round(2)}s]", '#95a5a6']
66
-
67
- puts Paint['Deployment successful!', '#3498db']
68
-
69
- Rise::Util.open_deployment_in_browser(result_url) if options[:open]
70
- end
1
+ #!/usr/bin/env ruby
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
+ require 'core'
6
+
7
+ options = {}
8
+ options[:open] = false
9
+ options[:ignore_files] = nil
10
+ OptionParser.new do |opts|
11
+ opts.banner = "Usage: #{$PROGRAM_NAME} [options]\nRise version: #{Rise::Constants::VERSION}"
12
+ opts.separator Paint["\nGeneral Options: ", '#95a5a6']
13
+
14
+ opts.on('-d DIR', '--dir DIR', String, 'Upload files in DIR') do |d|
15
+ options[:directory] = d unless d.nil?
16
+ end
17
+
18
+ opts.on('-v', '--version', 'Show the rise version and exit') do
19
+ puts "Rise version: #{Paint[Rise::Constants::VERSION, '#2ecc71']}"
20
+ exit 0
21
+ end
22
+
23
+ opts.on('--verbose', 'Run verbosely') do |v|
24
+ options[:verbose] = v
25
+ end
26
+
27
+ 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|
28
+ options[:ignored_files] = a unless a.nil?
29
+ puts "Reminder: You can add the files to .riseignore instead of using the -i flag"
30
+ end
31
+
32
+ opts.on('-o', '--open', 'Open the deployment in a browser if possible') do
33
+ options[:open] = true
34
+ end
35
+
36
+ opts.on('-u', '--update', 'Check if rise has a newer version and install it') do
37
+ Rise::Util.check_for_update!
38
+ exit 0
39
+ end
40
+
41
+ opts.on('-h', '--help', 'Show this help message') do
42
+ puts opts
43
+ exit
44
+ end
45
+ end.parse!(ARGV)
46
+
47
+
48
+ if Rise::Util.first_run?
49
+ Rise::Util.setup
50
+ puts "\nPlease run the `rise` command again to upload your files."
51
+ exit 0
52
+ end
53
+ Rise::Util.check_for_update!
54
+ dir = options[:directory] || Dir.pwd
55
+ ignored = nil
56
+ result_url = ''
57
+
58
+ begin
59
+ ignored = File.read(File.join(dir, '.riseignore')).split("\n").map { |a| a.gsub!(' ', '')}
60
+ rescue Errno::ENOENT
61
+ ignored = options[:ignored_files]
62
+ end
63
+
64
+ uploader = Rise::Transport::Uploader.new(dir, ignored)
65
+
66
+ if uploader.total_files_size > 52428800
67
+ puts Paint["Max file size reached (#{uploader.total_files_size} > 50MB)", '#FF0000']
68
+ exit 0
69
+ end
70
+
71
+ puts Paint['Thanks for using Rise! Your local source for serverless deployment!', '#95a5a6']
72
+
73
+ Whirly.start(spinner: 'dots', status: "Uploading files (#{uploader.total_files} total files)") do
74
+ beginning_time = Time.now
75
+ result_url = uploader.upload!(options[:verbose]) # Do the file upload
76
+
77
+ Whirly.status = "Done!\n"
78
+ Clipboard.copy(result_url)
79
+ print Paint["Your url is: #{result_url} (copied to clipboard) ", :bold]
80
+ puts Paint["[#{((Time.now - beginning_time)).round(2)}s]", '#95a5a6']
81
+
82
+ puts Paint['Deployment successful!', '#3498db']
83
+
84
+ Rise::Util.open_deployment_in_browser(result_url) if options[:open]
85
+ end
data/bin/setup CHANGED
File without changes
@@ -1,17 +1,17 @@
1
- RISE_DATA_DIR = File.join(Dir.home, '.rise')
2
- DOMAIN = 'rise.sh'.freeze
3
- AUTH_PORT = 4567
4
- UPLOAD_PORT = 8080
5
-
6
- module Rise
7
- #
8
- # Holds constants used throughout the framework
9
- #
10
- module Constants
11
- VERSION = '0.2.1'.freeze
12
- EMAIL = '0xCB@protonmail.com'.freeze
13
- AUTHORS = ['Carter Brainerd']
14
- NAME = 'rise-cli'.freeze
15
- RISE_DIR = File.join(File.dirname(__FILE__), '..', '..')
16
- end
17
- end
1
+ RISE_DATA_DIR = File.join(Dir.home, '.rise')
2
+ DOMAIN = 'rise.sh'.freeze
3
+ AUTH_PORT = 4567
4
+ UPLOAD_PORT = 8080
5
+
6
+ module Rise
7
+ #
8
+ # Holds constants used throughout the framework
9
+ #
10
+ module Constants
11
+ VERSION = '0.2.3'.freeze
12
+ EMAIL = '0xCB@protonmail.com'.freeze
13
+ AUTHORS = ['Carter Brainerd']
14
+ NAME = 'rise-cli'.freeze
15
+ RISE_DIR = File.join(File.dirname(__FILE__), '..', '..')
16
+ end
17
+ end
@@ -1,61 +1,66 @@
1
- require 'rex/text'
2
- require 'uri'
3
- require 'json'
4
- require 'http'
5
-
6
- module Rise
7
- #
8
- # Handles all communication with the rise upload server
9
- #
10
- module Transport
11
- # Handles uploading files
12
- class Uploader
13
- attr_reader :folder_path, :total_files, :include_folder
14
- attr_reader :uuid, :current_file, :total_files_size
15
- attr_accessor :files
16
-
17
- def initialize(folder_path, include_folder = true)
18
- @folder_path = folder_path
19
- @files = Dir.glob("#{File.absolute_path(folder_path)}/**/*")
20
- @total_files = @files.length
21
- @total_files_size = calculate_files_size
22
- @include_folder = include_folder
23
- @uuid = "#{File.basename(File.absolute_path(folder_path))}-#{Rex::Text.rand_text_alphanumeric(8)}" # Structure: foldername-8RNDLTRS
24
- end
25
-
26
- #
27
- # Uploads the files from +folder_path+ to the upload server
28
- # @return String the final URL of the uploaded contents
29
- #
30
- def upload!(*)
31
- upload_uri_base = "http://rise.sh:8080/api/v1/#{@uuid}"
32
- access_uri = "https://rise.sh/#{@uuid}"
33
- uri = ''
34
-
35
- # This sorts the files by (file path) length.
36
- # It is supposed to make the server make the first layer of files
37
- # before the rest of the layers.
38
- ordered_files = files.sort_by(&:length)
39
- ordered_files.each do |f|
40
- isdir = File.directory?(f)
41
- final_path = File.absolute_path(f).gsub(
42
- File.expand_path(folder_path), '')
43
- uri = URI.parse("#{upload_uri_base}/#{final_path}?dir=#{isdir}")
44
- begin
45
- HTTP.put(uri.to_s, body: File.read(f))
46
- rescue Errno::EISDIR
47
- HTTP.put(uri.to_s, body: '')
48
- next
49
- end
50
- end
51
- access_uri
52
- end
53
-
54
- protected
55
-
56
- def calculate_files_size
57
- @files.inject(0){|sum, file| sum + File.size(file)}
58
- end
59
- end
60
- end
61
- end
1
+ require 'rex/text'
2
+ require 'uri'
3
+ require 'json'
4
+ require 'http'
5
+
6
+ module Rise
7
+ #
8
+ # Handles all communication with the rise upload server
9
+ #
10
+ module Transport
11
+ # Handles uploading files
12
+ class Uploader
13
+ attr_reader :folder_path, :total_files, :include_folder
14
+ attr_reader :uuid, :current_file, :total_files_size
15
+ attr_accessor :files
16
+
17
+ def initialize(folder_path, excluded_files = [], include_folder = true)
18
+ excluded_files.map! do |a|
19
+ File.join(File.absolute_path(folder_path), a)
20
+ end unless excluded_files == []
21
+ @folder_path = folder_path
22
+ @files = Dir.glob("#{File.absolute_path(folder_path)}/**/*")
23
+ @files -= excluded_files
24
+ @total_files = @files.length
25
+ @total_files_size = calculate_files_size
26
+ @include_folder = include_folder
27
+ @uuid = "#{File.basename(File.absolute_path(folder_path)).gsub('_', '-')}-#{Rex::Text.rand_text_alphanumeric(8)}" # Structure: foldername-8RNDLTRS
28
+ puts @files
29
+ end
30
+
31
+ #
32
+ # Uploads the files from +folder_path+ to the upload server
33
+ # @return String the final URL of the uploaded contents
34
+ #
35
+ def upload!(*)
36
+ upload_uri_base = "http://rise.sh:8080/api/v1/#{@uuid}"
37
+ access_uri = "https://rise.sh/#{@uuid}"
38
+ uri = ''
39
+
40
+ # This sorts the files by (file path) length.
41
+ # It is supposed to make the server make the first layer of files
42
+ # before the rest of the layers.
43
+ ordered_files = files.sort_by(&:length)
44
+ ordered_files.each do |f|
45
+ isdir = File.directory?(f)
46
+ final_path = File.absolute_path(f).gsub(
47
+ File.expand_path(folder_path), '')
48
+ uri = URI.parse("#{upload_uri_base}/#{final_path.gsub(' ', '')}?dir=#{isdir}")
49
+ begin
50
+ HTTP.put(uri.to_s, body: File.read(f))
51
+ rescue Errno::EISDIR
52
+ HTTP.put(uri.to_s, body: '')
53
+ next
54
+ end
55
+ end
56
+ access_uri
57
+ end
58
+
59
+ protected
60
+
61
+ def calculate_files_size
62
+ @files.inject(0){|sum, file| sum + File.size(file)}
63
+ end
64
+ end
65
+ end
66
+ end
data/lib/core/util.rb CHANGED
@@ -1,109 +1,110 @@
1
- require 'fileutils'
2
- require 'paint'
3
- require 'json'
4
- require 'http'
5
- require 'digest'
6
- require 'io/console'
7
- require 'whirly'
8
- require 'os'
9
- require 'json'
10
- require_relative 'constants'
11
-
12
- module Rise
13
- #
14
- # Utility methods
15
- #
16
- module Util
17
- #
18
- # Checks if rise is being run for the first time
19
- #
20
- def self.first_run?
21
- !File.directory?(File.join(Dir.home, '.rise'))
22
- end
23
-
24
- #
25
- # 1 = git, 2 = gem, 3 = unknown
26
- #
27
- def self.git_or_gem
28
- gem = nil
29
- 1 if File.exist?(File.join(Rise::Constants::VERSION, '.git'))
30
- if OS.windows?
31
- gem = system('which gem > NUL')
32
- else
33
- gem = system('which gem > /dev/null')
34
- end
35
-
36
- 2 if gem == true
37
- 3
38
- end
39
-
40
- #
41
- # Check for a new version of the gem
42
- #
43
- def self.check_for_update!
44
- src = Rise::Util.git_or_gem
45
- begin
46
- if src == 2 # if the gem was downloaded from rubygems
47
- current_version = JSON.parse(HTTP.get('https://rubygems.org/api/v1/versions/rise-cli/latest.json'))['version']
48
- if current_version != Rise::Constants::VERSION
49
- Whirly.start(
50
- spinner: 'line',
51
- status: "New version available (#{Paint[Rise::Constants::VERSION, 'red']} -> #{Paint[current_version, '#3498db']}), updating..."
52
- ) do
53
- system("gem uninstall rise-cli -v #{Rise::Constants::VERSION} > /dev/null")
54
- system("gem install rise-cli > /dev/null")
55
- puts Paint["Update complete, just run #{Paint['`rise`', '#3498db']} to deploy"]
56
- end
57
- end
58
- 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
65
- end
66
- rescue StandardError => e
67
- puts "Unable to check for updates. Error: #{Paint[e.message, 'red']}"
68
- exit 1
69
- end
70
- end
71
-
72
- #
73
- # Creates all of the necessary files and login information
74
- #
75
- def self.setup
76
- puts Paint['Detected first time run, creating necessary files...', :blue]
77
- FileUtils.mkdir(RISE_DATA_DIR)
78
- FileUtils.mkdir(File.join(RISE_DATA_DIR, 'auth'))
79
-
80
- # TODO: Reimplement when the backend server actually works
81
- # Get the input from the user
82
- # print Paint['1. Log in\n2. Sign up\n > ', :bold]
83
- # while (choice = gets.chomp!)
84
- # if choice == '1'
85
- # login
86
- # break
87
- # elsif choice == '2'
88
- # signup
89
- # break
90
- # else
91
- # puts Paint['Please type `1` or `2`', :red]
92
- # next
93
- # end
94
- # end
95
- end
96
-
97
- #
98
- # Opens +url+ in a web browser if possible
99
- #
100
- def self.open_deployment_in_browser(url)
101
- if OS.windows?
102
- system("START \"\" \"#{url}\"")
103
- else
104
- system("open #{url}")
105
- end
106
- end
107
-
108
- end
109
- end
1
+ require 'fileutils'
2
+ require 'paint'
3
+ require 'json'
4
+ require 'http'
5
+ require 'bcrypt'
6
+ require 'io/console'
7
+ require 'whirly'
8
+ require 'os'
9
+ require 'json'
10
+ require_relative 'constants'
11
+
12
+ module Rise
13
+ #
14
+ # Utility methods
15
+ #
16
+ module Util
17
+ #
18
+ # Checks if rise is being run for the first time
19
+ #
20
+ def self.first_run?
21
+ !File.directory?(File.join(Dir.home, '.rise'))
22
+ end
23
+
24
+ #
25
+ # 1 = git, 2 = gem, 3 = unknown
26
+ #
27
+ def self.git_or_gem
28
+ gem = nil
29
+ 1 if File.exist?(File.join(Rise::Constants::VERSION, '.git'))
30
+ if OS.windows?
31
+ gem = system('which gem > NUL')
32
+ else
33
+ gem = system('which gem > /dev/null')
34
+ end
35
+
36
+ 2 if gem == true
37
+ 3
38
+ end
39
+
40
+ #
41
+ # Check for a new version of the gem
42
+ #
43
+ def self.check_for_update!
44
+ src = Rise::Util.git_or_gem
45
+ begin
46
+ if src == 2 # if the gem was downloaded from rubygems
47
+ current_version = JSON.parse(HTTP.get('https://rubygems.org/api/v1/versions/rise-cli/latest.json'))['version']
48
+ if current_version != Rise::Constants::VERSION
49
+ Whirly.start(
50
+ spinner: 'line',
51
+ status: "New version available (#{Paint[Rise::Constants::VERSION, 'red']} -> #{Paint[current_version, '#3498db']}), updating..."
52
+ ) do
53
+ system("gem uninstall rise-cli -v #{Rise::Constants::VERSION} > /dev/null")
54
+ system("gem install rise-cli > /dev/null")
55
+ puts Paint["Update complete, just run #{Paint['`rise`', '#3498db']} to deploy"]
56
+ end
57
+ end
58
+ 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
65
+ end
66
+ rescue StandardError => e
67
+ puts "Unable to check for updates. Error: #{Paint[e.message, 'red']}"
68
+ exit 1
69
+ end
70
+ end
71
+
72
+ #
73
+ # Creates all of the necessary files and login information
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'))
79
+
80
+ puts Paint['Create a password to secure your uploads.', :bold]
81
+ pw = signup
82
+ while pw.length < 9
83
+ puts Paint['Password not long enough,
84
+ it has to be longer than 8 characters', :red]
85
+ pw = signup
86
+ end
87
+ File.open(File.join(RISE_DATA_DIR, 'auth', 'creds.json')) do |f|
88
+ creds_hash = { 'hash' => BCrypt::Password.new(pw) }
89
+ f.puts(JSON.pretty_generate(creds_hash))
90
+ end
91
+ end
92
+
93
+ def signup
94
+ print 'Password: '
95
+ STDIN.noecho(&:gets)
96
+ end
97
+
98
+ #
99
+ # Opens +url+ in a web browser if possible
100
+ #
101
+ def self.open_deployment_in_browser(url)
102
+ if OS.windows?
103
+ system("START \"\" \"#{url}\"")
104
+ else
105
+ system("open #{url}")
106
+ end
107
+ end
108
+
109
+ end
110
+ end
data/lib/core.rb CHANGED
@@ -1,9 +1,9 @@
1
- # Gems
2
- require 'clipboard'
3
- require 'rex/text'
4
- require 'optparse'
5
-
6
- # lib files
7
- require 'core/transport'
8
- require 'core/util'
9
- require 'core/constants'
1
+ # Gems
2
+ require 'clipboard'
3
+ require 'rex/text'
4
+ require 'optparse'
5
+
6
+ # lib files
7
+ require 'core/transport'
8
+ require 'core/util'
9
+ require 'core/constants'
data/rise-cli.gemspec CHANGED
@@ -1,24 +1,24 @@
1
- # Put all our core library files in the require path
2
- $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), 'lib')))
3
- require 'core'
4
-
5
- Gem::Specification.new do |s|
6
- s.name = Rise::Constants::NAME
7
- s.version = Rise::Constants::VERSION
8
- s.executables = %w[rise setup console]
9
- s.date = Time.now.strftime('%Y-%m-%d')
10
- s.summary = 'Simple serverless website deployment'
11
- s.authors = Rise::Constants::AUTHORS
12
- s.email = Rise::Constants::EMAIL
13
- s.files = `git ls-files`.split($/).reject { |file|
14
- file =~ /^server|^spec|^pkg/
15
- }
16
- s.homepage = 'http://rubygems.org/gems/rise-cli'
17
- s.license = 'MIT'
18
-
19
- s.add_runtime_dependency 'clipboard'
20
- s.add_runtime_dependency 'http'
21
- s.add_runtime_dependency 'paint'
22
- s.add_runtime_dependency 'rex-text'
23
- s.add_runtime_dependency 'whirly'
24
- end
1
+ # Put all our core library files in the require path
2
+ $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), 'lib')))
3
+ require 'core'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = Rise::Constants::NAME
7
+ s.version = Rise::Constants::VERSION
8
+ s.executables = %w[rise]
9
+ s.date = Time.now.strftime('%Y-%m-%d')
10
+ s.summary = 'Simple serverless website deployment'
11
+ s.authors = Rise::Constants::AUTHORS
12
+ s.email = Rise::Constants::EMAIL
13
+ s.files = `git ls-files`.split($/).reject { |file|
14
+ file =~ /^server|^spec|^pkg/
15
+ }
16
+ s.homepage = 'http://rubygems.org/gems/rise-cli'
17
+ s.license = 'MIT'
18
+
19
+ s.add_runtime_dependency 'clipboard'
20
+ s.add_runtime_dependency 'http'
21
+ s.add_runtime_dependency 'paint'
22
+ s.add_runtime_dependency 'rex-text'
23
+ s.add_runtime_dependency 'whirly'
24
+ 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.2.1
4
+ version: 0.2.3
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-21 00:00:00.000000000 Z
11
+ date: 2017-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard
@@ -84,12 +84,11 @@ description:
84
84
  email: 0xCB@protonmail.com
85
85
  executables:
86
86
  - rise
87
- - setup
88
- - console
89
87
  extensions: []
90
88
  extra_rdoc_files: []
91
89
  files:
92
90
  - ".gitignore"
91
+ - ".rubocop.yml"
93
92
  - ".travis.yml"
94
93
  - CONTRIBUTING.md
95
94
  - Gemfile
@@ -127,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
126
  version: '0'
128
127
  requirements: []
129
128
  rubyforge_project:
130
- rubygems_version: 2.4.8
129
+ rubygems_version: 2.5.2
131
130
  signing_key:
132
131
  specification_version: 4
133
132
  summary: Simple serverless website deployment