learn-submit 1.0.2 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3c6e48149f03bfb54310e6820077270414895335
4
- data.tar.gz: e84921eb1d91fa3506006f00b505eaad9aa11648
3
+ metadata.gz: 8a1b46790f577ae85ca86d416e8e976d97e96e11
4
+ data.tar.gz: 119c71a236d5d2c42be1b5906eee857884436d72
5
5
  SHA512:
6
- metadata.gz: 1e5e7e597aad7fdc92def23ec0a2985a4da971e13eca46299245e0990480456f7681899235dd1dc09dc75028632ed29daf0705df62e0cadf40cb7da0db61d8ed
7
- data.tar.gz: 8aec1afbb3242eae140157b433ced52b0ea6f499617aba87dcbbbb12b929190a48a441d872503fe2ee04b4f200c9e3174f47a30be3c7be4e18593b3743c4644a
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 = LearnWeb::Client.new(token: token)
13
- @git = LearnSubmit::Submission::GitInteractor.new(username: user.username, message: message)
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
 
@@ -1,3 +1,3 @@
1
1
  module LearnSubmit
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
data/lib/learn_submit.rb CHANGED
@@ -2,6 +2,7 @@ require 'timeout'
2
2
  require 'netrc'
3
3
  require 'git'
4
4
  require 'learn_web'
5
+ require 'fileutils'
5
6
 
6
7
  require 'learn_submit/version'
7
8
  require 'learn_submit/submission'
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.2
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-05-28 00:00:00.000000000 Z
11
+ date: 2015-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler