Skip to content

Commit f8572aa

Browse files
committed
Add script to update dojo stats
1 parent 4f0bac7 commit f8572aa

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

_data/stats.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
active_dojos: 180

update_profile.rb

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env ruby
2+
3+
require 'net/http'
4+
require 'json'
5+
require 'yaml'
6+
7+
BASE_URL = 'https://coderdojo.jp'
8+
DOJO_STATS = JSON.parse Net::HTTP.get(URI.parse "#{BASE_URL}/stats.json"), symbolize_names: true
9+
STATS_PATH = '_data/stats.yml'
10+
11+
stats = YAML.load_file(STATS_PATH)
12+
stats['active_dojos'] = DOJO_STATS[:active_dojos]
13+
YAML.dump stats, File.open(STATS_PATH, 'w')

0 commit comments

Comments
 (0)