lense 0.1.32 → 0.1.33

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 +14 -0
  3. data/lib/lense.rb +14 -2
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ecf97e0a23acb96f3d84a029e60a585241041ff0
4
- data.tar.gz: b8bd992c51ffa86246dfed2c4104655658e425af
3
+ metadata.gz: 996e95ed901327215357b4ba5919f7812b3760a1
4
+ data.tar.gz: 90c60877f0a3fb7da7d509eb5decaca75c95463c
5
5
  SHA512:
6
- metadata.gz: e3e3f1fbb7ce8c3afa1817a5c3414fc217d8e3cfac4e7ed5f49b836bd584bf99eb5d24ef0fa2f3c09001a671482bc4d642351de31bd48771e39f81eff09b0871
7
- data.tar.gz: 5542bd124a099f7292723fa27989f15fc0d1e41a65500c56f78a7f060b60f45fe2d0c3eb48bc2092cb9f28ecfd292bfa0b1ccf6bc45a366298081394ce039c73
6
+ metadata.gz: 79cdc104137830d20ed0212a73840d3bd89d97d1d42ee61547dfbf1dd6f3c8a04d6833d53e69c030619896a2238d81a0048ec6c599d6d7444ec726416ee37625
7
+ data.tar.gz: 5c75ca073d1a093500810c66763d7a4e42beaa22b533fdb0f940e728c8bc48b74b2fe43ea683cddeaa47e395d3c80f5d577c292e11fb35921e7968b4dcbf23fb
data/bin/lense CHANGED
@@ -108,4 +108,18 @@ command :status do |c|
108
108
  end
109
109
  end
110
110
 
111
+ command :stage do |c|
112
+ c.action do |global_options,options,args|
113
+ exit_now!('Must supply files.') if args.count < 1
114
+ LENSE_APP.stage args[0]
115
+ end
116
+ end
117
+
118
+ command :unstage do |c|
119
+ c.action do |global_options,options,args|
120
+ exit_now!('Must supply files.') if args.count < 1
121
+ LENSE_APP.unstage args[0]
122
+ end
123
+ end
124
+
111
125
  exit run(ARGV)
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.32'
9
+ VERSION = '0.1.33'
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')
@@ -30,7 +30,6 @@ class LENSE
30
30
  @current_course = '> NOT SET <' if @current_course.empty?
31
31
  @lense_file_hash = Digest::SHA256.hexdigest(File.read(LENSE_FILE)) if File.file?(LENSE_FILE)
32
32
  @DB = SQLite3::Database.new File.join(LOCAL_LENSE_DIR,'db')
33
- setup_db()
34
33
  end
35
34
 
36
35
  def select_course(course)
@@ -132,11 +131,13 @@ class LENSE
132
131
  end
133
132
  say "Created template LENSEfile"
134
133
  end
134
+ setup_db()
135
135
  end
136
136
 
137
137
  def status()
138
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
141
  # check changes in depenancy files
141
142
  # - for each depenceny
142
143
  # - - get the current file hash
@@ -152,9 +153,11 @@ class LENSE
152
153
  end
153
154
 
154
155
  def stage(file)
156
+ @db.execute "insert into staging (path) values (?);", file if File.file?(file)
155
157
  end
156
158
 
157
159
  def unstage(file)
160
+ @db.execute "delete from staging where path = '?';", file
158
161
  end
159
162
 
160
163
  def remove(file)
@@ -200,5 +203,14 @@ class LENSE
200
203
  @db.execute <<-SQL
201
204
  CREATE INDEX IF NOT EXISTS revisions_commit_id_idx ON revisions (commit_id);
202
205
  SQL
206
+ @db.execute <<-SQL
207
+ CREATE TABLE IF NOT EXISTS staging (
208
+ id integer primary key autoincrement,
209
+ path text not null
210
+ );
211
+ SQL
212
+ @db.execute <<-SQL
213
+ CREATE UNIQUE INDEX IF NOT EXISTS staging_path_idx ON staging (path);
214
+ SQL
203
215
  end
204
216
  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.32
4
+ version: 0.1.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Zubieta