reading_assignments 0.1.3

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 04b72178e370837df8a5f4730963cd6ffbfdc896
4
+ data.tar.gz: abbd6d36fd9e6919a5c0d034de207daa4722c420
5
+ SHA512:
6
+ metadata.gz: 0dcf79b20b08179af5ba9ec5f1383b3f6dfa157c896648f31ef0bc00629413b17aaa38a66b050eb7e7574ca454c4808fa4e5383f1a6e9cc057e61b1d12cd5a42
7
+ data.tar.gz: 62074762d43bf028627280a6939782af8ea816c5ab7d47bd73581157d4728d2ddff80387b53bc8d07b879396898b09e7fe4b775dde2b9bf0b7b29a26c4795aec
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.15.1
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in reading_assignments.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Mike Thomson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # ReadingAssignments
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/reading_assignments`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'reading_assignments'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install reading_assignments
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/reading_assignments.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "reading_assignments"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,3 @@
1
+ #!/user/bin/env ruby
2
+
3
+ require 'reading_assignments'
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,12 @@
1
+ class InputValidator
2
+
3
+ def self.get_type_input
4
+ input = gets.chomp
5
+ while !['number', 'string', 'random'].include?(input)
6
+ puts 'Please try again, that was not valid'
7
+ input = gets.chomp
8
+ end
9
+ return input
10
+ end
11
+
12
+ end
data/lib/members.yaml ADDED
File without changes
@@ -0,0 +1,26 @@
1
+ class MentorGroup
2
+ attr_reader :members, :name
3
+
4
+ def initialize(members = [])
5
+ @members = members
6
+ end
7
+
8
+ def fill_mentor_group(array_of_students)
9
+ array_of_students.each do |student|
10
+ @members << student
11
+ end
12
+ end
13
+
14
+ def self.create_persisted_mentees(store)
15
+ puts 'What are the names of the people in your group (please separate by comma)?'
16
+ name_string = gets.chomp
17
+ new_mentees = name_string.split(', ')
18
+
19
+ mentees = new_mentees.map { |mentee| Student.new(mentee) }
20
+
21
+ store.transaction do
22
+ store["mentees"] = mentees
23
+ end
24
+ return mentees
25
+ end
26
+ end
@@ -0,0 +1,40 @@
1
+ require "reading_assignments/version"
2
+ require 'pry'
3
+ require 'csv'
4
+ require 'yaml/store'
5
+ require_relative 'mentor_group'
6
+ require_relative 'student'
7
+ require_relative 'student_randomizer'
8
+ require_relative 'input_validator'
9
+
10
+ module ReadingAssignments
11
+
12
+ store = YAML::Store.new("members.yaml")
13
+ mentees = store.transaction { store["mentees"] }
14
+
15
+ if !mentees
16
+ mentees = MentorGroup.create_persisted_mentees(store)
17
+ end
18
+
19
+ mentor_group = MentorGroup.new(mentees)
20
+
21
+ randomizer = StudentRandomizer.new(mentor_group)
22
+
23
+ puts 'How would you like to choose your group (number, string, random)?'
24
+ random_type = InputValidator.get_type_input
25
+
26
+ puts 'How many articles do you need to assign?'
27
+ article_number = gets.chomp.to_i
28
+
29
+ if random_type == 'number'
30
+ puts 'What number would you like to use?'
31
+ number = gets.chomp.to_i
32
+ randomizer.choose_by_number(number, article_number)
33
+ elsif random_type == 'string'
34
+ puts 'What is your secret random passcode?'
35
+ passcode = gets.chomp
36
+ randomizer.choose_by_string(passcode, article_number)
37
+ else
38
+ randomizer.choose_totally_random(article_number)
39
+ end
40
+ end
@@ -0,0 +1,3 @@
1
+ module ReadingAssignments
2
+ VERSION = "0.1.3"
3
+ end
data/lib/student.rb ADDED
@@ -0,0 +1,8 @@
1
+ class Student
2
+ attr_reader :name
3
+
4
+ def initialize(name)
5
+ @name = name
6
+ end
7
+
8
+ end
@@ -0,0 +1,42 @@
1
+ class StudentRandomizer
2
+
3
+ def initialize(mentor_group)
4
+ @mentor_group = mentor_group
5
+ @group_size = @mentor_group.members.length
6
+ @chosen_students = []
7
+ end
8
+
9
+ def choose_by_number(number, articles)
10
+ random_generator = Random.new(number)
11
+ output_students(random_generator, articles)
12
+ end
13
+
14
+ def choose_by_string(string, articles)
15
+ seed_number = string.sum
16
+ random_generator = Random.new(seed_number)
17
+ output_students(random_generator, articles)
18
+ end
19
+
20
+ def choose_totally_random(articles)
21
+ random_generator = Random.new
22
+ output_students(random_generator, articles)
23
+ end
24
+
25
+ def output_students(random_generator, articles)
26
+ articles.times do
27
+ random_index = random_generator.rand(0...@group_size)
28
+ student = chosen_student(random_index)
29
+ until !@chosen_students.include?(student)
30
+ random_index = random_generator.rand(0...@group_size)
31
+ student = chosen_student(random_index)
32
+ end
33
+ puts student.name
34
+ @chosen_students << student
35
+ end
36
+ end
37
+
38
+ def chosen_student(random_index)
39
+ @mentor_group.members[random_index]
40
+ end
41
+
42
+ end
data/members.yaml ADDED
File without changes
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "reading_assignments/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "reading_assignments"
8
+ spec.version = ReadingAssignments::VERSION
9
+ spec.authors = ["Mike Thomson"]
10
+ spec.email = ["michaelgt04@gmail.com\n"]
11
+
12
+ spec.summary = "Assign Launch Readings"
13
+ spec.description = "You can use this gem to assign your readings to your mentees"
14
+ spec.homepage = "https://github.com/michaelgt04/debugging-clinic"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+
20
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
21
+ f.match(%r{^(test|spec|features)/})
22
+ end
23
+ spec.executables = ["reading_assignments"]
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.15"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rspec", "~> 3.0"
29
+ spec.add_development_dependency "pry"
30
+ end
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: reading_assignments
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
5
+ platform: ruby
6
+ authors:
7
+ - Mike Thomson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-06-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.15'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.15'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: You can use this gem to assign your readings to your mentees
70
+ email:
71
+ - 'michaelgt04@gmail.com
72
+
73
+ '
74
+ executables:
75
+ - reading_assignments
76
+ extensions: []
77
+ extra_rdoc_files: []
78
+ files:
79
+ - ".gitignore"
80
+ - ".rspec"
81
+ - ".travis.yml"
82
+ - Gemfile
83
+ - LICENSE.txt
84
+ - README.md
85
+ - Rakefile
86
+ - bin/console
87
+ - bin/reading_assignments
88
+ - bin/setup
89
+ - lib/input_validator.rb
90
+ - lib/members.yaml
91
+ - lib/mentor_group.rb
92
+ - lib/reading_assignments.rb
93
+ - lib/reading_assignments/version.rb
94
+ - lib/student.rb
95
+ - lib/student_randomizer.rb
96
+ - members.yaml
97
+ - reading_assignments.gemspec
98
+ homepage: https://github.com/michaelgt04/debugging-clinic
99
+ licenses:
100
+ - MIT
101
+ metadata: {}
102
+ post_install_message:
103
+ rdoc_options: []
104
+ require_paths:
105
+ - lib
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ requirements: []
117
+ rubyforge_project:
118
+ rubygems_version: 2.5.1
119
+ signing_key:
120
+ specification_version: 4
121
+ summary: Assign Launch Readings
122
+ test_files: []