lense 0.1.10 → 0.1.11

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/lense +9 -2
  3. data/lib/lense.rb +7 -4
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ba5b7e510c11b387ebd9d177f6c7b171de47c5e
4
- data.tar.gz: 80b6cfe4410a69487927cb2fc9b8b45295013801
3
+ metadata.gz: 9e3373d5fc21419c08405ce1156ec8842f6d4e1c
4
+ data.tar.gz: dba406a8ae45ed923ae0a96d5cd19369435a6bf7
5
5
  SHA512:
6
- metadata.gz: 3542231e2f8217e2f3e2ae1377fed9a752930046ee2b1fc1be9c6153b9c2128565a929e9442714b6d21cab9d20a85e037ffd809650a8827fe2b90c3dfd2e92e4
7
- data.tar.gz: 089b0c924bc8e14c3c8ef0dc840f73212818d4c4362543e37998fec31ab2d7cc4edee68be073fb3fcbb8393657f7be031716f2baf771399d9b6d85c29edfc676
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
- puts 'TODO implement switching current course to new course'
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.10'
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 switch(course)
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
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.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Zubieta