rpw 0.0.5 → 1.2.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: d147256fce52a088acb2caa0043222c16dfc73e09292006929e1b9d40372d70a
4
- data.tar.gz: 211b34b2aff01a30220d65ad12120a240042634c2f815d91e2e4e72023a9fbf7
3
+ metadata.gz: c4c79a03ffb13bfdd6fd37581cdca30aa3a69712608add26105f51b130b15fcb
4
+ data.tar.gz: '05079633b4d192a7654dea1f82972ecb735ea634de59c5e83bde843eec73ef42'
5
5
  SHA512:
6
- metadata.gz: d2985f855f66246dd289959e287985011ae11e828a2daeb90c4f3e49a45e99b5ee05ba9b0fa67596c9067ec492cf40f548ecc5649e2c6769c6e366d74f402fb8
7
- data.tar.gz: ef3be513985a20e01a16249fd2b71e2a026875327fcfe101a83e8da0d05751b7ccd594fd7f984b046f669fa7b49552969967d922d48d00f29767add9906f7d01
6
+ metadata.gz: f81567fe95bda4102cc1109e8f643043ee9dcb58d0fc81c1c9faee34ff91fcc3ba3d7265f718c473a19eafbdcf852801c6bea803ddf49c7ad74280f8a85cd3dc
7
+ data.tar.gz: 66fb292f109656d91d97166733ba21f095d0c7f1cfd06a82e580ab87c8b4bb2d28b03eb95dcb02c32ca5eb4a7e2d379a04afa5b9ae419511c927ea9755c1f877
@@ -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.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
+ gem install bundler && 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.5)
4
+ rpw (1.2.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,25 @@
1
+ ## 1.2.0
2
+
3
+ * Actual release version!
4
+ * Greatly streamlined commands
5
+
6
+ ## 1.1.0
7
+
8
+ * sick colors
9
+
10
+ ## 1.0.1
11
+
12
+ * Pre-launch bugfix
13
+
14
+ ## 1.0.0
15
+
16
+ * First release!
17
+
18
+ ## 0.0.6
19
+
20
+ * more bugfixes from beta testers
21
+ * CI
22
+
1
23
  ## 0.0.5
2
24
 
3
25
  * more bugfixes from beta testers
data/exe/rpw CHANGED
@@ -1,247 +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
-
22
- def exit_with_no_key
23
- unless client.setup?
24
- say "You have not yet set up the client. Run $ rpw start"
25
- exit(1)
26
- end
27
- unless client.directories_ready?
28
- say "You are not in your workshop scratch directory, or you have not yet"
29
- say "set up the client. Change directory or run $ rpw start"
30
- exit(1)
31
- end
32
- end
33
- end
34
- end
35
-
36
- class Key < SubCommandBase
37
- desc "register [EMAIL_ADDRESS]", "Change email registered with Speedshop. One-time only."
38
- def register(email)
39
- client.register_email(email)
40
- say "License registered. You should receive a Slack invite soon."
41
- end
42
- end
43
-
44
- class Lesson < SubCommandBase
45
- class_before :exit_with_no_key
46
-
47
- desc "next", "Proceed to the next lesson of the workshop"
48
- option :open
49
- def next
50
- say "Proceeding to next lesson..."
51
- client.next(options[:open])
52
- end
53
-
54
- desc "complete", "Mark the current lesson as complete"
55
-
56
- def complete
57
- say "Marked current lesson as complete"
58
- client.complete
59
- end
60
-
61
- desc "list", "Show all available workshop lessons"
62
-
63
- def list
64
- say "All available workshop lessons:"
65
- client.list.each do |lesson|
66
- puts "#{" " * lesson["indent"]}[#{lesson["position"]}]: #{lesson["title"]}"
67
- end
68
- end
69
-
70
- desc "download [CONTENT | all]", "Download one or all workshop contents"
71
-
72
- def download(content)
73
- client.download(content)
74
- end
75
-
76
- desc "show [CONTENT]", "Show any workshop lesson, shows current lesson w/no arguments"
77
- option :open
78
- def show(content = :current)
79
- client.show(content, options[:open])
80
- end
81
- end
82
-
83
- class Progress < SubCommandBase
84
- class_before :exit_with_no_key
85
-
86
- desc "set [LESSON]", "Set current lesson to a particular lesson"
87
-
88
- def set(lesson)
89
- client.set_progress(lesson)
90
- end
91
-
92
- desc "reset", "Erase all progress and start over"
93
-
94
- def reset
95
- yes? "Are you sure you want to reset your progress? (Y/N)"
96
- client.reset_progress
97
- end
98
-
99
- desc "show", "Show current workshop progress"
100
- def show
101
- data = client.progress
102
- say "The Rails Performance Workshop"
103
- say "You have completed #{data[:completed]} out of #{data[:total]} total sections."
104
- say "Current lesson: #{data[:current_lesson]["title"]}"
105
- say "Progress by Section (X == completed, O == current):"
106
- data[:sections].each do |section|
107
- say "#{section[:title]}: #{section[:progress]}"
108
- end
109
- end
110
-
111
- private
112
-
113
- default_task :show
114
- end
115
-
116
- class CLI < Thor
117
- class_before :check_version
118
- class_before :check_setup
119
-
120
- desc "key register [EMAIL_ADDRESS]", "Change email registered w/Speedshop"
121
- subcommand "key", Key
122
- desc "lesson [SUBCOMMAND]", "View and download lessons"
123
- subcommand "lesson", Lesson
124
- desc "progress [SUBCOMMAND]", "View and set progress"
125
- subcommand "progress", Progress
126
-
127
- def self.exit_on_failure?
128
- true
129
- end
130
-
131
- desc "start", "Tutorial and onboarding"
132
-
133
- def start
134
- warn_if_already_started
135
-
136
- print_banner
137
- say "Welcome to the Rails Performance Workshop."
138
- say ""
139
- say "This is rpw, the command line client for this workshop."
140
- say ""
141
- say "This client will download files from the internet into the current"
142
- say "working directory, so it's best to run this client from a new directory"
143
- say "that you'll use as your 'scratch space' for working on the Workshop."
144
- say ""
145
- say "We will create a handful of new files and folders in the current directory."
146
- return unless yes? "Is this OK? (y/N) (N will quit)"
147
- puts ""
148
- say "We'll also create a .rpw_info file at #{File.expand_path("~/.rpw")} to save your purchase key."
149
- home_dir_ok = yes?("Is this OK? (y/N) (N will create it in the current directory)")
150
- client.directory_setup(home_dir_ok)
151
-
152
- key = ask("Your Purchase Key: ")
153
-
154
- client.setup(key)
155
- puts ""
156
- say "Successfully authenticated with the RPW server and saved your key."
157
- puts ""
158
- say "Setup complete!"
159
- puts ""
160
- say "To learn how to use this command-line client, consult README.md."
161
- say "Remember to ask on Slack for help if you get stuck or encounter bugs."
162
- say "Once you're ready to get going: $ rpw lesson next"
163
- end
164
-
165
- no_commands do
166
- def print_banner
167
- puts r
168
- if `tput cols 80`.to_i < 80
169
- puts small_banner
170
- else
171
- puts banner
172
- end
173
- puts reset
174
- end
175
- end
176
-
177
- private
178
-
179
- def client
180
- @client ||= RPW::Client.new
181
- end
182
-
183
- def warn_if_already_started
184
- return unless client.setup?
185
- exit(0) unless yes? "You have already started the workshop. Continuing this command will wipe all of your current progress. Continue? (y/N)"
186
- end
187
-
188
- def check_version
189
- unless client.latest_version?
190
- say "#{r}WARNING: You are running an old version of rpw."
191
- say "WARNING: Please run `$ gem install rpw`#{reset}"
192
- end
193
- end
194
-
195
- def check_setup
196
- unless client.setup? || current_command_chain == [:start]
197
- say "#{r}WARNING: You do not have a purchase key set. Run `$ rpw start`#{reset}"
198
- end
199
- end
200
-
201
- def r
202
- "\e[31m"
203
- end
204
-
205
- def reset
206
- "\e[0m"
207
- end
208
-
209
- def small_banner
210
- %(
211
- _____ _ _____ _ _
212
- |_ _| |_ ___ | __ |___|_| |___
213
- | | | | -_| | -| .'| | |_ -|
214
- |_| |_|_|___| |__|__|__,|_|_|___|
215
- _____ ___
216
- | _ |___ ___| _|___ ___ _____ ___ ___ ___ ___
217
- | __| -_| _| _| . | _| | .'| | _| -_|
218
- |__| |___|_| |_| |___|_| |_|_|_|__,|_|_|___|___|
219
- _ _ _ _ _
220
- | | | |___ ___| |_ ___| |_ ___ ___
221
- | | | | . | _| '_|_ -| | . | . |
222
- |_____|___|_| |_,_|___|_|_|___| _|
223
- |_|
224
- #{reset})
225
- end
226
-
227
- def banner
228
- %(
229
- _____ _ _____ _ _
230
- +hmNMMMMMm/` -ymMMNh/ |_ _| |_ ___ | __ |___|_| |___
231
- sMMMMMMMMMy +MMMMMMMMy | | | | -_| | -| .'| | |_ -|
232
- yMMMMMMMMMMy` yMMMMMMMMN |_| |_|_|___| |__|__|__,|_|_|___|
233
- `dMMMMMMMMMMm:-dMMMMMMm: _____ ___
234
- `sNMMMMMMMMMMs.:+sso:` | _ |___ ___| _|___ ___ _____ ___ ___ ___ ___
235
- :dMMMMMMMMMMm/ | __| -_| _| _| . | _| | .'| | _| -_|
236
- `:oss+:.sNMMMMMMMMMMy` |__| |___|_| |_| |___|_| |_|_|_|__,|_|_|___|___|
237
- /mMMMMMMd-:mMMMMMMMMMMd. _ _ _ _ _
238
- NMMMMMMMMy `hMMMMMMMMMMh | | | |___ ___| |_ ___| |_ ___ ___
239
- yMMMMMMMM+ `dMMMMMMMMMy | | | | . | _| '_|_ -| | . | . |
240
- /hNMMmy- `/mMMMMMNmy/ |_____|___|_| |_,_|___|_|_|___| _|
241
- |_|
242
- #{reset})
243
- end
244
- end
245
- end
3
+ require_relative "../lib/rpw/cli"
246
4
 
247
5
  RPW::CLI.start(ARGV)