instructions_list 1.0.8.5.beta → 1.0.9.0.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: '077800184ff2fbe80353d10b849c9ad4dfb564c9'
4
- data.tar.gz: 8e24f38fe4abf9a5a8eccb58e2a6436dcfe4b496
3
+ metadata.gz: 9388cc2104ae830ba9a03a6abfda944e84cbff43
4
+ data.tar.gz: a90e1b5341f68699411587cfa824e8a8f4d7374c
5
5
  SHA512:
6
- metadata.gz: 62be52be80fb7fba7771bdf98133f13ce14b69f67fbefa521dc47f71c5c6906084e9875d76e0df09b2b1fd2c9b05dd1ee451c20801d38ae1862c7bd10439a6c9
7
- data.tar.gz: a6aa6f93057368c0c1287fd8dcfa15fafd8314a194b30e29a4ea6dcd0f232aedd7eb1b67f5140c82fbfce0cdf9dd7f557ef612fd779d975aab8e219ecdf51e20
6
+ metadata.gz: 1921e7251fe57c296b25060912372b9fed697ca77ffc67843c01d36e7cf326f2ae8213e6288a80c9a922e12f8587e3e86ff4f47dc8ff63ee0f8d6ab7540bbafe
7
+ data.tar.gz: c07c8e50a62406998205b7c49e230d182f45a6d80419704947813941bd43e31c5aa18fe1ae02255d00e62b37bcb29182eb09c627280ffbba0a1368263b52f9c5
@@ -0,0 +1,11 @@
1
+ instruction 'check:child' do
2
+ instructed?{
3
+ It::Is.done? 'check:child'
4
+ }
5
+ instruct{
6
+ `echo check child`
7
+ }
8
+
9
+ uninstruct{
10
+ }
11
+ end
@@ -0,0 +1,15 @@
1
+ instruction 'check:ok' do
2
+ depends_on 'check:child'
3
+ instructed?{
4
+ It::Is.done? 'check:ok'
5
+ }
6
+ instruct{
7
+ `sudo echo check ok!`
8
+ }
9
+
10
+ uninstruct{
11
+ `echo poop`
12
+ `echo poop you`
13
+ `sudo echo poop`
14
+ }
15
+ end
data/.instructions/key ADDED
@@ -0,0 +1 @@
1
+ ILSGIKVWXND
@@ -0,0 +1 @@
1
+ demo
data/exe/il CHANGED
@@ -17,40 +17,56 @@ module InstructionsList
17
17
  system "mkdir -p #{INSTRUCTIONS_DIR}"
18
18
  system "touch #{KEY_PATH}"
19
19
  system "echo #{key} > #{KEY_PATH}"
20
- invoke :sync
20
+ sync
21
21
  end
22
+
22
23
  desc "reset", "reset state"
23
24
  def reset
24
- instructable do
25
- system "rm -rf .instructions" if File.exists? STATE
25
+
26
+ if project?
27
+ system "rm -rf #{STATE}" if File.exists? STATE
26
28
  end
29
+
30
+ if home?
31
+ Dir.chdir(ENV['HOME']) do
32
+ system "rm -rf #{STATE}" if File.exists? STATE
33
+ end
34
+ end
35
+
27
36
  end
37
+
28
38
  desc "sync", "synchronize the instructions"
29
39
  option :reset
30
40
  def sync key=nil
31
- if instructable?
32
- system "mkdir -p #{PROJECT_CACHE}"
33
- system "mkdir -p #{PROJECT_CACHE_ARTIFACTS}"
34
- if options[:reset]
35
- system "rm -rf #{PROJECT_CACHE}" if Dir.exists? PROJECT_CACHE
36
- return
37
- end
38
- instructable do
39
- begin
40
- CacheBuilder.new(get_key,HOST,cache=PROJECT_CACHE,artifact_cache=PROJECT_CACHE_ARTIFACTS).build
41
- rescue SocketError
41
+ begin
42
+ if project?
43
+ system "mkdir -p #{PROJECT_CACHE}"
44
+ system "mkdir -p #{PROJECT_CACHE_ARTIFACTS}"
45
+ if options[:reset]
46
+ system "rm -rf #{PROJECT_CACHE}" if Dir.exists? PROJECT_CACHE
42
47
  end
48
+ CacheBuilder.new(get_key,HOST,cache=PROJECT_CACHE,artifact_cache=PROJECT_CACHE_ARTIFACTS).build
43
49
  end
44
50
 
45
- else
46
- return sync_home_instructions
51
+ if home?
52
+ Dir.chdir HOME do
53
+ if options[:reset]
54
+ system "rm -rf #{HOME_CACHE}" if Dir.exists? HOME_CACHE
55
+ end
56
+ CacheBuilder.new(get_key,HOST,cache=HOME_CACHE,artifact_cache=HOME_CACHE_ARTIFACTS).build
57
+ end
58
+ end
59
+ rescue SocketError
60
+ say "Ooooops cant find #{HOST}"
47
61
  end
62
+
48
63
  end
49
64
 
50
65
 
51
66
  desc "list", "list all instructions"
52
67
  def instructions
53
- invoke :sync
68
+ sync
69
+
54
70
  if project?
55
71
  list_from "Project", PROJECT_CACHE << '/' do |name|
56
72
  say show_command_for name
@@ -59,17 +75,14 @@ module InstructionsList
59
75
  list_from "Home", HOME_CACHE << '/' do |name|
60
76
  say show_command_for name
61
77
  end
62
- elsif home?
63
- Dir.chdir(ENV['HOME']) do
64
- list_from "Home", HOME_CACHE << '/' do |name|
65
- say show_command_for name
66
- end
67
- end
68
- else
69
- Dir.chdir(ENV['HOME']) do
70
- list_from "Home", HOME_CACHE << '/' do |name|
71
- say show_command_for name
72
- end
78
+
79
+ return
80
+
81
+ end
82
+
83
+ Dir.chdir(ENV['HOME']) do
84
+ list_from "Home", HOME_CACHE << '/' do |name|
85
+ say show_command_for name
73
86
  end
74
87
  end
75
88
 
@@ -84,7 +97,11 @@ module InstructionsList
84
97
  end
85
98
  say "host: #{HOST}"
86
99
  if File.exist? STATE
87
- say `cat #{STATE}`
100
+ puts ""
101
+ `cat #{STATE}`.split("\n").each do |line|
102
+ say "#{line.chomp} ✔"
103
+ end
104
+ puts ""
88
105
  end
89
106
  end
90
107
 
@@ -92,7 +109,7 @@ module InstructionsList
92
109
  desc "do", "do an instruction"
93
110
  option :force
94
111
  def do name
95
- invoke :sync
112
+ sync
96
113
  if name.nil?
97
114
  say "oops ! you need a name"
98
115
  return
@@ -101,18 +118,18 @@ module InstructionsList
101
118
  begin
102
119
  CHECKED.clear
103
120
  STACK.clear
104
- instructable do
105
- load_from "Instructions", HOME_CACHE << "/" if home?
106
- load_from "Projects", PROJECT_CACHE << "/" if project?
107
- do_instruction name, STACK, options[:force]
121
+ load_from "Instructions", HOME_CACHE << "/" if home?
122
+ load_from "Projects", PROJECT_CACHE << "/" if project?
123
+ do_instruction name, STACK, options[:force]
124
+ rescue => e
108
125
 
126
+ say ""
127
+ say e.message
128
+ say ""
129
+ if e.message.include? "cant find"
130
+ instructions
109
131
  end
110
- rescue => e
111
- puts ""
112
- puts e.message
113
- puts ""
114
- puts `il list`
115
- puts ""
132
+ say ""
116
133
  end
117
134
 
118
135
  end
@@ -120,7 +137,7 @@ module InstructionsList
120
137
  desc "undo", "undo an instruction"
121
138
  option :force
122
139
  def undo name
123
- invoke :sync
140
+ sync
124
141
  if name.nil?
125
142
  say "oops ! you need a name"
126
143
  return
@@ -129,18 +146,18 @@ module InstructionsList
129
146
  begin
130
147
  CHECKED.clear
131
148
  STACK.clear
132
- instructable do
133
- load_from "Instructions", HOME_CACHE << "/" if home?
134
- load_from "Projects", PROJECT_CACHE << "/" if project?
135
- undo_instruction name, STACK, options[:force]
149
+ load_from "Instructions", HOME_CACHE << "/" if home?
150
+ load_from "Projects", PROJECT_CACHE << "/" if project?
151
+ undo_instruction name, STACK, options[:force]
152
+ rescue => e
136
153
 
154
+ say ""
155
+ say e.message
156
+ say ""
157
+ if e.message.include? "cant find"
158
+ instructions
137
159
  end
138
- rescue => e
139
- puts ""
140
- puts e.message
141
- puts ""
142
- system "il list"
143
- puts ""
160
+ say ""
144
161
  end
145
162
 
146
163
  end
@@ -149,25 +166,6 @@ module InstructionsList
149
166
  map list: :instructions
150
167
 
151
168
  no_tasks do
152
- def sync_home_instructions
153
- system "mkdir -p /tmp/il/cache"
154
- Dir.chdir ENV['HOME'] do
155
-
156
- if options[:reset]
157
- system "rm -rf #{HOME_CACHE}" if Dir.exists? HOME_CACHE
158
- return
159
- end
160
-
161
- instructable do
162
- begin
163
- CacheBuilder.new(get_key).build
164
- rescue SocketError
165
- end
166
- end
167
- end
168
- end
169
-
170
-
171
169
 
172
170
  def get_key
173
171
  return "Not connected!" unless File.exists? KEY_PATH
@@ -183,33 +181,13 @@ module InstructionsList
183
181
  end
184
182
 
185
183
 
186
- def instructable?
187
-
188
- if Dir.exists? "./.instructions"
189
- if File.exists? "./.instructions/key"
190
- return true
191
- end
192
- end
193
-
194
- false
195
- end
196
-
197
- def instructable
198
- if instructable?
199
- yield
200
- return
201
- else
202
- return false unless home?
203
- end
204
- say "Ooops! Not a instruction list directory"
205
- end
206
-
207
184
  def home?
208
185
  `pwd`.chomp == ENV['HOME']
209
186
  end
210
187
 
211
188
  def project?
212
- File.exists?("./instructions") && !home?
189
+ return false if home?
190
+ File.exists?("./.instructions")
213
191
  end
214
192
 
215
193
 
@@ -222,8 +200,7 @@ module InstructionsList
222
200
  puts "#{location}\n"
223
201
 
224
202
  Dir["#{path}*.rb"].each {|file|
225
- pn = Pathname.new(file)
226
- yield File.basename(pn).gsub(".rb","")
203
+ yield File.basename(file).gsub(".rb","")
227
204
  }
228
205
 
229
206
  end
@@ -231,17 +208,22 @@ module InstructionsList
231
208
  def load_from name, path
232
209
  if Dir["#{path}*.rb"].any?
233
210
  Dir["#{path}*.rb"].each {|file|
234
- pn = Pathname.new(file)
235
211
  require file
236
212
  }
237
213
  end
238
214
  end
239
215
 
240
216
  def do_instruction name, stack, force
217
+
218
+ InstructionsList::INSTRUCTIONS
219
+
241
220
  instruction = InstructionsList::INSTRUCTIONS.find { |i|
242
221
  command_name(i.name.gsub(" ","_")) == command_name(name)
243
222
  }
244
223
  raise "Ooooops cant find #{command_name(name)}" if instruction.nil?
224
+
225
+
226
+
245
227
  instruction.depends_on.each do |dependancy|
246
228
  unless stack.include? command_name(dependancy.gsub(" ","_"))
247
229
  stack << command_name(dependancy.gsub(" ","_"))
@@ -1,3 +1,3 @@
1
1
  module InstructionsList
2
- VERSION = "1.0.8.5.beta"
2
+ VERSION = "1.0.9.0.beta"
3
3
  end
@@ -86,7 +86,6 @@ module InstructionsList
86
86
  def mark_as_done(name)
87
87
  system "mkdir -p './.instructions/'"
88
88
  system "touch #{STATE}"
89
- system "echo #{command_name(name.to_s.gsub(" ","_"))} >> #{STATE}"
90
89
  check command_name(name)
91
90
  end
92
91
  def mark_as_undone(name)
@@ -102,12 +101,12 @@ module InstructionsList
102
101
 
103
102
  def check name
104
103
 
105
- unless CHECKED.include? command_name(name)
104
+ if File.readlines(STATE).map{|line| line.chomp}.include? command_name(name)
106
105
  system "echo #{command_name(name)} ✔︎"
107
- return
106
+ else
107
+ CHECKED << command_name(name)
108
+ system "echo #{command_name(name.to_s.gsub(" ","_"))} >> #{STATE}"
108
109
  end
109
-
110
- CHECKED << command_name(name)
111
110
  end
112
111
  end
113
112
 
data/tags CHANGED
@@ -4,13 +4,16 @@
4
4
  !_TAG_PROGRAM_NAME Exuberant Ctags //
5
5
  !_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
6
6
  !_TAG_PROGRAM_VERSION 5.8 //
7
+ CLI exe/il /^ class CLI < Thor$/;" c class:InstructionsList
8
+ CacheArtifactItem lib/instructions_list.rb /^ class CacheArtifactItem$/;" c
7
9
  CacheBuilder lib/instructions_list.rb /^ class CacheBuilder$/;" c
8
10
  CacheItem lib/instructions_list.rb /^ class CacheItem$/;" c class:InstructionsList
9
11
  DSL lib/instructions_list.rb /^ module DSL$/;" m class:InstructionsList
10
12
  Instruction lib/instructions_list.rb /^ class Instruction$/;" c class:InstructionsList
13
+ InstructionsList exe/il /^module InstructionsList$/;" m
11
14
  InstructionsList lib/instructions_list.rb /^module InstructionsList$/;" m
12
15
  InstructionsList lib/instructions_list/version.rb /^module InstructionsList$/;" m
13
- InstructionsList lib/package_manager.rb /^module InstructionsList do$/;" m
16
+ InstructionsList lib/package_manager.rb /^module InstructionsList$/;" m
14
17
  Is lib/instructions_list.rb /^ class Is$/;" c class:InstructionsList.It
15
18
  It lib/instructions_list.rb /^ class It$/;" c class:InstructionsList
16
19
  PackageManager lib/package_manager.rb /^ class PackageManager$/;" c class:InstructionsList
@@ -18,18 +21,44 @@ aptget lib/package_manager.rb /^ def self.aptget?$/;" F class:InstructionsLis
18
21
  brew lib/package_manager.rb /^ def self.brew?$/;" F class:InstructionsList.PackageManager
19
22
  build lib/instructions_list.rb /^ def build$/;" f class:CacheBuilder
20
23
  check lib/instructions_list.rb /^ def check name$/;" f class:InstructionsList.DSL
21
- depends_on lib/instructions_list.rb /^ def depends_on name$/;" f class:InstructionsList.DSL
24
+ command_name lib/instructions_list.rb /^ def command_name(name)$/;" f class:InstructionsList.DSL
25
+ depends_on lib/instructions_list.rb /^ def depends_on name$/;" f class:InstructionsList.DSL
26
+ do exe/il /^ def do name$/;" f
27
+ do_instruction exe/il /^ def do_instruction name, stack, force$/;" f
22
28
  done lib/instructions_list.rb /^ def self.done? name$/;" F class:InstructionsList.It.Is
23
- done lib/instructions_list.rb /^ def done(name)$/;" f class:InstructionsList.DSL
29
+ execute_instruction exe/il /^ def execute_instruction instruction, force: false$/;" f
30
+ execute_uninstruction exe/il /^ def execute_uninstruction instruction, force: false$/;" f
24
31
  exists lib/instructions_list.rb /^ def self.exists? path$/;" F class:InstructionsList.It
32
+ get_key exe/il /^ def get_key$/;" f
33
+ get_name exe/il /^ def get_name()$/;" f
34
+ has_name? exe/il /^ def has_name?$/;" f
35
+ home? exe/il /^ def home?$/;" f
36
+ info exe/il /^ def info$/;" f
37
+ init exe/il /^ def init key$/;" f class:InstructionsList.CLI
25
38
  initialize lib/instructions_list.rb /^ def initialize$/;" f class:InstructionsList.Instruction
26
- initialize lib/instructions_list.rb /^ def initialize(file_name)$/;" f class:InstructionsList.CacheItem
27
- initialize lib/instructions_list.rb /^ def initialize(key,host=HOST)$/;" f class:CacheBuilder
39
+ initialize lib/instructions_list.rb /^ def initialize(file_name,cache=HOME_CACHE)$/;" f class:InstructionsList.CacheItem
40
+ initialize lib/instructions_list.rb /^ def initialize(file_name,cache=HOME_CACHE_ARTIFACTS)$/;" f class:CacheArtifactItem
41
+ initialize lib/instructions_list.rb /^ def initialize(key,host=HOST,cache=HOME_CACHE,artifact_cache=HOME_CACHE_ARTIFACTS)$/;" f class:CacheBuilder
28
42
  installed lib/instructions_list.rb /^ def self.installed? path$/;" F class:InstructionsList.It.Is
29
43
  instruct lib/instructions_list.rb /^ def instruct &block$/;" f class:InstructionsList.DSL
30
44
  instructed? lib/instructions_list.rb /^ def instructed? &block$/;" f class:InstructionsList.DSL
31
45
  instruction lib/instructions_list.rb /^ def instruction name,&block$/;" f class:InstructionsList.DSL
46
+ instructions exe/il /^ def instructions$/;" f class:InstructionsList.CLI
47
+ list_from exe/il /^ def list_from location,path$/;" f
48
+ load_from exe/il /^ def load_from name, path$/;" f
49
+ mark_as_done lib/instructions_list.rb /^ def mark_as_done(name)$/;" f class:InstructionsList.DSL
50
+ mark_as_undone lib/instructions_list.rb /^ def mark_as_undone(name)$/;" f class:InstructionsList.DSL
32
51
  on lib/instructions_list.rb /^ def on os$/;" f class:InstructionsList.DSL
52
+ project? exe/il /^ def project?$/;" f
53
+ reset exe/il /^ def reset$/;" f class:InstructionsList.CLI
54
+ reverse_command_name lib/instructions_list.rb /^ def reverse_command_name(name)$/;" f class:InstructionsList.DSL
33
55
  running lib/instructions_list.rb /^ def self.running? name$/;" F class:InstructionsList.It.Is
56
+ show_command_for exe/il /^ def show_command_for name$/;" f
57
+ source_root exe/il /^ def self.source_root$/;" F class:InstructionsList.CLI
58
+ sync exe/il /^ def sync key=nil$/;" f class:InstructionsList.CLI
59
+ undo exe/il /^ def undo name$/;" f
60
+ undo_instruction exe/il /^ def undo_instruction name, stack, force$/;" f
61
+ uninstruct lib/instructions_list.rb /^ def uninstruct &block$/;" f class:InstructionsList.DSL
34
62
  write lib/instructions_list.rb /^ def write content$/;" f class:InstructionsList.CacheItem
63
+ write lib/instructions_list.rb /^ def write content,directory$/;" f class:CacheArtifactItem
35
64
  yum lib/package_manager.rb /^ def self.yum?$/;" F class:InstructionsList.PackageManager
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.8.5.beta
4
+ version: 1.0.9.0.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Coco Coder (aka Delaney Burke)
@@ -105,6 +105,10 @@ extra_rdoc_files: []
105
105
  files:
106
106
  - ".byebug_history"
107
107
  - ".gitignore"
108
+ - ".instructions/cache/check_child.rb"
109
+ - ".instructions/cache/check_ok.rb"
110
+ - ".instructions/key"
111
+ - ".instructions/list_data"
108
112
  - ".ruby-version"
109
113
  - CODE_OF_CONDUCT.md
110
114
  - Gemfile