lense 0.1.32 → 0.1.33
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 +14 -0
- data/lib/lense.rb +14 -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: 996e95ed901327215357b4ba5919f7812b3760a1
|
4
|
+
data.tar.gz: 90c60877f0a3fb7da7d509eb5decaca75c95463c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|