lense 0.1.38 → 0.1.39

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 +22 -11
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3c001413eaf86ecb1254a41b82f805a3d34b1681
4
- data.tar.gz: 931894190e354913915809b0ad983c0c10823f3e
3
+ metadata.gz: 9d7d65178e1451e35da987d1506c2a4deebfc311
4
+ data.tar.gz: 88ae8045d093a1a8e0e205d389387f4aeef7fac2
5
5
  SHA512:
6
- metadata.gz: e660d11bb0820ee8ad0c4b1718959e14698b21d774907aa0d1272601bf3861cca76ba35987e637ed882c8e76719a83bc640d2e703d9e827da47c63839cda60a4
7
- data.tar.gz: 3fb941fb027380de8f1f4c4e340b297832d223948793e467e9abc4fed8fa3851fb44ab477c5d60d64a5f0bdac1407902a27eec94299239eb987d4560e052643c
6
+ metadata.gz: b032fab4a714bc5506df1e6299dc9cb84cb7b2827508df14b5865b17ee4b1a8c2d65708e7596aa3a64cae1bd076c02416d6c5375ece7b637c534382f1c13252b
7
+ data.tar.gz: 69aa8053300cd931ae128c41438aaf95315c5e61bdab41f03020664bf0747b4922d91c2cd57c977a23a1e461d37f77b054a9727e64a3b3d20b6465374e8eb567
data/lib/lense.rb CHANGED
@@ -6,7 +6,7 @@ require 'sqlite3'
6
6
  class LENSE
7
7
  attr_reader :config, :current_course, :lense_file_hash
8
8
 
9
- VERSION = '0.1.38'
9
+ VERSION = '0.1.39'
10
10
  LENSE_DIR = File.join(ENV['HOME'],'.lense')
11
11
  COURSES_DIR = File.join(LENSE_DIR,'courses')
12
12
  CURRENT_COURSE_FILE = File.join(LENSE_DIR,'current_course')
@@ -135,9 +135,14 @@ class LENSE
135
135
  end
136
136
 
137
137
  def status()
138
- say "Hash : #{@lense_file_hash}"
138
+ #say "Hash : #{@lense_file_hash}"
139
139
  exit_now!("Not a LENSE project: .lense") unless File.directory?(LOCAL_LENSE_DIR)
140
- @DB.execute("select path from staging;").each { |p| say "Staged: #{p}"}
140
+ @DB.execute("select path from staging;").each do
141
+ |p| say "Staged: #{p[0]}"
142
+ # determine if new file
143
+ # or modified old file
144
+ end
145
+
141
146
  # check changes in depenancy files
142
147
  # - for each depenceny
143
148
  # - - get the current file hash
@@ -146,20 +151,26 @@ class LENSE
146
151
  end
147
152
 
148
153
  def commit()
149
- # copy LENSEfile to .lense/refs/#{hash}
150
- # write the new hash to the CURRENT_REF_FILE
151
- # loop through staged dependancies
152
- # - update expected hashes for dependancies
154
+ # add new files to dependancies
155
+ # create a hash for the commit and add to commits
156
+ # for all dependancies add current hashes to revisions
157
+ # truncate staging
153
158
  end
154
159
 
155
160
  def stage(file)
156
- @DB.transaction
157
- @DB.execute "insert into staging (path) values (?);", file if File.file?(file)
158
- @DB.commit
161
+ if File.file?(file) # and new or modified
162
+ @DB.transaction
163
+ @DB.execute "insert into staging (path) values (?);", file
164
+ @DB.commit
165
+ end
159
166
  end
160
167
 
161
168
  def unstage(file)
162
- @DB.execute "delete from staging where path = '?';", file
169
+ if File.file?(file)
170
+ @DB.transaction
171
+ @DB.execute "delete from staging where path = ?;", file
172
+ @DB.commit
173
+ end
163
174
  end
164
175
 
165
176
  def remove(file)
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.38
4
+ version: 0.1.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Zubieta