teachers_pet 0.3.3 → 0.3.4

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
  SHA1:
3
- metadata.gz: 237378cc3ef99f43b205dd00666e73b31d0fd08c
4
- data.tar.gz: 6ae28a5c307127776aef86f6f40570fa38b6603f
3
+ metadata.gz: c0fcff1514b6ed632b6a3ddf6bb6beded7b83228
4
+ data.tar.gz: 9a15cdd20dd90ff8e81911f428c7fb07d8df8430
5
5
  SHA512:
6
- metadata.gz: 6045ed09c10c41e2167b5f87223d2a46b91e99d2473f73d1b0bff31e17683a830328e7833596d6d2aace1c4e859049b5d66e42a6d961a19bbf8260e5a02ad3ef
7
- data.tar.gz: b23a23912a4c70d10a47d2092693d19272173ea1a3cc65fd7f352d046ec5b119fcc4fe49976550cd2d5fc4e6e95c19c426d4e1fefa4299d11628649b5501cd3b
6
+ metadata.gz: ee50dec19e0eabd794dd34130b3e0c4861f0cd27d91e3e6c74468746f30db10e34151a145e93d9fed44febd0cfb0a90815e224a3140c67494ad7480afc4416c6
7
+ data.tar.gz: d8a71c8d9cc31230de1617a300844cc32118621460f87a3d12f9a00fb6b1063c85835aa99ac77aa2f8d0b274ffdc73460ba5c629c4c4a5f77aded29b5cd01e1e
@@ -12,14 +12,14 @@ module TeachersPet
12
12
  teams_by_name[self.team_name] || self.client.create_team(org_login, team_name)
13
13
  end
14
14
 
15
- def add_members_to_owners
15
+ def add_members
16
16
  member_list = self.read_members_file
17
17
  self.client.add_users_to_team(self.options[:organization], self.team, member_list)
18
18
  end
19
19
 
20
20
  def run
21
21
  self.init_client
22
- self.add_members_to_owners
22
+ self.add_members
23
23
  end
24
24
  end
25
25
  end
@@ -1,4 +1,5 @@
1
1
  require 'active_support/core_ext/hash/keys'
2
+ require 'io/console'
2
3
  require 'octokit'
3
4
  require_relative File.join('..', 'configuration')
4
5
 
@@ -21,9 +22,19 @@ module TeachersPet
21
22
  }
22
23
 
23
24
  if self.options[:token]
24
- opts[:access_token] = self.options[:token]
25
+ if self.options[:token].eql?('token')
26
+ print 'Please enter your GitHub token: '
27
+ opts[:access_token] = STDIN.noecho(&:gets).chomp
28
+ else
29
+ opts[:access_token] = self.options[:token]
30
+ end
25
31
  elsif self.options[:password]
26
- opts[:password] = self.options[:password]
32
+ if self.options[:password].eql?('password')
33
+ print 'Please enter your GitHub password: '
34
+ opts[:password] = STDIN.noecho(&:gets).chomp
35
+ else
36
+ opts[:password] = self.options[:password]
37
+ end
27
38
  else
28
39
  raise Thor::RequiredArgumentMissingError.new("No value provided for option --password or --token")
29
40
  end
@@ -79,6 +90,10 @@ module TeachersPet
79
90
  puts "Loading members to add:"
80
91
  read_file(file).keys
81
92
  end
93
+
94
+ def execute(command)
95
+ return system(command)
96
+ end
82
97
  end
83
98
  end
84
99
  end
@@ -11,9 +11,9 @@ module TeachersPet
11
11
  @@API_ENDPOINT
12
12
  end
13
13
 
14
- # For github.com: https://www.github.com/'
14
+ # For github.com: https://github.com/'
15
15
  # For GitHub Enterprise: ''https://yourServer.com/'
16
- @@WEB_ENDPOINT = 'https://www.github.com/'
16
+ @@WEB_ENDPOINT = 'https://github.com/'
17
17
 
18
18
  def self.webEndpoint
19
19
  @@WEB_ENDPOINT
@@ -1,3 +1,3 @@
1
1
  module TeachersPet
2
- VERSION = '0.3.3'
2
+ VERSION = '0.3.4'
3
3
  end
@@ -18,6 +18,18 @@ describe TeachersPet::Actions::Base do
18
18
  action = TeachersPet::Actions::Base.new(token: 'abc123')
19
19
  expect(action.octokit_config[:access_token]).to eq('abc123')
20
20
  end
21
+
22
+ it "waits for a password if the password flag is passed without any arguments" do
23
+ action = TeachersPet::Actions::Base.new(password: 'password')
24
+ STDIN.stub(:gets).and_return('abc123')
25
+ expect(action.octokit_config[:password]).to eq('abc123')
26
+ end
27
+
28
+ it "waits for a token if the token flag is passed without any arguments" do
29
+ action = TeachersPet::Actions::Base.new(token: 'token')
30
+ STDIN.stub(:gets).and_return('abc123')
31
+ expect(action.octokit_config[:access_token]).to eq('abc123')
32
+ end
21
33
  end
22
34
 
23
35
  describe '#read_file' do
@@ -24,7 +24,7 @@ describe 'add_collaborators' do
24
24
  'password' => 'abc123',
25
25
  'repository' => 'testorg/testrepo',
26
26
  'username' => ENV['USER'],
27
- 'web' => 'https://www.github.com/'
27
+ 'web' => 'https://github.com/'
28
28
  )
29
29
 
30
30
  teachers_pet(:add_collaborators,
@@ -13,7 +13,7 @@ describe 'clone_repos' do
13
13
  request_stubs << stub_get_json('https://testteacher:abc123@api.github.com/orgs/testorg/teams?per_page=100', student_teams)
14
14
  student_usernames.each do |username|
15
15
  request_stubs << stub_get_json("https://testteacher:abc123@api.github.com/repos/testorg/#{username}-testrepo", {})
16
- expect_any_instance_of(TeachersPet::Actions::CloneRepos).to receive(:execute).with("git clone https://www.github.com/testorg/#{username}-testrepo.git").once
16
+ expect_any_instance_of(TeachersPet::Actions::CloneRepos).to receive(:execute).with("git clone https://github.com/testorg/#{username}-testrepo.git").once
17
17
  end
18
18
 
19
19
  teachers_pet(:clone_repos,
@@ -23,7 +23,7 @@ describe 'forks' do
23
23
  'password' => 'abc123',
24
24
  'repository' => 'testorg/testrepo',
25
25
  'username' => ENV['USER'],
26
- 'web' => 'https://www.github.com/'
26
+ 'web' => 'https://github.com/'
27
27
  )
28
28
  teachers_pet(:forks, repository: 'testorg/testrepo', password: 'abc123')
29
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teachers_pet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Britton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-27 00:00:00.000000000 Z
11
+ date: 2014-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -232,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
232
  version: '0'
233
233
  requirements: []
234
234
  rubyforge_project:
235
- rubygems_version: 2.2.2
235
+ rubygems_version: 2.4.1
236
236
  signing_key:
237
237
  specification_version: 4
238
238
  summary: Command line tools to help teachers use GitHub in their classrooms