lense 0.2.12 → 0.2.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/lense +1 -2
  3. data/lib/lense.rb +35 -7
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b963955df28452b0e8ccd32570432e5a54fc1135
4
- data.tar.gz: 66f39c1c5fefc7c41db57e4af7eb121dabe46dcf
3
+ metadata.gz: b76515096b618f33e1c2b6879909332fb0d591a3
4
+ data.tar.gz: a4153dd807a7cdbdbf2cbcc310beef5f10f9b016
5
5
  SHA512:
6
- metadata.gz: 40ecffbd7085d7663840deec4ad3725901f3af6502fe60b168c39bbd568466c37768f35946adeb8f8ea6a79a2d2089ba84108067fc6a720ae6d0567becebbc0c
7
- data.tar.gz: 390168e5d7bfe1d8a4df09f28f89ae97b546b2850997f9eeb370bc25d0bcc0eb7b0d9549dcc4a33093026fc747e4b8fc727744747b5c79e86b6af4b324b25461
6
+ metadata.gz: 55bda7256ce3107b86558d037756e49e79717826ae64d5724fab012eb2baa50462feaf9e122e8e6d95439ff639f9db3efb0adabc2b0e2930ba4a7df034aa244a
7
+ data.tar.gz: 5997d78072f0b1068c8fb31d9d639cc6277936452b7670444ebc4a74eb39823e1b695d500bcd3eab618b7b65f8af5f9108cf4431658857925eb5b1c640872200
data/bin/lense CHANGED
@@ -66,8 +66,7 @@ end
66
66
 
67
67
  command :push do |c|
68
68
  c.action do |global_options,options,args|
69
- exit_now!('Must supply a LENSE repository.') if args.count < 1
70
- LENSE_APP.push args[0]
69
+ LENSE_APP.push
71
70
  end
72
71
  end
73
72
 
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.12'
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
- exit_now!("Invalid repo name.") unless repo =~ /\A\w+\/\w+\Z/
273
+ repo = validate_in_repo
258
274
  end
259
275
 
260
276
  def pull()
261
- exit_now!("Not in a lense project.") unless File.directory? '.lense'
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
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.2.12
4
+ version: 0.2.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Zubieta