learn-open 1.2.1 → 1.2.2

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: 754f2bb0465443b07c6813b89bf718c97e01efbe
4
- data.tar.gz: 846b8500f598af688e6162d078bbb64594024dd7
3
+ metadata.gz: 187cbff6f0a0e54e2c1eeee9df256c855cda0fdc
4
+ data.tar.gz: 73c0bb51b2d5dd3512d06ad889130987c13a6eb4
5
5
  SHA512:
6
- metadata.gz: 7da69af22e33989482ee69b598f0fb91232f692aedb914d56d00591e50ae67612f3b42773e5752c470704142a1422ab83f278e9e2b773434d84b90f1020a3046
7
- data.tar.gz: f4dbe515cc2b81abcaa9496d7f4f1674f177371dd359448dfafbe10a89d1e381d0b4193a28dcddf8f3d3bcb48fa265cee8cf13ce69bd57d8e4ee2af547bb3c96
6
+ metadata.gz: f2b5157421e1cdb8b5a791ee963153ad43ed7fc50c797b90d772bd5e2b1c466b8a8c2e7f35c1e2d7a16e457f100e036112d207b860261c11f44c241dba92663e
7
+ data.tar.gz: 6c70af6367cab4362834610ccfc3cdbbee44e614fa8a7625ffc75dbc109b97c73197879b6c3a8ce018ec5ee56e8bfcb72a4a282cd339b6aed4917814ab7b5bc7
@@ -39,12 +39,18 @@ module LearnOpen
39
39
  end
40
40
 
41
41
  def repo_exists?
42
- done_labs = "#{HOME_DIR}/.done_labs"
43
- if File.exists?(done_labs)
44
- File.
45
- readlines(done_labs).
46
- grep(/#{repo_dir}/).
47
- any?
42
+ cloned_labs = "#{HOME_DIR}/.cloned_labs"
43
+ if File.exists?(cloned_labs)
44
+ if File.readlines(cloned_labs).grep(/#{repo_dir}/).any?
45
+ until File.exists?("#{lessons_dir}/#{repo_dir}")
46
+ puts "Loading..."
47
+ puts Dir["#{lessons_dir}/*"].count
48
+ sleep 1
49
+ end
50
+ true
51
+ else
52
+ false
53
+ end
48
54
  else
49
55
  File.exists?("#{lessons_dir}/#{repo_dir}")
50
56
  end
@@ -1,3 +1,3 @@
1
1
  module LearnOpen
2
- VERSION = '1.2.1'
2
+ VERSION = '1.2.2'
3
3
  end
@@ -5,32 +5,34 @@ describe LearnOpen::Opener do
5
5
 
6
6
  context "Verifying repo existance" do
7
7
  let(:opener) { LearnOpen::Opener.new("","","") }
8
- context "with .done_labs file" do
8
+ before do
9
+ path = File.join(__dir__, "..", "home_dir", "code")
10
+ FileUtils.rm_rf(path)
11
+ end
12
+
13
+ context "with .cloned_labs file" do
9
14
  before do
10
- done_labs = "#{LearnOpen::Opener::HOME_DIR}/.done_labs"
11
- FileUtils.rm(done_labs) if File.exists?(done_labs)
15
+ cloned_labs = "#{LearnOpen::Opener::HOME_DIR}/.cloned_labs"
16
+ FileUtils.rm(cloned_labs) if File.exists?(cloned_labs)
12
17
  end
13
- it "returns true if lab is in the .done_labs file" do
14
- expect(opener).to receive(:repo_dir).and_return("js-rubber-duck-wrangling")
18
+ it "returns true if lab is in the .cloned_labs file" do
19
+ expect(opener).to receive(:repo_dir).at_least(:once).and_return("js-rubber-duck-wrangling")
15
20
 
16
- File.open("#{LearnOpen::Opener::HOME_DIR}/.done_labs", "w+") do |f|
21
+ File.open("#{LearnOpen::Opener::HOME_DIR}/.cloned_labs", "w+") do |f|
17
22
  f.puts("js-rubber-duck-wrangling")
18
23
  end
19
24
 
25
+ FileUtils.mkdir_p("#{opener.lessons_dir}/js-rubber-duck-wrangling")
26
+
20
27
  expect(opener.repo_exists?).to be_truthy
21
28
  end
22
- it "returns false if lab is not in the .done_labs file" do
29
+ it "returns false if lab is not in the .cloned_labs file" do
23
30
  expect(opener).to receive(:repo_dir).and_return("js-rubber-duck-wrangling")
24
31
  expect(opener.repo_exists?).to be_falsy
25
32
  end
26
33
  end
27
34
 
28
- context "without .done_labs file" do
29
- before do
30
- path = File.join(__dir__, "..", "home_dir", "code")
31
- FileUtils.rm_rf(path)
32
- end
33
-
35
+ context "without .cloned_labs file" do
34
36
  it "returns true if directory for lab exists" do
35
37
  expect(opener).to receive(:repo_dir).and_return("js-rubber-duck-wrangling")
36
38
  FileUtils.mkdir_p("#{opener.lessons_dir}/js-rubber-duck-wrangling")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: learn-open
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flatiron School