instructions_list 0.1.10.beta → 0.1.12.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: 1497553aa8abff25bc1219f50dbcef8a8e21cec8
4
- data.tar.gz: 63a131707d79a6d9bfe4f85c9bc0d383efd2a918
3
+ metadata.gz: 223c658ac0f25914718df53e1c899a469accf015
4
+ data.tar.gz: b756acfdb6c16a14ddbd4b9cd51f55eff648309e
5
5
  SHA512:
6
- metadata.gz: f9b345d168ae227bafd3dc90defd53e6e6c0ffd3127e9b4102493204240c5019ff24a19d20232678c55dbb23df1dd415917a010665667aeeea4aac0565a036c4
7
- data.tar.gz: 448f86e67be65f1c80127e4459de890056a3868d547f0c33ea95d1253f31f891491d35548673944b35ebff0add2a64903f8ed956f114d967cdb99a3a8fbcdbac
6
+ metadata.gz: 923abfae8db60f5791cc5e2fe2a1c4dda2c9c2c5011967bf0d4e5764f8a6f4d146cbc824337bdf33a942a52956ecf1c91ebd4b5d771226fbc08fccd677309e6f
7
+ data.tar.gz: 8fdf7718a069ff104bcd78d0216370f6eef2e0223dcde88870d01cadb351d7b92eb261ad475824e83f299d8fb5357e852911fcd04c182bb24388651199f5ef5d
data/exe/il CHANGED
@@ -31,7 +31,9 @@ module InstructionsList
31
31
  end
32
32
  desc "reset", "reset state"
33
33
  def reset
34
- `rm ./.instructions/state`
34
+ instructable do
35
+ `rm ./.instructions/state`
36
+ end
35
37
  end
36
38
  desc "instructions", "list all instructions"
37
39
  def instructions
@@ -51,32 +53,38 @@ module InstructionsList
51
53
  puts ""
52
54
  end
53
55
  desc "do", "do an instruction"
54
- def do instruction=:all
56
+ option :force
57
+ def do name=:all
58
+ instructable do
59
+ load_from "Defaults","#{File.join(File.dirname(__FILE__), "../instructions/")}"
60
+ load_from "User","~/instructions/"
61
+ load_from "Project","./instructions/"
62
+ handle_instruction name,force: options[:force]
63
+ end
64
+ end
55
65
 
56
- load_from "Defaults","#{File.join(File.dirname(__FILE__), "../instructions/")}"
57
- load_from "User","~/instructions/"
58
- load_from "Project","./instructions/"
66
+ no_tasks do
67
+ def instructable
68
+ if Dir.exists? "./instructions"
69
+ if Dir.exists? "./.instructions"
70
+ yield
71
+ return
72
+ end
73
+ end
59
74
 
60
- instruction = InstructionsList::INSTRUCTIONS.find{ |i| i.name == instruction }
61
- raise "Ooooops cant find #{instruction}" if instruction.nil?
75
+ say "Ooops! Not a instruction list directory"
62
76
 
63
- instruction.depends_on.each do |dependancy|
64
- dep = InstructionsList::INSTRUCTIONS.find{ |i| i.name == dependancy}
65
- raise "Ooooops cant find #{dependancy}" if dep.nil?
66
- execute dep
67
77
  end
68
78
 
69
79
 
70
- execute instruction
71
- end
72
-
73
- no_tasks do
74
80
  def show_command_for path
75
81
  return " None" if path == " None"
76
82
  " il do #{path}"
77
83
  end
84
+
78
85
  def list_from location,path
79
86
  puts "#{location}"
87
+
80
88
  if Dir["#{path}*.rb"].any?
81
89
  Dir["#{path}*.rb"].each {|file|
82
90
  pn = Pathname.new(file)
@@ -86,6 +94,7 @@ module InstructionsList
86
94
  yield " None"
87
95
  end
88
96
  end
97
+
89
98
  def load_from name, path
90
99
  #puts "search in #{name}"
91
100
 
@@ -99,7 +108,23 @@ module InstructionsList
99
108
  #puts " none"
100
109
  end
101
110
  end
102
- def execute instruction
111
+
112
+ def handle_instruction name, force: false
113
+ instruction = InstructionsList::INSTRUCTIONS.find{ |i| i.name == name }
114
+ raise "Ooooops cant find #{instruction}" if instruction.nil?
115
+ instruction.depends_on.each do |dependancy|
116
+ handle_instruction dependancy,force: force
117
+ end
118
+ execute instruction,force: force
119
+ end
120
+
121
+ def execute instruction,force: false
122
+ if force
123
+ instruction.instruct.call()
124
+ say "#{instruction.name} - forced!"
125
+ return
126
+ end
127
+
103
128
  unless instruction.instructed.call()
104
129
  instruction.instruct.call()
105
130
  done instruction.name
@@ -1,3 +1,3 @@
1
1
  module InstructionsList
2
- VERSION = "0.1.10.beta"
2
+ VERSION = "0.1.12.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: 0.1.10.beta
4
+ version: 0.1.12.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-10-26 00:00:00.000000000 Z
11
+ date: 2017-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler