Skip to content

Commit c1501a6

Browse files
committed
Add tasks to seed and analyze article topics
1 parent ea27f33 commit c1501a6

File tree

6 files changed

+303
-282
lines changed

6 files changed

+303
-282
lines changed

app/jobs/pages/analyze_topics_job.rb

Lines changed: 5 additions & 278 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Credit for this topics analysis job logic and OpenAI prompt goes to
2+
# rubyvideo.dev. Please support their platform!
3+
14
module Pages
25
class AnalyzeTopicsJob < ApplicationJob
36
queue_as :default
@@ -68,287 +71,11 @@ def messages(page)
6871
end
6972

7073
def approved_topics
71-
[
72-
"A/B Testing",
73-
"Accessibility (a11y)",
74-
"ActionCable",
75-
"ActionMailbox",
76-
"ActionMailer",
77-
"ActionPack",
78-
"ActionText",
79-
"ActionView",
80-
"ActiveJob",
81-
"ActiveModel",
82-
"ActiveRecord",
83-
"ActiveStorage",
84-
"ActiveSupport",
85-
"Algorithms",
86-
"Arel",
87-
"Artificial Intelligence (AI)",
88-
"Authentication",
89-
"Authorization",
90-
"Automation",
91-
"Background jobs",
92-
"Behavior-Driven Development (BDD)",
93-
"Blogging",
94-
"Bootstrapping",
95-
"Bundler",
96-
"Business Logic",
97-
"Business",
98-
"Caching",
99-
"Capybara",
100-
"Career Development",
101-
"CI/CD",
102-
"Client-Side Rendering",
103-
"Code Golfing",
104-
"Code Organization",
105-
"Code Quality",
106-
"Command Line Interface (CLI)",
107-
"Communication",
108-
"Community",
109-
"Compiling",
110-
"Components",
111-
"Computer Vision",
112-
"Concurrency",
113-
"Containers",
114-
"Content Management System (CMS)",
115-
"Content Management",
116-
"Continuous Integration (CI)",
117-
"Contributing",
118-
"CRuby",
119-
"Crystal",
120-
"CSS",
121-
"Data Analysis",
122-
"Data Integrity",
123-
"Data Migrations",
124-
"Data Persistence",
125-
"Data Processing",
126-
"Database Sharding",
127-
"Databases",
128-
"Debugging",
129-
"Dependency Management",
130-
"Deployment",
131-
"Design Patterns",
132-
"Developer Expierience (DX)",
133-
"Developer Tooling",
134-
"Developer Tools",
135-
"Developer Workflows",
136-
"DevOps",
137-
"Distributed Systems",
138-
"Diversity & Inclusion",
139-
"Docker",
140-
"Documentation Tools",
141-
"Documentation",
142-
"Domain Driven Design",
143-
"Domain Specific Language (DSL)",
144-
"dry-rb",
145-
"Duck Typing",
146-
"E-Commerce",
147-
"Early-Career Devlopers",
148-
"Editor",
149-
"Elm",
150-
"Encoding",
151-
"Encryption",
152-
"Engineering Culture",
153-
"Error Handling",
154-
"Ethics",
155-
"Event Sourcing",
156-
"Fibers",
157-
"Flaky Tests",
158-
"Frontend",
159-
"Functional Programming",
160-
"Games",
161-
"Geocoding",
162-
"git",
163-
"Go",
164-
"Graphics",
165-
"GraphQL",
166-
"gRPC",
167-
"Hacking",
168-
"Hanami",
169-
"Hotwire",
170-
"HTML",
171-
"HTTP API",
172-
"Hybrid Apps",
173-
"Indie Developer",
174-
"Inspiration",
175-
"Integrated Development Environment (IDE)",
176-
"Integration Test",
177-
"Internals",
178-
"Internationalization (I18n)",
179-
"Interview",
180-
"iOS",
181-
"Java Virtual Machine (JVM)",
182-
"JavaScript",
183-
"Job Interviewing",
184-
"JRuby",
185-
"JSON Web Tokens (JWT)",
186-
"Just-In-Time (JIT)",
187-
"Kafka",
188-
"Keynote",
189-
"Language Server Protocol (LSP)",
190-
"Large Language Models (LLM)",
191-
"Leadership",
192-
"Legacy Applications",
193-
"Licensing",
194-
"Lightning Talks",
195-
"Linters",
196-
"Live Coding",
197-
"Localization (L10N)",
198-
"Logging",
199-
"Machine Learning",
200-
"Majestic Monolith",
201-
"Markup",
202-
"Math",
203-
"Memory Managment",
204-
"Mental Health",
205-
"Mentorship",
206-
"MFA/2FA",
207-
"Microcontroller",
208-
"Microservices",
209-
"Minimum Viable Product (MVP)",
210-
"Minitest",
211-
"MJIT",
212-
"Mocking",
213-
"Model-View-Controller (MVC)",
214-
"Monitoring",
215-
"Monolith",
216-
"mruby",
217-
"Multitenancy",
218-
"Music",
219-
"MySQL",
220-
"Naming",
221-
"Native Apps",
222-
"Native Extensions",
223-
"Networking",
224-
"Object-Oriented Programming (OOP)",
225-
"Object-Relational Mapper (ORM)",
226-
"Observability",
227-
"Offline-First",
228-
"Open Source",
229-
"Organizational Skills",
230-
"Pair Programming",
231-
"Panel Discussion",
232-
"Parallelism",
233-
"Parsing",
234-
"Passwords",
235-
"People Skills",
236-
"Performance",
237-
"Personal Development",
238-
"Phlex",
239-
"Podcasts",
240-
"PostgreSQL",
241-
"Pricing",
242-
"Privacy",
243-
"Productivity",
244-
"Profiling",
245-
"Progressive Web Apps (PWA)",
246-
"Project Planning",
247-
"Quality Assurance (QA)",
248-
"Questions and Anwsers (Q&A)",
249-
"Rack",
250-
"Ractors",
251-
"Rails at Scale",
252-
"Rails Engine",
253-
"Rails Plugins",
254-
"Rails Upgrades",
255-
"Railties",
256-
"React.js",
257-
"Real-Time Applications",
258-
"Refactoring",
259-
"Regex",
260-
"Remote Work",
261-
"Reporting",
262-
"REST API",
263-
"REST",
264-
"RJIT",
265-
"Robot",
266-
"RPC",
267-
"RSpec",
268-
"Ruby Implementations",
269-
"Ruby on Rails",
270-
"Ruby VM",
271-
"Rubygems",
272-
"Rust",
273-
"Scaling",
274-
"Science",
275-
"Security Vulnerability",
276-
"Security",
277-
"Selenium",
278-
"Server-side Rendering",
279-
"Servers",
280-
"Service Objects",
281-
"Shoes.rb",
282-
"Sidekiq",
283-
"Sinatra",
284-
"Single Page Applications (SPA)",
285-
"Software Architecture",
286-
"Sonic Pi",
287-
"Sorbet",
288-
"SQLite",
289-
"Startups",
290-
"Static Typing",
291-
"Stimulus.js",
292-
"Structured Query Language (SQL)",
293-
"Success Stories",
294-
"Swift",
295-
"Syntax",
296-
"System Programming",
297-
"System Test",
298-
"Tailwind CSS",
299-
"Teaching",
300-
"Team Building",
301-
"Teams",
302-
"Teamwork",
303-
"Templating",
304-
"Template Engine",
305-
"Test Coverage",
306-
"Test Framework",
307-
"Test-Driven Development",
308-
"Testing",
309-
"Testing",
310-
"Threads",
311-
"Timezones",
312-
"Tips & Tricks",
313-
"Trailblazer",
314-
"Translation",
315-
"Transpilation",
316-
"TruffleRuby",
317-
"Turbo Native",
318-
"Turbo",
319-
"Turbo Frames",
320-
"Turbo Streams",
321-
"Type Checking",
322-
"Types",
323-
"Typing",
324-
"UI Design",
325-
"Unit Test",
326-
"Usability",
327-
"User Interface (UI)",
328-
"Version Control",
329-
"ViewComponent",
330-
"Views",
331-
"Virtual Machine",
332-
"Vue.js",
333-
"Web Components",
334-
"Web Server",
335-
"Websockets",
336-
"why the lucky stiff",
337-
"Workshop",
338-
"Writing",
339-
"YARV (Yet Another Ruby VM)",
340-
"YJIT (Yet Another Ruby JIT)"
341-
]
74+
Topic.approved.pluck(:name)
34275
end
34376

34477
def rejected_topics
345-
[
346-
"Politics",
347-
"Religion",
348-
"Custom Settings",
349-
"Dynamic Rendering",
350-
"Dynamic CSS"
351-
]
78+
Topic.rejected.pluck(:name)
35279
end
35380

35481
def prompt(page)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module Pages
2+
class BatchAnalyzeTopicsJob < ApplicationJob
3+
queue_as :default
4+
5+
def perform
6+
Page.where(request_path: SitepressArticle.published.map(&:request_path)).find_each do |page|
7+
Pages::AnalyzeTopicsJob.perform_later(page)
8+
end
9+
end
10+
end
11+
end

app/models/page.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,4 @@ def title = resource.data.title
4040
def body = resource.body
4141

4242
def description = resource.data.description
43-
44-
def analyze_topics!
45-
Pages::AnalyzeTopicsJob.perform_later(self)
46-
end
4743
end

0 commit comments

Comments
 (0)