lense 0.2.12 → 0.2.13
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/bin/lense +1 -2
- data/lib/lense.rb +35 -7
- 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: b76515096b618f33e1c2b6879909332fb0d591a3
|
4
|
+
data.tar.gz: a4153dd807a7cdbdbf2cbcc310beef5f10f9b016
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55bda7256ce3107b86558d037756e49e79717826ae64d5724fab012eb2baa50462feaf9e122e8e6d95439ff639f9db3efb0adabc2b0e2930ba4a7df034aa244a
|
7
|
+
data.tar.gz: 5997d78072f0b1068c8fb31d9d639cc6277936452b7670444ebc4a74eb39823e1b695d500bcd3eab618b7b65f8af5f9108cf4431658857925eb5b1c640872200
|
data/bin/lense
CHANGED
data/lib/lense.rb
CHANGED
@@ -7,7 +7,7 @@ require 'base64'
|
|
7
7
|
class LENSE
|
8
8
|
attr_reader :config, :current_course, :lense_file_hash
|
9
9
|
|
10
|
-
VERSION = '0.2.
|
10
|
+
VERSION = '0.2.13'
|
11
11
|
LENSE_DIR = File.join(ENV['HOME'],'.lense')
|
12
12
|
COURSES_DIR = File.join(LENSE_DIR,'courses')
|
13
13
|
CURRENT_COURSE_FILE = File.join(LENSE_DIR,'current_course')
|
@@ -253,16 +253,28 @@ class LENSE
|
|
253
253
|
end
|
254
254
|
end
|
255
255
|
|
256
|
+
def up
|
257
|
+
lense = read_lensefile
|
258
|
+
lense['up'].each do |cmd|
|
259
|
+
say "running: #{cmd}"
|
260
|
+
`#{cmd}`
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
def down
|
265
|
+
lense = read_lensefile
|
266
|
+
lense['down'].each do |cmd|
|
267
|
+
say "running: #{cmd}"
|
268
|
+
`#{cmd}`
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
256
272
|
def push(repo)
|
257
|
-
|
273
|
+
repo = validate_in_repo
|
258
274
|
end
|
259
275
|
|
260
276
|
def pull()
|
261
|
-
|
262
|
-
exit_now!("No repo found.") unless File.file? ".lense/repository"
|
263
|
-
repo = File.read('.lense/repository').strip()
|
264
|
-
exit_now!("Invalid repo name.") unless repo =~ /\A\w+\/\w+\Z/
|
265
|
-
|
277
|
+
repo = validate_in_repo
|
266
278
|
install_repo repo, 'pull'
|
267
279
|
end
|
268
280
|
|
@@ -321,6 +333,22 @@ class LENSE
|
|
321
333
|
end
|
322
334
|
|
323
335
|
private
|
336
|
+
def validate_in_repo
|
337
|
+
exit_now!("Not in a lense project.") unless File.directory? '.lense'
|
338
|
+
exit_now!("No repo found.") unless File.file? ".lense/repository"
|
339
|
+
repo = File.read('.lense/repository').strip()
|
340
|
+
exit_now!("Invalid repo name.") unless repo =~ /\A\w+\/\w+\Z/
|
341
|
+
exit_now!("LENSEfile not found.") unless File.file? 'LENSEfile'
|
342
|
+
|
343
|
+
repo
|
344
|
+
end
|
345
|
+
|
346
|
+
def read_lensefile
|
347
|
+
validate_in_repo
|
348
|
+
lense_str = File.read 'LENSEfile'
|
349
|
+
Psych.load(lense_str) || {}
|
350
|
+
end
|
351
|
+
|
324
352
|
def hash_file(file)
|
325
353
|
hash_contents File.read(file)
|
326
354
|
end
|