lense 0.1.30 → 0.1.31
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.
- checksums.yaml +4 -4
- data/lib/lense.rb +9 -2
- 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: c87de13b1733ae9f75203599c6bf3aadc779a9f5
|
|
4
|
+
data.tar.gz: 6e33398067eb91a40ff3dbf2e50cf5eed0c267cd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c1d8f8808a3b9f4088ce1450b94a3cf4f28ed0a7d7d6d21cb65751f1a3db0fb72950f2bf1b307bfaeace10c412d8506c95e8758132807a17efc39d863cae2005
|
|
7
|
+
data.tar.gz: fd0864cb9f74af352ecfc5b4a6983360efed45baecb2836dab2c30689b2ad3f5c3452cd443f9f3fa80cfac512d61bdf7f4b8bf142893173dbd0cacbff002d902
|
data/lib/lense.rb
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
require 'rest-client'
|
|
2
2
|
require 'highline/import'
|
|
3
|
+
require 'digest'
|
|
3
4
|
|
|
4
5
|
class LENSE
|
|
5
|
-
attr_reader :config, :current_course
|
|
6
|
+
attr_reader :config, :current_course, :lense_file_hash
|
|
6
7
|
|
|
7
|
-
VERSION = '0.1.
|
|
8
|
+
VERSION = '0.1.31'
|
|
8
9
|
LENSE_DIR = File.join(ENV['HOME'],'.lense')
|
|
9
10
|
COURSES_DIR = File.join(LENSE_DIR,'courses')
|
|
10
11
|
CURRENT_COURSE_FILE = File.join(LENSE_DIR,'current_course')
|
|
11
12
|
LOCAL_LENSE_DIR = File.join(ENV['PWD'],'.lense')
|
|
12
13
|
DEPS_DIR = File.join(LOCAL_LENSE_DIR,'deps')
|
|
14
|
+
REFS_DIR = File.join(LOCAL_LENSE_DIR,'refs')
|
|
15
|
+
CURRENT_REF_FILE = File.join(REFS_DIR,'current')
|
|
13
16
|
LENSE_FILE = File.join(ENV['PWD'],'LENSEfile')
|
|
14
17
|
|
|
15
18
|
def initialize()
|
|
@@ -24,6 +27,7 @@ class LENSE
|
|
|
24
27
|
|
|
25
28
|
@current_course = File.read(CURRENT_COURSE_FILE).strip()
|
|
26
29
|
@current_course = '> NOT SET <' if @current_course.empty?
|
|
30
|
+
@lense_file_hash = Digest::SHA256.hexdigest(File.read(LENSE_FILE)) if File.file?(LENSE_FILE)
|
|
27
31
|
end
|
|
28
32
|
|
|
29
33
|
def select_course(course)
|
|
@@ -108,6 +112,8 @@ class LENSE
|
|
|
108
112
|
def init()
|
|
109
113
|
Dir.mkdir(LOCAL_LENSE_DIR) unless File.directory?(LOCAL_LENSE_DIR)
|
|
110
114
|
Dir.mkdir(DEPS_DIR) unless File.directory?(DEPS_DIR)
|
|
115
|
+
Dir.mkdir(REFS_DIR) unless File.directory?(REFS_DIR)
|
|
116
|
+
File.open(CURRENT_REF_FILE, 'w') {} unless File.file?(CURRENT_REF_FILE)
|
|
111
117
|
unless File.file?(LENSE_FILE)
|
|
112
118
|
File.open(LENSE_FILE,'w') do |file|
|
|
113
119
|
file.puts "---"
|
|
@@ -126,6 +132,7 @@ class LENSE
|
|
|
126
132
|
end
|
|
127
133
|
|
|
128
134
|
def status()
|
|
135
|
+
say "Hash : #{@lense_file_hash}"
|
|
129
136
|
exit_now!("Not a LENSE project: .lense") unless File.directory?(LOCAL_LENSE_DIR)
|
|
130
137
|
end
|
|
131
138
|
end
|