instructions_list 1.0.0.beta → 1.0.1.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/.byebug_history +10 -0
- data/.instructions/state +3 -0
- data/exe/il +38 -17
- data/lib/instructions_list/version.rb +1 -1
- data/lib/instructions_list.rb +31 -4
- data/tags +13 -6
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae3e46c693141fb1b3bdcd6ad5281ab1224ca0fc
|
4
|
+
data.tar.gz: 3166f131ae068f5c5865d22a04601ec2d2c1cd91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e867f5f55c09ebf54143b4a15622269f96c3eeb1c22587fe26db31ab775ec54a875e9d80047ab50c48720fa8d95d2ac2ce69034f3a2e314a32e3db6f4e85e32e
|
7
|
+
data.tar.gz: b604a687f3e181991fba87afaf91b412f9a6e7758e1fc626159978d05bc80ee1370a19df3bab8baf0aa737f60050fbacf9f20ee5efd8716dbadd1399bdb4c611
|
data/.byebug_history
CHANGED
data/.instructions/state
ADDED
data/exe/il
CHANGED
@@ -6,6 +6,7 @@ require_relative "../lib/instructions_list"
|
|
6
6
|
|
7
7
|
|
8
8
|
module InstructionsList
|
9
|
+
|
9
10
|
class Instructions < Thor
|
10
11
|
include Thor::Actions
|
11
12
|
|
@@ -42,19 +43,19 @@ module InstructionsList
|
|
42
43
|
desc "sync", "synchronize the instructions"
|
43
44
|
option :reset
|
44
45
|
def sync
|
45
|
-
|
46
46
|
`mkdir -p /tmp/il/cache`
|
47
|
+
Dir.chdir ENV['HOME'] do
|
48
|
+
if options[:reset]
|
49
|
+
`rm -rf #{CACHE}` if Dir.exists? CACHE
|
50
|
+
return
|
51
|
+
end
|
47
52
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
instructable do
|
54
|
-
begin
|
55
|
-
CacheBuilder.new.build
|
56
|
-
rescue SocketError
|
53
|
+
instructable do
|
54
|
+
begin
|
55
|
+
CacheBuilder.new(get_key).build
|
56
|
+
rescue SocketError
|
57
57
|
|
58
|
+
end
|
58
59
|
end
|
59
60
|
end
|
60
61
|
end
|
@@ -73,17 +74,22 @@ module InstructionsList
|
|
73
74
|
list_from "Home Directory","#{ENV['HOME']}/instructions/" do |path|
|
74
75
|
say show_command_for path
|
75
76
|
end
|
77
|
+
|
76
78
|
puts ""
|
79
|
+
|
80
|
+
return if `pwd`.chomp == ENV['HOME']
|
81
|
+
|
77
82
|
list_from "Current Project","./instructions/" do |path|
|
78
83
|
say show_command_for path
|
79
|
-
|
80
84
|
end
|
85
|
+
|
81
86
|
puts ""
|
82
87
|
end
|
83
88
|
|
84
89
|
desc "info" , "display information"
|
85
90
|
def info
|
86
91
|
say "connected to\ key: #{get_key}"
|
92
|
+
say "host: #{HOST}"
|
87
93
|
end
|
88
94
|
|
89
95
|
desc "connect KEY" , "connect to a list"
|
@@ -104,12 +110,14 @@ module InstructionsList
|
|
104
110
|
desc "do", "do an instruction"
|
105
111
|
option :force
|
106
112
|
def do name=:all
|
113
|
+
CHECKED.clear
|
114
|
+
STACK.clear
|
107
115
|
instructable do
|
108
116
|
load_from "Defaults","#{File.join(File.dirname(__FILE__), "../instructions/")}"
|
109
117
|
load_from "User","#{ENV['HOME']}/instructions/"
|
110
118
|
load_from "Project","./instructions/"
|
111
119
|
load_from "Cloud", CACHE << "/"
|
112
|
-
handle_instruction name,
|
120
|
+
handle_instruction name,STACK,options[:force]
|
113
121
|
end
|
114
122
|
end
|
115
123
|
|
@@ -118,15 +126,21 @@ module InstructionsList
|
|
118
126
|
no_tasks do
|
119
127
|
def get_key
|
120
128
|
return "Not connected!" unless File.exists? KEY_PATH
|
121
|
-
File.read(KEY_PATH)
|
129
|
+
File.read(KEY_PATH).chomp
|
122
130
|
end
|
123
131
|
def instructable
|
124
132
|
if Dir.exists? "./instructions"
|
125
133
|
if Dir.exists? "./.instructions"
|
126
|
-
if
|
134
|
+
if home?
|
135
|
+
if File.exists? "./.instructions/key"
|
136
|
+
yield
|
137
|
+
return
|
138
|
+
end
|
139
|
+
else
|
127
140
|
yield
|
128
|
-
return
|
141
|
+
return
|
129
142
|
end
|
143
|
+
|
130
144
|
end
|
131
145
|
end
|
132
146
|
|
@@ -134,6 +148,10 @@ module InstructionsList
|
|
134
148
|
|
135
149
|
end
|
136
150
|
|
151
|
+
def home?
|
152
|
+
`pwd`.chomp == ENV['HOME']
|
153
|
+
end
|
154
|
+
|
137
155
|
|
138
156
|
def show_command_for path
|
139
157
|
return " None" if path == " None"
|
@@ -161,11 +179,14 @@ module InstructionsList
|
|
161
179
|
end
|
162
180
|
end
|
163
181
|
|
164
|
-
def handle_instruction name,
|
182
|
+
def handle_instruction name,stack,force
|
165
183
|
instruction = InstructionsList::INSTRUCTIONS.find{ |i| i.name == name }
|
166
184
|
raise "Ooooops cant find #{instruction}" if instruction.nil?
|
167
185
|
instruction.depends_on.each do |dependancy|
|
168
|
-
|
186
|
+
unless stack.include? dependancy
|
187
|
+
stack << dependancy
|
188
|
+
handle_instruction(dependancy,stack,force)
|
189
|
+
end
|
169
190
|
end
|
170
191
|
execute instruction,force: force
|
171
192
|
end
|
data/lib/instructions_list.rb
CHANGED
@@ -5,7 +5,10 @@ require_relative "instructions_list/version"
|
|
5
5
|
|
6
6
|
module InstructionsList
|
7
7
|
INSTRUCTIONS=[]
|
8
|
+
STACK=[]
|
9
|
+
CHECKED=[]
|
8
10
|
CACHE = "/tmp/il/cache"
|
11
|
+
CACHE_ARTIFACTS="#{CACHE}/artifacts"
|
9
12
|
KEY_PATH="./.instructions/key"
|
10
13
|
HOST= ENV.fetch('INSTRUCTIONS_LIST_HOST',"instructionslist.com")
|
11
14
|
class It
|
@@ -41,7 +44,7 @@ module InstructionsList
|
|
41
44
|
block.call
|
42
45
|
end
|
43
46
|
|
44
|
-
|
47
|
+
def depends_on name
|
45
48
|
@instruction.depends_on << name
|
46
49
|
end
|
47
50
|
|
@@ -76,7 +79,8 @@ module InstructionsList
|
|
76
79
|
end
|
77
80
|
|
78
81
|
def check name
|
79
|
-
system "echo #{name} ✔︎"
|
82
|
+
system "echo #{name} ✔︎" unless CHECKED.include? name
|
83
|
+
CHECKED << name
|
80
84
|
end
|
81
85
|
end
|
82
86
|
|
@@ -92,8 +96,20 @@ module InstructionsList
|
|
92
96
|
end
|
93
97
|
end
|
94
98
|
|
99
|
+
class CacheArtifactItem
|
100
|
+
def initialize(file_name)
|
101
|
+
@file_name = file_name
|
102
|
+
end
|
103
|
+
def write content,directory
|
104
|
+
`mkdir -p #{CACHE_ARTIFACTS}/#{directory}`
|
105
|
+
File.open("#{CACHE_ARTIFACTS}/#{directory}/#{@file_name}","w") do |file|
|
106
|
+
file.puts content
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
95
111
|
class CacheBuilder
|
96
|
-
def initialize(key
|
112
|
+
def initialize(key,host=HOST)
|
97
113
|
@key = key
|
98
114
|
@host = host
|
99
115
|
end
|
@@ -102,10 +118,21 @@ module InstructionsList
|
|
102
118
|
content = JSON.parse open("http://#{@host}/lists/#{@key}.json").read
|
103
119
|
`mkdir -p #{CACHE}`
|
104
120
|
content["instructions"].each do |instruction|
|
121
|
+
|
105
122
|
CacheItem
|
106
123
|
.new(instruction["file_name"])
|
107
124
|
.write(instruction["file_contents"])
|
108
|
-
|
125
|
+
|
126
|
+
instruction["artifacts"].each do |artifact|
|
127
|
+
|
128
|
+
CacheArtifactItem
|
129
|
+
.new(artifact["file_name"])
|
130
|
+
.write(artifact["contents"],content["key"])
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
135
|
+
|
109
136
|
rescue SocketError,JSON::ParserError
|
110
137
|
puts "cant find #{@host}"
|
111
138
|
end
|
data/tags
CHANGED
@@ -4,25 +4,32 @@
|
|
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
|
+
CacheBuilder lib/instructions_list.rb /^ class CacheBuilder$/;" c
|
8
|
+
CacheItem lib/instructions_list.rb /^ class CacheItem$/;" c class:InstructionsList
|
7
9
|
DSL lib/instructions_list.rb /^ module DSL$/;" m class:InstructionsList
|
8
10
|
Instruction lib/instructions_list.rb /^ class Instruction$/;" c class:InstructionsList
|
9
11
|
InstructionsList lib/instructions_list.rb /^module InstructionsList$/;" m
|
10
12
|
InstructionsList lib/instructions_list/version.rb /^module InstructionsList$/;" m
|
11
13
|
InstructionsList lib/package_manager.rb /^module InstructionsList do$/;" m
|
12
|
-
|
14
|
+
Is lib/instructions_list.rb /^ class Is$/;" c class:InstructionsList.It
|
15
|
+
It lib/instructions_list.rb /^ class It$/;" c class:InstructionsList
|
13
16
|
PackageManager lib/package_manager.rb /^ class PackageManager$/;" c class:InstructionsList
|
14
17
|
aptget lib/package_manager.rb /^ def self.aptget?$/;" F class:InstructionsList.PackageManager
|
15
18
|
brew lib/package_manager.rb /^ def self.brew?$/;" F class:InstructionsList.PackageManager
|
19
|
+
build lib/instructions_list.rb /^ def build$/;" f class:CacheBuilder
|
16
20
|
check lib/instructions_list.rb /^ def check name$/;" f class:InstructionsList.DSL
|
17
21
|
depends_on lib/instructions_list.rb /^ def depends_on name$/;" f class:InstructionsList.DSL
|
22
|
+
done lib/instructions_list.rb /^ def self.done? name$/;" F class:InstructionsList.It.Is
|
18
23
|
done lib/instructions_list.rb /^ def done(name)$/;" f class:InstructionsList.DSL
|
19
|
-
|
20
|
-
exists lib/instructions_list.rb /^ def self.exists? context,path$/;" F class:InstructionsList.ItIs
|
24
|
+
exists lib/instructions_list.rb /^ def self.exists? path$/;" F class:InstructionsList.It
|
21
25
|
initialize lib/instructions_list.rb /^ def initialize$/;" f class:InstructionsList.Instruction
|
22
|
-
|
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
|
28
|
+
installed lib/instructions_list.rb /^ def self.installed? path$/;" F class:InstructionsList.It.Is
|
23
29
|
instruct lib/instructions_list.rb /^ def instruct &block$/;" f class:InstructionsList.DSL
|
24
30
|
instructed? lib/instructions_list.rb /^ def instructed? &block$/;" f class:InstructionsList.DSL
|
25
31
|
instruction lib/instructions_list.rb /^ def instruction name,&block$/;" f class:InstructionsList.DSL
|
26
32
|
on lib/instructions_list.rb /^ def on os$/;" f class:InstructionsList.DSL
|
27
|
-
running lib/instructions_list.rb /^
|
28
|
-
|
33
|
+
running lib/instructions_list.rb /^ def self.running? name$/;" F class:InstructionsList.It.Is
|
34
|
+
write lib/instructions_list.rb /^ def write content$/;" f class:InstructionsList.CacheItem
|
35
|
+
yum lib/package_manager.rb /^ def self.yum?$/;" F class:InstructionsList.PackageManager
|
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.
|
4
|
+
version: 1.0.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-10-
|
11
|
+
date: 2017-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- ".byebug_history"
|
121
121
|
- ".gitignore"
|
122
122
|
- ".instructions/key"
|
123
|
+
- ".instructions/state"
|
123
124
|
- CODE_OF_CONDUCT.md
|
124
125
|
- Gemfile
|
125
126
|
- LICENSE.txt
|