nora 0.6 → 0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/nora/core.rb +12 -8
- data/lib/nora/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fccab401ac7eb09b7078c9c8cb94e1be04e2b7bd
|
4
|
+
data.tar.gz: 5fb238bea537fc61cb54b57a27651d5f8d0dd7dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 674557ebf7c90291761f684d521713a44b746ffd8a0a600784807616f00f3a97fd130af2832f4e2e1923305b77ab359df6009e972f79028e38fb0d971068a79c
|
7
|
+
data.tar.gz: 88c5b8b0ca68a77046bf60ba91b79c4cc1dd7cf1867c1a74546b318666e6f4b7fbc92845ce6255c09e8297a1abb3ea0a04ec5c3825fa7733faaf0ff9734e3831
|
data/lib/nora/core.rb
CHANGED
@@ -65,15 +65,13 @@ module Nora
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def run!
|
68
|
+
load_history! # Populate @history for load_calendars!
|
69
|
+
load_calendars! # Outside the loop to reduce calls to Google API.
|
68
70
|
begin
|
69
|
-
|
70
|
-
puts "Loading calendars..."
|
71
|
-
load_calendars!
|
72
|
-
puts "Creating groups..."
|
71
|
+
shuffle_emails!
|
73
72
|
create_groups!
|
74
73
|
rescue SystemStackError
|
75
74
|
remove_oldest_pair!
|
76
|
-
|
77
75
|
retry
|
78
76
|
end
|
79
77
|
|
@@ -93,9 +91,9 @@ module Nora
|
|
93
91
|
# calendar in the configuration file without us
|
94
92
|
# having to manually add them in the UI.
|
95
93
|
def load_calendars!
|
96
|
-
puts "Loading calendars"
|
97
|
-
@emails = CONFIGURATION["people"].map { |p| p["email"] }
|
98
|
-
@emails.each do |email|
|
94
|
+
puts "Loading calendars..."
|
95
|
+
@emails = CONFIGURATION["people"].map { |p| p["email"] }
|
96
|
+
(Set.new(@emails) - @history).each do |email|
|
99
97
|
puts "Loading calendar: #{email}"
|
100
98
|
@service.insert_calendar_list(
|
101
99
|
Google::Apis::CalendarV3::CalendarListEntry.new(id: email)
|
@@ -103,6 +101,11 @@ module Nora
|
|
103
101
|
end
|
104
102
|
end
|
105
103
|
|
104
|
+
def shuffle_emails!
|
105
|
+
puts "Shuffling emails..."
|
106
|
+
@emails = @emails.shuffle
|
107
|
+
end
|
108
|
+
|
106
109
|
def remove_oldest_pair!
|
107
110
|
puts "Removing oldest pair and retrying..."
|
108
111
|
File.open("past_pairings_tmp.txt", "w") do |file|
|
@@ -124,6 +127,7 @@ module Nora
|
|
124
127
|
end
|
125
128
|
|
126
129
|
def create_groups!
|
130
|
+
puts "Creating groups..."
|
127
131
|
@emails.each_slice(group_size).each do |emails|
|
128
132
|
return create_groups! unless (@history & emails.combination(2)).empty?
|
129
133
|
end
|
data/lib/nora/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nora
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.7'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacob Evelyn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|