learn-open 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f5a874ff2c2471e447b4f965fb68d13d9bf3120
4
- data.tar.gz: c77eb3aed8490dc3e878782be60ad5b91d5ccde3
3
+ metadata.gz: 9dac63067e52d10a585f503c38724acc8cccd657
4
+ data.tar.gz: cecbad2654040c472a0ead8d2d2fc05710410d0e
5
5
  SHA512:
6
- metadata.gz: d02bb3169a8a353f02390d1275d006086c366afdae377d7b110165983e922dc495a6357a924526d066b123d4b7025711852aa5621cbbd9a09ee492fbb2408eb5
7
- data.tar.gz: 71470436b4c147d26aaac06fc56cca79bbe4f7beea3c39af70ba1ad4129f67495417aa8eba3dd57774c0a5dda19eba0e8cd7878bc2c8e3310bc745876e0a94a8
6
+ metadata.gz: 49d16f5d3d3d0bd501db9d946e31186cb8f67f23ef6afa462c44958554c890919189d283afdb9a69df592a3e441aaa417155221fef258afc7d7f6905945ff0f2
7
+ data.tar.gz: 3c01183fe94ef1fbdcf77d0a41e0460509987a7eefe968784b4553f68dce446c9fb0d661de322a08579404ca9ed25ed031a2d45caad91db71a2f640141212bd8
@@ -1,6 +1,6 @@
1
1
  module LearnOpen
2
2
  class Opener
3
- attr_reader :editor, :client, :lessons_dir
3
+ attr_reader :editor, :client, :lessons_dir, :file_path
4
4
  attr_accessor :lesson, :repo_dir, :lesson_is_lab, :lesson_id
5
5
 
6
6
  def self.run(lesson:, editor_specified:)
@@ -14,9 +14,12 @@ module LearnOpen
14
14
  @lesson = lesson
15
15
  @editor = editor
16
16
  @lessons_dir = YAML.load(File.read(File.expand_path('~/.learn-config')))[:learn_directory]
17
+ @file_path = File.expand_path('~/.learn-open-tmp')
17
18
  end
18
19
 
19
20
  def run
21
+ setup_tmp_file
22
+
20
23
  set_lesson
21
24
 
22
25
  if lesson_is_readme?
@@ -28,11 +31,24 @@ module LearnOpen
28
31
  open_with_editor
29
32
  cd_to_lesson
30
33
  end
34
+
35
+ cleanup_tmp_file
31
36
  end
32
37
 
33
38
  private
34
39
 
40
+ def setup_tmp_file
41
+ FileUtils.touch(file_path)
42
+ File.write(file_path, '')
43
+ end
44
+
45
+ def cleanup_tmp_file
46
+ File.write(file_path, 'Done.')
47
+ end
48
+
35
49
  def set_lesson
50
+ File.write(file_path, 'Getting lesson...')
51
+
36
52
  if !lesson
37
53
  puts "Getting current lesson..."
38
54
  self.lesson = get_current_lesson_forked_repo
@@ -90,6 +106,7 @@ module LearnOpen
90
106
 
91
107
  def fork_repo(retries=3)
92
108
  if !repo_exists?
109
+ File.write(file_path, 'Forking repository...')
93
110
  puts "Forking lesson..."
94
111
  begin
95
112
  Timeout::timeout(15) do
@@ -109,6 +126,7 @@ module LearnOpen
109
126
 
110
127
  def clone_repo(retries=3)
111
128
  if !repo_exists?
129
+ File.write(file_path, 'Cloning to your machine...')
112
130
  puts "Cloning lesson..."
113
131
  begin
114
132
  Timeout::timeout(15) do
@@ -1,3 +1,3 @@
1
1
  module LearnOpen
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: learn-open
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-29 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