learn-open 1.1.3 → 1.1.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: f488e73763b7765a70085b7b1773711e0f1f109b
4
- data.tar.gz: c42c01f55904362bf0b62bd01116f0a54734af9f
3
+ metadata.gz: 9851ad3d7d1eaa018b3f324e0caf88972bb5f0a5
4
+ data.tar.gz: 4eb636680217247027382f2b055187177bae1871
5
5
  SHA512:
6
- metadata.gz: ae1410d089f9eb2b9c5cfe6e6041f15473670b2995e2a20556603c8dc311fb348de824e02f963caf2db117960d9a760d5b84fa68467209fba94b98415492f831
7
- data.tar.gz: 93005cbf71cfa5ea8ad830b44cd95e6ef5bc74c07914a9d70231602bc8fceef63ac50105b706d5f26b11d4d8d8207d533da145af541e2f707000a070bb8948ee
6
+ metadata.gz: 940d958add9a7c1771980c668b8c7f3abc27163e5ec95ffc024ac26aed794cbc09ee8586f4d94c37ddd6bf1be1089361e9cecb790a10141f3f0f3e60cb69b15f
7
+ data.tar.gz: a8cae1447d616e61094d286d61980652782d71aafc26724afe93bcfc32e1bc488660cdb769ad0826c89ce5c08901dd7904801da660d4573bd3e91ede1cbca74b
data/learn-open.gemspec CHANGED
@@ -22,5 +22,5 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_runtime_dependency "netrc"
24
24
  spec.add_runtime_dependency "git"
25
- spec.add_runtime_dependency "learn-web", ">= 1.0.2"
25
+ spec.add_runtime_dependency "learn-web", ">= 1.0.3"
26
26
  end
@@ -1,7 +1,7 @@
1
1
  module LearnOpen
2
2
  class Opener
3
3
  attr_reader :editor, :client, :lessons_dir, :file_path, :get_next_lesson
4
- attr_accessor :lesson, :repo_dir, :lesson_is_lab, :lesson_id
4
+ attr_accessor :lesson, :repo_dir, :lesson_is_lab, :lesson_id, :later_lesson
5
5
 
6
6
  def self.run(lesson:, editor_specified:, get_next_lesson:)
7
7
  new(lesson, editor_specified, get_next_lesson).run
@@ -23,6 +23,8 @@ module LearnOpen
23
23
 
24
24
  set_lesson
25
25
 
26
+ warn_if_necessary
27
+
26
28
  if lesson_is_readme?
27
29
  open_readme
28
30
  else
@@ -36,6 +38,32 @@ module LearnOpen
36
38
 
37
39
  private
38
40
 
41
+ def warn_if_necessary
42
+ temp_args = nil
43
+
44
+ if self.later_lesson
45
+ puts 'WARNING: You are attempting to open a lesson that is beyond your current lesson.'
46
+ print 'Are you sure you want to continue? [Yn]: '
47
+
48
+ if ARGV.any?
49
+ temp_args = ARGV
50
+ ARGV.clear
51
+ end
52
+
53
+ warn_response = gets.chomp.downcase
54
+
55
+ if !warn_response.empty? && !['yes', 'y'].include?(warn_response)
56
+ exit
57
+ end
58
+ end
59
+
60
+ if temp_args
61
+ temp_args.each do |arg|
62
+ ARGV << arg
63
+ end
64
+ end
65
+ end
66
+
39
67
  def setup_tmp_file
40
68
  FileUtils.touch(file_path)
41
69
  File.write(file_path, '')
@@ -53,16 +81,19 @@ module LearnOpen
53
81
  self.lesson = get_current_lesson_forked_repo
54
82
  self.lesson_is_lab = current_lesson.lab
55
83
  self.lesson_id = current_lesson.id
84
+ self.later_lesson = false
56
85
  elsif !lesson && get_next_lesson
57
86
  puts "Getting next lesson..."
58
87
  self.lesson = get_next_lesson_forked_repo
59
88
  self.lesson_is_lab = next_lesson.lab
60
89
  self.lesson_id = next_lesson.id
90
+ self.later_lesson = false
61
91
  else
62
92
  puts "Looking for lesson..."
63
93
  self.lesson = ensure_correct_lesson.repo_slug
64
94
  self.lesson_is_lab = correct_lesson.lab
65
95
  self.lesson_id = correct_lesson.lesson_id
96
+ self.later_lesson = correct_lesson.later_lesson
66
97
  end
67
98
 
68
99
  self.repo_dir = lesson.split('/').last
@@ -1,3 +1,3 @@
1
1
  module LearnOpen
2
- VERSION = '1.1.3'
2
+ VERSION = '1.1.4'
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.1.3
4
+ version: 1.1.4
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-06-08 00:00:00.000000000 Z
11
+ date: 2015-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 1.0.2
75
+ version: 1.0.3
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 1.0.2
82
+ version: 1.0.3
83
83
  description:
84
84
  email:
85
85
  - learn@flatironschool.com