instructions_list 1.0.6.beta → 1.0.7.beta
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/exe/il +67 -9
- data/instructions_list.gemspec +0 -1
- data/lib/instructions_list/version.rb +1 -1
- data/lib/instructions_list.rb +3 -0
- metadata +1 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20ffa50944492bc3074ef7f480f26844c8f1ebfe
|
4
|
+
data.tar.gz: 11caa36e95745d62e008a83f88d299eadd040648
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0aa2e4d5bfe0296e0e7b740bf4cf1064462647d2f8ae8696624e8bd662e0fb34b75f9e17b066b1370040085da04f2c662cdd4e7bb6ee53dde440fb4e15a8a8c7
|
7
|
+
data.tar.gz: c9521aef1bf40101b234da1afb83bcccca381c641c251357c8bdb10254c1ad3405dc26dad550019ab7340574e5a15a130ddef521e775f628c8e25438a2342c59
|
data/exe/il
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require "thor"
|
3
|
-
require '
|
3
|
+
require 'byebug'
|
4
4
|
require_relative "../lib/instructions_list/version"
|
5
5
|
require_relative "../lib/instructions_list"
|
6
6
|
|
@@ -101,7 +101,7 @@ module InstructionsList
|
|
101
101
|
instructable do
|
102
102
|
load_from "Instructions", HOME_CACHE << "/" if home?
|
103
103
|
load_from "Projects", PROJECT_CACHE << "/" if project?
|
104
|
-
|
104
|
+
do_instruction name, STACK, options[:force], p
|
105
105
|
|
106
106
|
end
|
107
107
|
rescue => e
|
@@ -114,6 +114,34 @@ module InstructionsList
|
|
114
114
|
|
115
115
|
end
|
116
116
|
|
117
|
+
desc "undo", "undo an instruction"
|
118
|
+
option :force
|
119
|
+
def undo name
|
120
|
+
if name.nil?
|
121
|
+
say "oops ! you need a name"
|
122
|
+
return
|
123
|
+
end
|
124
|
+
|
125
|
+
begin
|
126
|
+
CHECKED.clear
|
127
|
+
STACK.clear
|
128
|
+
instructable do
|
129
|
+
load_from "Instructions", HOME_CACHE << "/" if home?
|
130
|
+
load_from "Projects", PROJECT_CACHE << "/" if project?
|
131
|
+
undo_instruction name, STACK, options[:force], p
|
132
|
+
|
133
|
+
end
|
134
|
+
rescue => e
|
135
|
+
puts ""
|
136
|
+
puts e.message
|
137
|
+
puts ""
|
138
|
+
puts `il list`
|
139
|
+
puts ""
|
140
|
+
end
|
141
|
+
|
142
|
+
end
|
143
|
+
|
144
|
+
|
117
145
|
map list: :instructions
|
118
146
|
|
119
147
|
no_tasks do
|
@@ -196,7 +224,7 @@ module InstructionsList
|
|
196
224
|
end
|
197
225
|
end
|
198
226
|
|
199
|
-
def
|
227
|
+
def do_instruction name, stack, force, progressbar
|
200
228
|
instruction = InstructionsList::INSTRUCTIONS.find { |i|
|
201
229
|
command_name(i.name.gsub(" ","_")) == command_name(name)
|
202
230
|
}
|
@@ -204,14 +232,30 @@ module InstructionsList
|
|
204
232
|
instruction.depends_on.each do |dependancy|
|
205
233
|
unless stack.include? command_name(dependancy.gsub(" ","_"))
|
206
234
|
stack << command_name(dependancy.gsub(" ","_"))
|
207
|
-
|
235
|
+
do_instruction(command_name(dependancy.gsub(" ", "_")), stack, force, progressbar)
|
208
236
|
end
|
209
237
|
end
|
210
|
-
|
238
|
+
execute_instruction instruction, force: force
|
211
239
|
|
212
240
|
end
|
213
241
|
|
214
|
-
def
|
242
|
+
def undo_instruction name, stack, force, progressbar
|
243
|
+
instruction = InstructionsList::INSTRUCTIONS.find { |i|
|
244
|
+
command_name(i.name.gsub(" ","_")) == command_name(name)
|
245
|
+
}
|
246
|
+
raise "Ooooops cant find #{command_name(name)}" if instruction.nil?
|
247
|
+
instruction.depends_on.each do |dependancy|
|
248
|
+
unless stack.include? command_name(dependancy.gsub(" ","_"))
|
249
|
+
stack << command_name(dependancy.gsub(" ","_"))
|
250
|
+
undo_instruction(command_name(dependancy.gsub(" ", "_")), stack, force, progressbar)
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
execute_uninstruction instruction, force: force
|
255
|
+
|
256
|
+
end
|
257
|
+
|
258
|
+
def execute_instruction instruction, force: false
|
215
259
|
if force
|
216
260
|
instruction.instruct.call()
|
217
261
|
say "#{instruction.name} - forced!"
|
@@ -220,11 +264,25 @@ module InstructionsList
|
|
220
264
|
|
221
265
|
unless instruction.instructed.call()
|
222
266
|
instruction.instruct.call()
|
223
|
-
mark_as_done instruction.name
|
224
|
-
else
|
225
|
-
check instruction.name
|
226
267
|
end
|
268
|
+
|
269
|
+
mark_as_done instruction.name
|
270
|
+
|
271
|
+
end
|
272
|
+
|
273
|
+
def execute_uninstruction instruction, force: false
|
274
|
+
|
275
|
+
if instruction.respond_to? :uninstruct
|
276
|
+
|
277
|
+
instruction.uninstruct.call()
|
278
|
+
|
279
|
+
end
|
280
|
+
|
281
|
+
mark_as_undone instruction.name
|
282
|
+
|
227
283
|
end
|
284
|
+
|
285
|
+
|
228
286
|
end
|
229
287
|
end
|
230
288
|
end
|
data/instructions_list.gemspec
CHANGED
data/lib/instructions_list.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instructions_list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7.beta
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Coco Coder (aka Delaney Burke)
|
@@ -94,20 +94,6 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: pry
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: tty
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|