lense 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/lense +9 -2
- data/lib/lense.rb +7 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e3373d5fc21419c08405ce1156ec8842f6d4e1c
|
4
|
+
data.tar.gz: dba406a8ae45ed923ae0a96d5cd19369435a6bf7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cedf3c40b43e50d4242dd615a17e2a7c2360f40bf917d05ee5c895346cd28b474fa78e2df15127de9ad56262d8b3b3ddbe1b5db18d26fb11e28d555c17e61870
|
7
|
+
data.tar.gz: f0b246ee6a4a1e5b938d63e71d692e4e63abcda50bce4bb0b4d8382a7f4c88e8922c8a0d2f94d349be366bc66530cb8912602da82f2144219935c190f9eee3f4
|
data/bin/lense
CHANGED
@@ -72,8 +72,15 @@ command :push do |c|
|
|
72
72
|
end
|
73
73
|
|
74
74
|
command :select do |c|
|
75
|
-
c.action do
|
76
|
-
|
75
|
+
c.action do |global_options,options,args|
|
76
|
+
exit_now!('Must supply course name.') if args.count < 1
|
77
|
+
course = args[0]
|
78
|
+
res = LENSE_APP.select_course course
|
79
|
+
if res.nil?
|
80
|
+
puts "Staying on #{course}..."
|
81
|
+
else
|
82
|
+
puts "Switched to course: #{course}."
|
83
|
+
end
|
77
84
|
end
|
78
85
|
end
|
79
86
|
|
data/lib/lense.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class LENSE
|
2
2
|
attr_reader :config, :current_course
|
3
3
|
|
4
|
-
VERSION = '0.1.
|
4
|
+
VERSION = '0.1.11'
|
5
5
|
LENSE_DIR = File.join(ENV['HOME'],'.lense')
|
6
6
|
COURSES_DIR = File.join(LENSE_DIR,'courses')
|
7
7
|
CURRENT_COURSE_FILE = File.join(LENSE_DIR,'current_course')
|
@@ -20,15 +20,18 @@ class LENSE
|
|
20
20
|
@current_course = '> NOT SET <'
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
23
|
+
def select_course(course)
|
24
24
|
courses = Dir.entries(COURSES_DIR)
|
25
25
|
course_available = courses.include? course
|
26
26
|
|
27
27
|
if course_available && course != @current_course
|
28
28
|
File.open(CURRENT_COURSE_FILE, 'w') { |f| f.write course }
|
29
|
+
course_available
|
30
|
+
elsif course == @current_course
|
31
|
+
nil
|
32
|
+
else
|
33
|
+
raise "Cannot find course (#{course})"
|
29
34
|
end
|
30
|
-
|
31
|
-
course_available
|
32
35
|
end
|
33
36
|
|
34
37
|
end
|