ruby_make_script 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruby_make_script.rb +1 -0
- data/lib/ruby_make_script/package.rb +28 -0
- data/lib/ruby_make_script/utils.rb +22 -10
- data/lib/ruby_make_script/version.rb +1 -1
- data/make.md +19 -1
- data/test.rb +4 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 200ba58b3736310403ce67c88d2d802498c34fa560432760cfd7525e9c4ad44d
|
4
|
+
data.tar.gz: 3f4843b9dbc4c10d98f11358f4219abbef5780acc223e91439a1bc33caa61237
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a75146d567c82c901802a52d5b5de733db593f00907ffde817d1f14dc93a763513119c597555cdff3dd68a127c4a7fdedb60fc34f38d2ffc3b747a69015a2e71
|
7
|
+
data.tar.gz: f2f0948c8f5ac4a02d9292cb4ede85a476dd9bccfe93516a28b82a9a61db21e95078cd544386bf8fe9f75e4074d523a0fa60d26cd694859636d2aeff5e6580b2
|
data/lib/ruby_make_script.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
$system_to_pack = Hash[
|
3
|
+
"Ubuntu" => "apk",
|
4
|
+
"Darwin" => "brew"
|
5
|
+
]
|
6
|
+
$pack = Hash[]
|
7
|
+
|
8
|
+
$pack['apt'] = Hash[
|
9
|
+
"uninstall" => "remove"
|
10
|
+
]
|
11
|
+
|
12
|
+
$pack['brew'] = Hash[
|
13
|
+
"remove" => "uninstall"
|
14
|
+
]
|
15
|
+
|
16
|
+
def PACK(cmd, *args)
|
17
|
+
cmd = String(cmd)
|
18
|
+
$system_to_pack.each do |k,v|
|
19
|
+
if `uname -a`[k]
|
20
|
+
if $pack[v][cmd]
|
21
|
+
cmd = $pack[v][cmd]
|
22
|
+
end
|
23
|
+
r v, cmd, *args
|
24
|
+
break
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
@@ -22,8 +22,9 @@ def cp(*str)
|
|
22
22
|
r"cp #{str.join(' ')}"
|
23
23
|
end
|
24
24
|
|
25
|
-
def r(*str)
|
26
|
-
|
25
|
+
def r(cmd, *str)
|
26
|
+
cmd = String(cmd)
|
27
|
+
str = cmd + " " + str.join(" ")
|
27
28
|
puts Pastel.new.green("running> ") + str
|
28
29
|
if !system(str)
|
29
30
|
puts Pastel.new.red.bold("error> ") + "command error: " + str
|
@@ -63,8 +64,9 @@ def cp?(*str)
|
|
63
64
|
end
|
64
65
|
|
65
66
|
# no error
|
66
|
-
def r?(*str)
|
67
|
-
|
67
|
+
def r?(cmd, *str)
|
68
|
+
cmd = String(cmd)
|
69
|
+
str = cmd + " " + str.join(" ")
|
68
70
|
puts Pastel.new.green("running> ") + str
|
69
71
|
flag = system(str)
|
70
72
|
if !flag
|
@@ -121,21 +123,31 @@ class InEnv
|
|
121
123
|
end
|
122
124
|
|
123
125
|
def enter
|
124
|
-
@v0 = ENV[k]
|
125
|
-
ENV[k] = @v
|
126
|
+
@v0 = ENV[@k]
|
127
|
+
ENV[@k] = @v
|
126
128
|
end
|
127
129
|
|
128
130
|
def exit
|
129
|
-
ENV[k] = @v0
|
131
|
+
ENV[@k] = @v0
|
130
132
|
end
|
131
|
-
end
|
133
|
+
end
|
132
134
|
|
133
135
|
def envir(expr)
|
134
136
|
InEnv.new(expr)
|
135
137
|
end
|
136
138
|
|
137
|
-
def
|
139
|
+
def use(*operation)
|
138
140
|
operation.each{ |o| o.enter}
|
139
141
|
yield
|
140
142
|
operation.each{ |o| o.exit}
|
141
|
-
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def GIT(*args)
|
146
|
+
r "git", *args.map{|s| String(s)}
|
147
|
+
end
|
148
|
+
|
149
|
+
def DOCKER(*args)
|
150
|
+
r "docker", *args.map{|s| String(s)}
|
151
|
+
end
|
152
|
+
|
153
|
+
require 'ruby_make_script/package'
|
data/make.md
CHANGED
@@ -1 +1,19 @@
|
|
1
|
-
#
|
1
|
+
# make.rb Documentation
|
2
|
+
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
|
6
|
+
Please install ruby and some package first:
|
7
|
+
|
8
|
+
```sh
|
9
|
+
$ apt instal ruby
|
10
|
+
$ gem instal pastel ruby_make_script
|
11
|
+
```
|
12
|
+
|
13
|
+
then you can run these command below.
|
14
|
+
### `./make.rb setup <args...>`
|
15
|
+
|
16
|
+
setup the environment
|
17
|
+
|
18
|
+
* `<args...>` : command to run
|
19
|
+
|
data/test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_make_script
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dnailz
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- bin/setup
|
85
85
|
- lib/ruby_make_script.rb
|
86
86
|
- lib/ruby_make_script/doc.rb
|
87
|
+
- lib/ruby_make_script/package.rb
|
87
88
|
- lib/ruby_make_script/target.rb
|
88
89
|
- lib/ruby_make_script/utils.rb
|
89
90
|
- lib/ruby_make_script/version.rb
|