lense 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/lense.rb +23 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8f1863ab74f7fcaeddc9890d6c7e239a1055b42
4
- data.tar.gz: c45ad95e65b72e5ff7fece8327638aa5c4bff1ce
3
+ metadata.gz: 0ba5b7e510c11b387ebd9d177f6c7b171de47c5e
4
+ data.tar.gz: 80b6cfe4410a69487927cb2fc9b8b45295013801
5
5
  SHA512:
6
- metadata.gz: e4aa59aeb9e7e1398489f38838b12710bb788f5035674dbc13de9cb20411d03c1fdff4123d28916065d3ee8228212ee84f189ec7d831efce2cbbc7c215c2da09
7
- data.tar.gz: 5ad9eb118b7f70071683a2d5dbb8451d58843a37975ea9687c4b3d9726b32232f9ab8a76c6bbb9c14593fa04f6742258acc4c1e6710260cb35a7dcb79cbf9900
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 = '0.1.9'
5
- LENSE_DIR = File.join(ENV['HOME'],'.lense')
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.9
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-18 00:00:00.000000000 Z
12
+ date: 2015-04-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake