lense 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lense.rb +23 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ba5b7e510c11b387ebd9d177f6c7b171de47c5e
|
4
|
+
data.tar.gz: 80b6cfe4410a69487927cb2fc9b8b45295013801
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3542231e2f8217e2f3e2ae1377fed9a752930046ee2b1fc1be9c6153b9c2128565a929e9442714b6d21cab9d20a85e037ffd809650a8827fe2b90c3dfd2e92e4
|
7
|
+
data.tar.gz: 089b0c924bc8e14c3c8ef0dc840f73212818d4c4362543e37998fec31ab2d7cc4edee68be073fb3fcbb8393657f7be031716f2baf771399d9b6d85c29edfc676
|
data/lib/lense.rb
CHANGED
@@ -1,14 +1,34 @@
|
|
1
1
|
class LENSE
|
2
|
-
attr_reader :config
|
2
|
+
attr_reader :config, :current_course
|
3
3
|
|
4
|
-
VERSION
|
5
|
-
LENSE_DIR
|
4
|
+
VERSION = '0.1.10'
|
5
|
+
LENSE_DIR = File.join(ENV['HOME'],'.lense')
|
6
|
+
COURSES_DIR = File.join(LENSE_DIR,'courses')
|
7
|
+
CURRENT_COURSE_FILE = File.join(LENSE_DIR,'current_course')
|
6
8
|
|
7
9
|
def initialize()
|
8
10
|
Dir.mkdir(LENSE_DIR) unless File.directory?(LENSE_DIR)
|
11
|
+
Dir.mkdir(COURSES_DIR) unless File.directory?(COURSES_DIR)
|
12
|
+
File.open(CURRENT_COURSE_FILE, 'w') {} unless File.file?(CURRENT_COURSE_FILE)
|
13
|
+
|
9
14
|
config_file = File.join(LENSE_DIR,'config')
|
10
15
|
config_str = File.file?(config_file) ? File.read(config_file) : ''
|
16
|
+
|
11
17
|
@config = Psych.load(config_str) || {}
|
18
|
+
|
19
|
+
@current_course = File.read(CURRENT_COURSE_FILE).strip()
|
20
|
+
@current_course = '> NOT SET <'
|
21
|
+
end
|
22
|
+
|
23
|
+
def switch(course)
|
24
|
+
courses = Dir.entries(COURSES_DIR)
|
25
|
+
course_available = courses.include? course
|
26
|
+
|
27
|
+
if course_available && course != @current_course
|
28
|
+
File.open(CURRENT_COURSE_FILE, 'w') { |f| f.write course }
|
29
|
+
end
|
30
|
+
|
31
|
+
course_available
|
12
32
|
end
|
13
33
|
|
14
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lense
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manuel Zubieta
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-04-
|
12
|
+
date: 2015-04-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|