learn-open 1.2.20 → 1.2.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +4 -0
  3. data/Guardfile +70 -0
  4. data/learn-open.gemspec +7 -1
  5. data/lib/learn_open.rb +66 -0
  6. data/lib/learn_open/adapters/io_adapter.rb +24 -0
  7. data/lib/learn_open/adapters/learn_web_adapter.rb +103 -0
  8. data/lib/learn_open/adapters/system_adapter.rb +30 -0
  9. data/lib/learn_open/environments.rb +35 -0
  10. data/lib/learn_open/environments/base_environment.rb +70 -0
  11. data/lib/learn_open/environments/generic_environment.rb +9 -0
  12. data/lib/learn_open/environments/ide_environment.rb +63 -0
  13. data/lib/learn_open/environments/jupyter_container_environment.rb +28 -0
  14. data/lib/learn_open/environments/linux_environment.rb +17 -0
  15. data/lib/learn_open/environments/mac_environment.rb +75 -0
  16. data/lib/learn_open/lessons.rb +24 -0
  17. data/lib/learn_open/lessons/base_lesson.rb +57 -0
  18. data/lib/learn_open/lessons/ios_lesson.rb +14 -0
  19. data/lib/learn_open/lessons/jupyter_lesson.rb +14 -0
  20. data/lib/learn_open/lessons/lab_lesson.rb +9 -0
  21. data/lib/learn_open/lessons/readme_lesson.rb +13 -0
  22. data/lib/learn_open/opener.rb +26 -469
  23. data/lib/learn_open/services/dependency_installers.rb +19 -0
  24. data/lib/learn_open/services/dependency_installers/base_installer.rb +21 -0
  25. data/lib/learn_open/services/dependency_installers/gem_installer.rb +14 -0
  26. data/lib/learn_open/services/dependency_installers/jupyter_pip_installer.rb +14 -0
  27. data/lib/learn_open/services/dependency_installers/node_package_installer.rb +20 -0
  28. data/lib/learn_open/services/dependency_installers/pip_installer.rb +14 -0
  29. data/lib/learn_open/services/file_backup_starter.rb +20 -0
  30. data/lib/learn_open/services/lesson_downloader.rb +82 -0
  31. data/lib/learn_open/services/logger.rb +23 -0
  32. data/lib/learn_open/version.rb +1 -1
  33. data/spec/fakes/fake_git.rb +20 -0
  34. data/spec/fakes/fake_learn_client.rb +214 -0
  35. data/spec/fixtures/learn-config +3 -0
  36. data/spec/learn_open/environments/ide_environment_spec.rb +62 -0
  37. data/spec/learn_open/opener_spec.rb +789 -14
  38. data/spec/spec_helper.rb +41 -0
  39. metadata +121 -5
  40. data/spec/home_dir/.learn-config +0 -3
data/spec/spec_helper.rb CHANGED
@@ -1 +1,42 @@
1
+ require 'diff/lcs'
1
2
  require_relative '../lib/learn_open'
3
+ require_relative 'fakes/fake_git.rb'
4
+ require_relative 'fakes/fake_learn_client.rb'
5
+
6
+ ENV["GEM_ENV"] = "test"
7
+
8
+ def home_dir
9
+ Dir.home
10
+ end
11
+
12
+ def create_home_dir
13
+ FileUtils.mkdir_p home_dir
14
+ end
15
+
16
+ def create_linux_home_dir(username)
17
+ home_dir = "/home/#{username}"
18
+ FileUtils.mkdir_p home_dir
19
+ home_dir
20
+ end
21
+
22
+ def create_netrc_file
23
+ File.open("#{home_dir}/.netrc", "w+") do |f|
24
+ f.write(<<-EOF)
25
+ machine learn-config
26
+ login learn
27
+ password some-amazing-password
28
+ EOF
29
+ end
30
+ File.chmod(0600, "#{home_dir}/.netrc")
31
+ end
32
+
33
+ def create_learn_config_file
34
+ File.open("#{home_dir}/.learn-config", "w+") do |f|
35
+ f.write(<<-EOF)
36
+ ---
37
+ :learn_directory: "/home/bobby/Development/code"
38
+ :editor: atom
39
+ EOF
40
+ end
41
+ end
42
+
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.2.20
4
+ version: 1.2.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flatiron School
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-21 00:00:00.000000000 Z
11
+ date: 2018-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,90 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: fakefs
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.14.2
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.14.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.11.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.11.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-core
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 3.7.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 3.7.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-mocks
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 3.7.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 3.7.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: diff-lcs
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.3'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.3'
111
+ - !ruby/object:Gem::Dependency
112
+ name: guard-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 4.7.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 4.7.0
41
125
  - !ruby/object:Gem::Dependency
42
126
  name: netrc
43
127
  requirement: !ruby/object:Gem::Requirement
@@ -90,16 +174,45 @@ extra_rdoc_files: []
90
174
  files:
91
175
  - ".gitignore"
92
176
  - Gemfile
177
+ - Guardfile
93
178
  - LICENSE.txt
94
179
  - README.md
95
180
  - Rakefile
96
181
  - bin/learn-open
97
182
  - learn-open.gemspec
98
183
  - lib/learn_open.rb
184
+ - lib/learn_open/adapters/io_adapter.rb
185
+ - lib/learn_open/adapters/learn_web_adapter.rb
186
+ - lib/learn_open/adapters/system_adapter.rb
99
187
  - lib/learn_open/argument_parser.rb
188
+ - lib/learn_open/environments.rb
189
+ - lib/learn_open/environments/base_environment.rb
190
+ - lib/learn_open/environments/generic_environment.rb
191
+ - lib/learn_open/environments/ide_environment.rb
192
+ - lib/learn_open/environments/jupyter_container_environment.rb
193
+ - lib/learn_open/environments/linux_environment.rb
194
+ - lib/learn_open/environments/mac_environment.rb
195
+ - lib/learn_open/lessons.rb
196
+ - lib/learn_open/lessons/base_lesson.rb
197
+ - lib/learn_open/lessons/ios_lesson.rb
198
+ - lib/learn_open/lessons/jupyter_lesson.rb
199
+ - lib/learn_open/lessons/lab_lesson.rb
200
+ - lib/learn_open/lessons/readme_lesson.rb
100
201
  - lib/learn_open/opener.rb
202
+ - lib/learn_open/services/dependency_installers.rb
203
+ - lib/learn_open/services/dependency_installers/base_installer.rb
204
+ - lib/learn_open/services/dependency_installers/gem_installer.rb
205
+ - lib/learn_open/services/dependency_installers/jupyter_pip_installer.rb
206
+ - lib/learn_open/services/dependency_installers/node_package_installer.rb
207
+ - lib/learn_open/services/dependency_installers/pip_installer.rb
208
+ - lib/learn_open/services/file_backup_starter.rb
209
+ - lib/learn_open/services/lesson_downloader.rb
210
+ - lib/learn_open/services/logger.rb
101
211
  - lib/learn_open/version.rb
102
- - spec/home_dir/.learn-config
212
+ - spec/fakes/fake_git.rb
213
+ - spec/fakes/fake_learn_client.rb
214
+ - spec/fixtures/learn-config
215
+ - spec/learn_open/environments/ide_environment_spec.rb
103
216
  - spec/learn_open/opener_spec.rb
104
217
  - spec/spec_helper.rb
105
218
  homepage: https://github.com/learn-co/learn-open
@@ -123,11 +236,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
236
  version: '0'
124
237
  requirements: []
125
238
  rubyforge_project:
126
- rubygems_version: 2.6.14
239
+ rubygems_version: 2.7.6
127
240
  signing_key:
128
241
  specification_version: 4
129
242
  summary: Open Learn lessons locally
130
243
  test_files:
131
- - spec/home_dir/.learn-config
244
+ - spec/fakes/fake_git.rb
245
+ - spec/fakes/fake_learn_client.rb
246
+ - spec/fixtures/learn-config
247
+ - spec/learn_open/environments/ide_environment_spec.rb
132
248
  - spec/learn_open/opener_spec.rb
133
249
  - spec/spec_helper.rb
@@ -1,3 +0,0 @@
1
- ---
2
- :learn_directory: 'spec/home_dir/code/labs'
3
- :editor: 'atom'