rpw 0.0.4 → 1.1.0

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
  SHA256:
3
- metadata.gz: 205e752e88029cd06e1c2607e139d65981d676833b5bd5c164e67660bc5aad00
4
- data.tar.gz: 756763f53c8284c6e580b65c11a0ebbca90a1f0b8e60da5ec45861afe3551af9
3
+ metadata.gz: 317f37137765f78e5a587b36e3ecb4898d18e4b011cc3ef67f60d5d0e710c6d8
4
+ data.tar.gz: 4c9f5e3edf56c6dad2d887e4653d358850255dbf9682e0a6fcc8261e0e3a543f
5
5
  SHA512:
6
- metadata.gz: f40dfd8fd934dc4b6c37702d7e31897651f4f4c8fc172a30cce668408b09d161bf60d9172d9d68a556bf84b7d20c5d92b669ea88bd77ec40490ea7ec4d0b37ec
7
- data.tar.gz: 286dcb10eda24b9d9b0c4410317e2a85c10a19d55526682143f28a86f09e96ea64aaf0072fd37704435b2024b04d5f3594c98e5db00e77acfa98240ca281f2bf
6
+ metadata.gz: 7526987cc970e87b387154632256c89190b8cb7ec9fb9cfe9f1fe2364e73a46cabe81ecbe6a6707e8d5c7ca2c3a5f1591f2bf27d8b63a4e801ff69fcfefa1f11
7
+ data.tar.gz: eeb1628660e72e1d655e428c0640b6255ba43794db4704b42293eee6975a7f1a157c345ba6f2e87e8952af4198750d7aa271f7c925c4977d8f50e0f3e8fdb837
@@ -0,0 +1,109 @@
1
+ name: Test
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ name: >-
8
+ ${{ matrix.os }} ${{ matrix.ruby }}
9
+ env:
10
+ CI: true
11
+ TESTOPTS: -v
12
+
13
+ runs-on: ${{ matrix.os }}
14
+ if: |
15
+ !( contains(github.event.pull_request.title, '[ci skip]')
16
+ || contains(github.event.pull_request.title, '[skip ci]')
17
+ || contains(github.event.head_commit.message, '[ci skip]')
18
+ || contains(github.event.head_commit.message, '[skip ci]'))
19
+ strategy:
20
+ fail-fast: true
21
+ matrix:
22
+ os: [ ubuntu-20.04, macos-10.15, windows-2019 ]
23
+ ruby: [ 2.3, 2.6, 2.7, head ]
24
+
25
+ steps:
26
+ - name: repo checkout
27
+ uses: actions/checkout@v2
28
+
29
+ - name: load ruby
30
+ uses: MSP-Greg/setup-ruby-pkgs@v1
31
+ with:
32
+ ruby-version: ${{ matrix.ruby }}
33
+
34
+ - name: bundle install
35
+ run: |
36
+ bundle install --jobs 4 --retry 3
37
+
38
+ - name: standardrb
39
+ run: bundle exec standardrb
40
+
41
+ - name: test
42
+ run: bundle exec rake test
43
+
44
+ build-live:
45
+ services:
46
+ postgres:
47
+ image: postgres:alpine
48
+ env:
49
+ POSTGRES_PASSWORD: password
50
+ ports:
51
+ - 5432:5432
52
+ # needed because the postgres container does not provide a healthcheck
53
+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
54
+
55
+ name: Test against a live server
56
+ env:
57
+ CI: true
58
+ TESTOPTS: -v
59
+ LIVE_SERVER: true
60
+
61
+ runs-on: ubuntu-latest
62
+
63
+ steps:
64
+ - name: repo checkout
65
+ uses: actions/checkout@v2
66
+
67
+ - name: load ruby
68
+ uses: MSP-Greg/setup-ruby-pkgs@v1
69
+ with:
70
+ ruby-version: 2.7.2
71
+
72
+ - name: bundle install
73
+ run: |
74
+ bundle install --jobs 4 --retry 3
75
+
76
+ - uses: actions/checkout@master
77
+ with:
78
+ repository: speedshop/licensor
79
+ path: server
80
+
81
+ - name: nuke server ruby requirement
82
+ run: grep -v "^ruby" Gemfile > temp && mv -f temp Gemfile
83
+ working-directory: ./server
84
+
85
+ - name: bundle install the server
86
+ run: |
87
+ bundle install --jobs 4 --retry 3
88
+ bundle exec rails db:setup
89
+ working-directory: ./server
90
+ env:
91
+ POSTGRES_USER: postgres
92
+ POSTGRES_PASSWORD: password
93
+
94
+ - name: start the server
95
+ run: rails server &
96
+ working-directory: ./server
97
+ env:
98
+ POSTGRES_USER: postgres
99
+ POSTGRES_PASSWORD: password
100
+
101
+ - name: wait for server
102
+ run: |
103
+ until $(curl --output /dev/null --silent --head --fail http://localhost:3000); do
104
+ printf '.'
105
+ sleep 1
106
+ done
107
+
108
+ - name: test
109
+ run: bundle exec rake test
data/.gitignore CHANGED
@@ -3,3 +3,4 @@ bundle
3
3
  .rpw_key
4
4
  .rpw_info
5
5
  smoketest
6
+ scripts
@@ -1,51 +1,49 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rpw (0.0.4)
4
+ rpw (1.1.0)
5
+ cli-ui
6
+ excon
5
7
  thor
6
8
  thor-hollaback
7
- typhoeus
8
9
 
9
10
  GEM
10
11
  remote: https://rubygems.org/
11
12
  specs:
12
13
  ast (2.4.1)
13
- ethon (0.12.0)
14
- ffi (>= 1.3.0)
15
- ffi (1.13.1)
14
+ cli-ui (1.4.0)
15
+ excon (0.78.0)
16
16
  hollaback (0.1.0)
17
17
  minitest (5.14.2)
18
- parallel (1.19.2)
19
- parser (2.7.1.5)
18
+ parallel (1.20.0)
19
+ parser (2.7.2.0)
20
20
  ast (~> 2.4.1)
21
21
  rainbow (3.0.0)
22
22
  rake (13.0.1)
23
- regexp_parser (1.8.1)
23
+ regexp_parser (1.8.2)
24
24
  rexml (3.2.4)
25
- rubocop (0.92.0)
25
+ rubocop (1.2.0)
26
26
  parallel (~> 1.10)
27
27
  parser (>= 2.7.1.5)
28
28
  rainbow (>= 2.2.2, < 4.0)
29
- regexp_parser (>= 1.7)
29
+ regexp_parser (>= 1.8)
30
30
  rexml
31
- rubocop-ast (>= 0.5.0)
31
+ rubocop-ast (>= 1.0.1)
32
32
  ruby-progressbar (~> 1.7)
33
33
  unicode-display_width (>= 1.4.0, < 2.0)
34
- rubocop-ast (0.7.1)
34
+ rubocop-ast (1.1.1)
35
35
  parser (>= 2.7.1.5)
36
36
  rubocop-performance (1.8.1)
37
37
  rubocop (>= 0.87.0)
38
38
  rubocop-ast (>= 0.4.0)
39
39
  ruby-progressbar (1.10.1)
40
- standard (0.7)
41
- rubocop (= 0.92)
40
+ standard (0.9.0)
41
+ rubocop (= 1.2.0)
42
42
  rubocop-performance (= 1.8.1)
43
43
  thor (1.0.1)
44
44
  thor-hollaback (0.2.0)
45
45
  hollaback (~> 0.1.0)
46
46
  thor (>= 0.19.1)
47
- typhoeus (1.4.0)
48
- ethon (>= 0.9.0)
49
47
  unicode-display_width (1.7.0)
50
48
 
51
49
  PLATFORMS
data/HISTORY.md CHANGED
@@ -1,3 +1,24 @@
1
+ ## 1.1.0
2
+
3
+ * sick colors
4
+
5
+ ## 1.0.1
6
+
7
+ * Pre-launch bugfix
8
+
9
+ ## 1.0.0
10
+
11
+ * First release!
12
+
13
+ ## 0.0.6
14
+
15
+ * more bugfixes from beta testers
16
+ * CI
17
+
18
+ ## 0.0.5
19
+
20
+ * more bugfixes from beta testers
21
+
1
22
  ## 0.0.4
2
23
 
3
24
  * bugfixes
data/exe/rpw CHANGED
@@ -1,256 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "thor"
4
- require "thor/hollaback"
5
- require_relative "../lib/rpw"
6
-
7
- module RPW
8
- class SubCommandBase < Thor
9
- def self.banner(command, namespace = nil, subcommand = false)
10
- "#{basename} #{subcommand_prefix} #{command.usage}"
11
- end
12
-
13
- def self.subcommand_prefix
14
- name.gsub(%r{.*::}, "").gsub(%r{^[A-Z]}) { |match| match[0].downcase }.gsub(%r{[A-Z]}) { |match| "-#{match[0].downcase}" }
15
- end
16
-
17
- no_commands do
18
- def client
19
- @client ||= RPW::Client.new
20
- end
21
- end
22
- end
23
-
24
- class Key < SubCommandBase
25
- desc "register [EMAIL_ADDRESS]", "Change email registered with Speedshop. One-time only."
26
- def register(email)
27
- client.register_email(email)
28
- say "License registered. You should receive a Slack invite soon."
29
- end
30
- end
31
-
32
- class Lesson < SubCommandBase
33
- class_before :exit_with_no_key
34
-
35
- desc "next", "Proceed to the next lesson of the workshop"
36
- option :open
37
- def next
38
- say "Proceeding to next lesson..."
39
- client.next(options[:open])
40
- end
41
-
42
- desc "complete", "Mark the current lesson as complete"
43
-
44
- def complete
45
- say "Marked current lesson as complete"
46
- client.complete
47
- end
48
-
49
- desc "list", "Show all available workshop lessons"
50
-
51
- def list
52
- say "All available workshop lessons:"
53
- client.list.each do |lesson|
54
- puts "#{" " * lesson["indent"]}[#{lesson["position"]}]: #{lesson["title"]}"
55
- end
56
- end
57
-
58
- desc "download [CONTENT | all]", "Download one or all workshop contents"
59
-
60
- def download(content)
61
- client.download(content)
62
- end
63
-
64
- desc "show [CONTENT]", "Show any workshop lesson, shows current lesson w/no arguments"
65
- option :open
66
- def show(content = :current)
67
- client.show(content, options[:open])
68
- end
69
-
70
- private
71
-
72
- def exit_with_no_key
73
- exit(1) unless client.setup?
74
- end
75
- end
76
-
77
- class Progress < SubCommandBase
78
- class_before :exit_with_no_key
79
-
80
- desc "set [LESSON]", "Set current lesson to a particular lesson"
81
-
82
- def set(lesson)
83
- client.set_progress(lesson)
84
- end
85
-
86
- desc "reset", "Erase all progress and start over"
87
-
88
- def reset
89
- yes? "Are you sure you want to reset your progress? (Y/N)"
90
- client.reset_progress
91
- end
92
-
93
- desc "show", "Show current workshop progress"
94
- def show
95
- data = client.progress
96
- say "The Rails Performance Workshop"
97
- say "You have completed #{data[:completed]} out of #{data[:total]} total sections."
98
- say "Current lesson: #{data[:current_lesson]["title"]}"
99
- say "Progress by Section (X == completed, O == current):"
100
- data[:sections].each do |section|
101
- say "#{section[:title]}: #{section[:progress]}"
102
- end
103
- end
104
-
105
- private
106
-
107
- def exit_with_no_key
108
- exit(1) unless client.setup?
109
- end
110
-
111
- default_task :show
112
- end
113
-
114
- class CLI < Thor
115
- class_before :check_version
116
- class_before :check_setup
117
-
118
- desc "key register [EMAIL_ADDRESS]", "Change email registered w/Speedshop"
119
- subcommand "key", Key
120
- desc "lesson [SUBCOMMAND]", "View and download lessons"
121
- subcommand "lesson", Lesson
122
- desc "progress [SUBCOMMAND]", "View and set progress"
123
- subcommand "progress", Progress
124
-
125
- def self.exit_on_failure?
126
- true
127
- end
128
-
129
- desc "start", "Tutorial and onboarding"
130
-
131
- def start
132
- print_banner
133
- say "Welcome to the Rails Performance Workshop."
134
- say ""
135
- say "This is rpw, the command line client for this workshop."
136
- say ""
137
- say "This client will download files from the internet into the current"
138
- say "working directory, so it's best to run this client from a new directory"
139
- say "that you'll use as your 'scratch space' for working on the Workshop."
140
- say ""
141
- return unless yes? "Are you in a directory that we can safely add new folders and files to? (y/N)"
142
- puts ""
143
- say "We'll create a .rpw_info file at #{File.expand_path("~/.rpw")} to save your purchase key."
144
- home_dir_ok = yes?("Is this OK? (y/N) (N will create it in the current directory)")
145
-
146
- key = ask("Your Purchase Key: ")
147
-
148
- client.setup(key)
149
-
150
- puts ""
151
-
152
- say "Successfully authenticated with the RPW server and saved your key."
153
-
154
- puts ""
155
-
156
- say "rpw works by downloading files into the current working directory."
157
- say "We're going to (idempotently!) create a few directories in the current working directory."
158
- puts ""
159
- return unless yes? "Is that OK? (y/N)"
160
-
161
- client.directory_setup
162
-
163
- say "Setup complete!"
164
- puts ""
165
- say "Here are some important commands for you to know:"
166
- say "$ rpw lesson next | Proceed to the next part of the workshop."
167
- say "$ rpw lesson complete | Mark current lesson as complete."
168
- say "$ rpw lesson list | List all workshop lessons. Note each lesson is preceded with an ID."
169
- say "$ rpw lesson download | Download any or all lessons."
170
- say "$ rpw lesson show | Show any particular workshop lesson."
171
- say "$ rpw progress | Show where you're currently at in the workshop."
172
- say "$ rpw help | Help! You can also ask in Slack."
173
- puts ""
174
- say "Generally, you'll just be doing a lot of $ rpw lesson next"
175
- say "Remember to ask on Slack for help if you get stuck or encounter bugs."
176
- say "Let's get going! $ rpw lesson next"
177
- end
178
-
179
- no_commands do
180
- def print_banner
181
- puts r
182
- if `tput cols 80`.to_i < 80
183
- puts small_banner
184
- else
185
- puts banner
186
- end
187
- puts reset
188
- end
189
- end
190
-
191
- private
192
-
193
- def client
194
- @client ||= RPW::Client.new
195
- end
196
-
197
- def check_version
198
- unless client.latest_version?
199
- say "#{r}WARNING: You are running an old version of rpw."
200
- say "WARNING: Please run `$ gem install rpw`#{reset}"
201
- end
202
- end
203
-
204
- def check_setup
205
- unless client.setup? || current_command_chain == [:start]
206
- say "#{r}WARNING: You do not have a purchase key set. Run `$ rpw start`#{reset}"
207
- end
208
- end
209
-
210
- def r
211
- "\e[31m"
212
- end
213
-
214
- def reset
215
- "\e[0m"
216
- end
217
-
218
- def small_banner
219
- %(
220
- _____ _ _____ _ _
221
- |_ _| |_ ___ | __ |___|_| |___
222
- | | | | -_| | -| .'| | |_ -|
223
- |_| |_|_|___| |__|__|__,|_|_|___|
224
- _____ ___
225
- | _ |___ ___| _|___ ___ _____ ___ ___ ___ ___
226
- | __| -_| _| _| . | _| | .'| | _| -_|
227
- |__| |___|_| |_| |___|_| |_|_|_|__,|_|_|___|___|
228
- _ _ _ _ _
229
- | | | |___ ___| |_ ___| |_ ___ ___
230
- | | | | . | _| '_|_ -| | . | . |
231
- |_____|___|_| |_,_|___|_|_|___| _|
232
- |_|
233
- #{reset})
234
- end
235
-
236
- def banner
237
- %(
238
- _____ _ _____ _ _
239
- +hmNMMMMMm/` -ymMMNh/ |_ _| |_ ___ | __ |___|_| |___
240
- sMMMMMMMMMy +MMMMMMMMy | | | | -_| | -| .'| | |_ -|
241
- yMMMMMMMMMMy` yMMMMMMMMN |_| |_|_|___| |__|__|__,|_|_|___|
242
- `dMMMMMMMMMMm:-dMMMMMMm: _____ ___
243
- `sNMMMMMMMMMMs.:+sso:` | _ |___ ___| _|___ ___ _____ ___ ___ ___ ___
244
- :dMMMMMMMMMMm/ | __| -_| _| _| . | _| | .'| | _| -_|
245
- `:oss+:.sNMMMMMMMMMMy` |__| |___|_| |_| |___|_| |_|_|_|__,|_|_|___|___|
246
- /mMMMMMMd-:mMMMMMMMMMMd. _ _ _ _ _
247
- NMMMMMMMMy `hMMMMMMMMMMh | | | |___ ___| |_ ___| |_ ___ ___
248
- yMMMMMMMM+ `dMMMMMMMMMy | | | | . | _| '_|_ -| | . | . |
249
- /hNMMmy- `/mMMMMMNmy/ |_____|___|_| |_,_|___|_|_|___| _|
250
- |_|
251
- #{reset})
252
- end
253
- end
254
- end
3
+ require_relative "../lib/rpw/cli"
255
4
 
256
5
  RPW::CLI.start(ARGV)