instructions_list 1.0.10.beta → 1.0.10.1.beta

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a92a3be12a91a6eeb61536331a1fceff8a930fb
4
- data.tar.gz: 0cde8f4a0b3697626698fce31c6b6c0478ccf0f7
3
+ metadata.gz: f062859e33300288bb0fb499a4bb6fc8d3c887e9
4
+ data.tar.gz: 36ad516881ddbc952233d0fe0086048f69bd3fd0
5
5
  SHA512:
6
- metadata.gz: 95971c8aeaa9dc4866bc53d4526d53b6db0586345edb2dc1dd048c8fb6868b904e6abbfdb3c84e677156f45c1d79f0915ba63660055ad70d044b712aeb54142e
7
- data.tar.gz: 5cbf030565c4042851071efb28b0d8939ba9cfa969d78cca234513dc22742088c1da900e5a3c2e45b2166028cc94232210a309711f65b65bca0b1c38bbc8cbae
6
+ metadata.gz: 9f8c1714da2f1eac4915a8a7daddd5d300ef1ee7ca8200f3dd0dbe083bdbab63521bc3c9e0cd80b964d25069bd5c49beb2194741d48f4bd90dbdc615de3fe3a7
7
+ data.tar.gz: 0c532855dee48c715061798530e92a1805bd6872bc2d4ff442205c8c70c797229b0a1015e7b20568bc6a689060b3d6f8c7a227637174454ca2709c757a4c149e
data/exe/il CHANGED
@@ -69,6 +69,8 @@ module InstructionsList
69
69
  desc "list", "list all instructions"
70
70
  def instructions
71
71
 
72
+ sync
73
+
72
74
  instructable do
73
75
 
74
76
  if project?
@@ -143,7 +145,7 @@ module InstructionsList
143
145
 
144
146
  desc "undo", "undo an instruction"
145
147
  option :force
146
- def undo name
148
+ def undo name=:last
147
149
 
148
150
  instructable do
149
151
  sync
@@ -199,6 +201,11 @@ module InstructionsList
199
201
  File.exist? LIST_DATA_PATH
200
202
  end
201
203
 
204
+ def find_name_of_last_intruction
205
+
206
+ File.readlines(STATE).last.chomp if File.readlines(STATE).last
207
+ end
208
+
202
209
 
203
210
  def home?
204
211
  `pwd`.chomp == ENV['HOME']
@@ -253,16 +260,27 @@ module InstructionsList
253
260
 
254
261
  end
255
262
 
256
- def undo_instruction name, stack, force
257
- instruction = InstructionsList::INSTRUCTIONS.find { |i|
258
- command_name(i.name.gsub(" ","_")) == command_name(name)
259
- }
260
- raise "Ooooops cant find #{command_name(name)}" if instruction.nil?
261
- instruction.depends_on.each do |dependancy|
262
- unless stack.include? command_name(dependancy.gsub(" ","_"))
263
- stack << command_name(dependancy.gsub(" ","_"))
264
- undo_instruction(command_name(dependancy.gsub(" ", "_")), stack, force)
263
+ def undo_instruction name=:last, stack, force
264
+ InstructionsList::INSTRUCTIONS
265
+
266
+ if name==:last
267
+
268
+ name = find_name_of_last_intruction
269
+
270
+ if name.nil?
271
+ raise "Ooooops no instructions to undo"
265
272
  end
273
+
274
+ instruction = InstructionsList::INSTRUCTIONS.find { |i|
275
+ command_name(i.name.gsub(" ","_")) == command_name(name)
276
+ }
277
+ raise "Ooooops cant find #{command_name(name)}" if instruction.nil?
278
+ say "undo last"
279
+ else
280
+ instruction = InstructionsList::INSTRUCTIONS.find { |i|
281
+ command_name(i.name.gsub(" ","_")) == command_name(name)
282
+ }
283
+ raise "Ooooops cant find #{command_name(name)}" if instruction.nil?
266
284
  end
267
285
 
268
286
  execute_uninstruction instruction, force: force
@@ -1,3 +1,3 @@
1
1
  module InstructionsList
2
- VERSION = "1.0.10.beta"
2
+ VERSION = "1.0.10.1.beta"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instructions_list
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.10.beta
4
+ version: 1.0.10.1.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Coco Coder (aka Delaney Burke)
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-24 00:00:00.000000000 Z
11
+ date: 2017-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler