instructions_list 1.0.9.4.1.beta → 1.0.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44ba1c64d1ffc87cb9ebea982ad1e8e3e47fd2ae
4
- data.tar.gz: 0326eb374c345059dd291703a57b8c76529c46c6
3
+ metadata.gz: 7a92a3be12a91a6eeb61536331a1fceff8a930fb
4
+ data.tar.gz: 0cde8f4a0b3697626698fce31c6b6c0478ccf0f7
5
5
  SHA512:
6
- metadata.gz: eb6f5b58ded1a52fcc2675e039a751c67fb9686458a1ef1c475ed65f823876bf6c0826bb212bfe9ae89883d7f761c29388e9c14fec684fadf9d287b0bc7dc78d
7
- data.tar.gz: edb9110571919eca2bb92e303371c3bb9a74088589620aa52e74b88cc0ff53e1b39bc4f791dd6e35263ab0308fc9bec451bc171ce1c312ab5e64c98f8f5808a7
6
+ metadata.gz: 95971c8aeaa9dc4866bc53d4526d53b6db0586345edb2dc1dd048c8fb6868b904e6abbfdb3c84e677156f45c1d79f0915ba63660055ad70d044b712aeb54142e
7
+ data.tar.gz: 5cbf030565c4042851071efb28b0d8939ba9cfa969d78cca234513dc22742088c1da900e5a3c2e45b2166028cc94232210a309711f65b65bca0b1c38bbc8cbae
@@ -3,7 +3,7 @@ instruction 'check:child' do
3
3
  It::Is.done? 'check:child'
4
4
  }
5
5
  instruct{
6
- `echo check child`
6
+ system "echo check child"
7
7
  }
8
8
 
9
9
  uninstruct{
@@ -4,12 +4,12 @@ instruction 'check:ok' do
4
4
  It::Is.done? 'check:ok'
5
5
  }
6
6
  instruct{
7
- `sudo echo check ok!`
7
+ system "sudo echo check ok!"
8
8
  }
9
9
 
10
10
  uninstruct{
11
- `echo poop`
12
- `echo poop you`
13
- `sudo echo poop`
11
+ system 'echo poop'
12
+ system 'echo poop you'
13
+ system 'sudo echo poop'
14
14
  }
15
15
  end
data/exe/il CHANGED
@@ -23,14 +23,16 @@ module InstructionsList
23
23
  desc "reset", "reset state"
24
24
  def reset
25
25
 
26
- if project?
27
- system "rm -rf #{STATE}" if File.exists? STATE
28
- end
29
-
30
- if home?
31
- Dir.chdir(ENV['HOME']) do
26
+ instructable do
27
+ if project?
32
28
  system "rm -rf #{STATE}" if File.exists? STATE
33
29
  end
30
+
31
+ if home?
32
+ Dir.chdir(ENV['HOME']) do
33
+ system "rm -rf #{STATE}" if File.exists? STATE
34
+ end
35
+ end
34
36
  end
35
37
 
36
38
  end
@@ -38,126 +40,134 @@ module InstructionsList
38
40
  desc "sync", "synchronize the instructions"
39
41
  option :reset
40
42
  def sync key=nil
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
43
+ instructable do
44
+ begin
45
+ if project?
46
+ system "mkdir -p #{PROJECT_CACHE}"
47
+ system "mkdir -p #{PROJECT_CACHE_ARTIFACTS}"
48
+ if options[:reset]
49
+ system "rm -rf #{PROJECT_CACHE}" if Dir.exists? PROJECT_CACHE
50
+ end
51
+ CacheBuilder.new(get_key,HOST,cache=PROJECT_CACHE,artifact_cache=PROJECT_CACHE_ARTIFACTS).build
47
52
  end
48
- CacheBuilder.new(get_key,HOST,cache=PROJECT_CACHE,artifact_cache=PROJECT_CACHE_ARTIFACTS).build
49
- end
50
53
 
51
- if home?
52
- Dir.chdir ENV['HOME'] do
53
- if options[:reset]
54
- system "rm -rf #{HOME_CACHE}" if Dir.exists? HOME_CACHE
54
+ if home?
55
+ Dir.chdir ENV['HOME'] do
56
+ if options[:reset]
57
+ system "rm -rf #{HOME_CACHE}" if Dir.exists? HOME_CACHE
58
+ end
59
+ CacheBuilder.new(get_key,HOST,cache=HOME_CACHE,artifact_cache=HOME_CACHE_ARTIFACTS).build
55
60
  end
56
- CacheBuilder.new(get_key,HOST,cache=HOME_CACHE,artifact_cache=HOME_CACHE_ARTIFACTS).build
57
61
  end
62
+ rescue SocketError
63
+ say "Ooooops cant find #{HOST}"
58
64
  end
59
- rescue SocketError
60
- say "Ooooops cant find #{HOST}"
61
65
  end
62
-
63
66
  end
64
67
 
65
68
 
66
69
  desc "list", "list all instructions"
67
70
  def instructions
68
- sync
69
-
70
- if project?
71
- list_from "Project", PROJECT_CACHE << '/' do |name|
72
- say show_command_for name
73
- end
74
- puts ""
75
- list_from "Home", HOME_CACHE << '/' do |name|
76
- say show_command_for name
77
- end
78
71
 
79
- return
72
+ instructable do
80
73
 
81
- end
74
+ if project?
75
+ list_from "", PROJECT_CACHE << '/' do |name|
76
+ say show_command_for name
77
+ end
78
+ puts ""
79
+ return
80
+ end
82
81
 
83
- Dir.chdir(ENV['HOME']) do
84
- list_from "Home", HOME_CACHE << '/' do |name|
85
- say show_command_for name
82
+ if home?
83
+ list_from "", HOME_CACHE << '/' do |name|
84
+ say show_command_for name
85
+ end
86
+ puts ""
87
+ return
86
88
  end
87
89
  end
88
-
89
90
  end
90
91
 
91
92
  desc "info" , "display information"
92
93
  def info
93
- if has_name?
94
- say "connected to : #{get_name}"
95
- else
96
- say "connected to\ key: #{get_key}"
97
- end
98
- say "host: #{HOST}"
99
- if File.exist? STATE
100
- puts ""
101
- `cat #{STATE}`.split("\n").each do |line|
102
- say "#{line.chomp} ✔"
94
+ instructable do
95
+ if has_name?
96
+ say "connected to : #{get_name}"
97
+ else
98
+ say "connected to\ key: #{get_key}"
99
+ end
100
+ say "host: #{HOST}"
101
+ if File.exist? STATE
102
+ puts ""
103
+ `cat #{STATE}`.split("\n").each do |line|
104
+ say "#{line.chomp} ✔"
105
+ end
106
+ puts ""
103
107
  end
104
- puts ""
105
108
  end
109
+
106
110
  end
107
111
 
108
112
 
109
113
  desc "do", "do an instruction"
110
114
  option :force
111
115
  def do name
112
- sync
113
- if name.nil?
114
- say "oops ! you need a name"
115
- return
116
- end
116
+ instructable do
117
+ sync
118
+ if name.nil?
119
+ say "oops ! you need a name"
120
+ return
121
+ end
117
122
 
118
- begin
119
- CHECKED.clear
120
- STACK.clear
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
125
-
126
- say ""
127
- say e.message
128
- say ""
129
- if e.message.include? "cant find"
130
- instructions
123
+ begin
124
+ CHECKED.clear
125
+ STACK.clear
126
+ load_from "Instructions", HOME_CACHE << "/" if home?
127
+ load_from "Projects", PROJECT_CACHE << "/" if project?
128
+ do_instruction name, STACK, options[:force]
129
+ rescue => e
130
+
131
+ say ""
132
+ say e.message
133
+ say ""
134
+ if e.message.include? "cant find"
135
+ instructions
136
+ end
137
+ say ""
131
138
  end
132
- say ""
133
139
  end
134
140
 
141
+
135
142
  end
136
143
 
137
144
  desc "undo", "undo an instruction"
138
145
  option :force
139
146
  def undo name
140
- sync
141
- if name.nil?
142
- say "oops ! you need a name"
143
- return
144
- end
145
147
 
146
- begin
147
- CHECKED.clear
148
- STACK.clear
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
153
-
154
- say ""
155
- say e.message
156
- say ""
157
- if e.message.include? "cant find"
158
- instructions
148
+ instructable do
149
+ sync
150
+ if name.nil?
151
+ say "oops ! you need a name"
152
+ return
153
+ end
154
+
155
+ begin
156
+ CHECKED.clear
157
+ STACK.clear
158
+ load_from "Instructions", HOME_CACHE << "/" if home?
159
+ load_from "Projects", PROJECT_CACHE << "/" if project?
160
+ undo_instruction name, STACK, options[:force]
161
+ rescue => e
162
+
163
+ say ""
164
+ say e.message
165
+ say ""
166
+ if e.message.include? "cant find"
167
+ instructions
168
+ end
169
+ say ""
159
170
  end
160
- say ""
161
171
  end
162
172
 
163
173
  end
@@ -167,6 +177,15 @@ module InstructionsList
167
177
 
168
178
  no_tasks do
169
179
 
180
+
181
+ def instructable
182
+ if project? || home?
183
+ yield
184
+ else
185
+ say "Oooops! #{Dir.pwd} is not instructable!"
186
+ end
187
+ end
188
+
170
189
  def get_key
171
190
  return "Not connected!" unless File.exists? KEY_PATH
172
191
  File.read(KEY_PATH).chomp
@@ -1,3 +1,3 @@
1
1
  module InstructionsList
2
- VERSION = "1.0.9.4.1.beta"
2
+ VERSION = "1.0.10.beta"
3
3
  end
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.9.4.1.beta
4
+ version: 1.0.10.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Coco Coder (aka Delaney Burke)