learn-submit 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/learn_submit/submission.rb +19 -3
- data/lib/learn_submit/version.rb +1 -1
- data/lib/learn_submit.rb +1 -0
- 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: 8a1b46790f577ae85ca86d416e8e976d97e96e11
|
4
|
+
data.tar.gz: 119c71a236d5d2c42be1b5906eee857884436d72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 769acb3809f688d6413d8c45d058df1e0114fc59b3d06d3f96fb23a26f9b9119df8e55325fbf488e080bf4245bc4fd195084e0b22504386d69f4998af926cb60
|
7
|
+
data.tar.gz: 9f7290508b27c5962ce58032eae25a9fe3d044dbf3a6228304c99aaaff26091f45a7e1869f792c6db18860bde1a895509c25afd36d2db5950c9e9fbb10c92d01
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module LearnSubmit
|
2
2
|
class Submission
|
3
|
-
attr_reader :git, :client
|
3
|
+
attr_reader :git, :client, :file_path
|
4
4
|
|
5
5
|
def self.create(message: nil)
|
6
6
|
new(message: message).create
|
@@ -9,13 +9,27 @@ module LearnSubmit
|
|
9
9
|
def initialize(message:)
|
10
10
|
_login, token = Netrc.read['learn-config']
|
11
11
|
|
12
|
-
@client
|
13
|
-
@git
|
12
|
+
@client = LearnWeb::Client.new(token: token)
|
13
|
+
@git = LearnSubmit::Submission::GitInteractor.new(username: user.username, message: message)
|
14
|
+
@file_path = File.expand_path('~/.learn-submit-tmp')
|
14
15
|
end
|
15
16
|
|
16
17
|
def create
|
18
|
+
setup_tmp_file
|
19
|
+
|
17
20
|
commit_and_push!
|
18
21
|
submit!
|
22
|
+
|
23
|
+
cleanup_tmp_file
|
24
|
+
end
|
25
|
+
|
26
|
+
def setup_tmp_file
|
27
|
+
FileUtils.touch(file_path)
|
28
|
+
File.write(file_path, '')
|
29
|
+
end
|
30
|
+
|
31
|
+
def cleanup_tmp_file
|
32
|
+
FileUtils.rm(file_path)
|
19
33
|
end
|
20
34
|
|
21
35
|
def user
|
@@ -25,6 +39,7 @@ module LearnSubmit
|
|
25
39
|
private
|
26
40
|
|
27
41
|
def commit_and_push!
|
42
|
+
File.write(file_path, 'Pushing your code to GitHub...')
|
28
43
|
git.commit_and_push
|
29
44
|
|
30
45
|
# Just to give GitHub a second to register the repo changes
|
@@ -33,6 +48,7 @@ module LearnSubmit
|
|
33
48
|
|
34
49
|
def submit!(retries=3)
|
35
50
|
puts 'Submitting lesson...'
|
51
|
+
File.write(file_path, 'Opening a Pull Request...')
|
36
52
|
repo_name = git.repo_name
|
37
53
|
branch_name = git.branch_name
|
38
54
|
|
data/lib/learn_submit/version.rb
CHANGED
data/lib/learn_submit.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: learn-submit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flatiron School
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|