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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39795ddc3d0820433555bb57ffd41639be77a702ee4e3ff72cac6dd243fa9bb8
4
- data.tar.gz: 629a6e4804bd3112e66660e3b921965d16456d94478da616453824de2ccd53ee
3
+ metadata.gz: 200ba58b3736310403ce67c88d2d802498c34fa560432760cfd7525e9c4ad44d
4
+ data.tar.gz: 3f4843b9dbc4c10d98f11358f4219abbef5780acc223e91439a1bc33caa61237
5
5
  SHA512:
6
- metadata.gz: d6dec45593827ae2055b5cef614fcb2ca905d61bc3b85c02524cff4cdaeb2b8397e255d4550aa9079557af32d0baed3082ac858d81608c885a1226d99130e648
7
- data.tar.gz: 784d568d21a7ac1a3120ca7b125079a9bc2fc42a030e19e668cd99e18332b66739550561be954ce4f61be025b7076526f091c66a866d66d0213c9e3b11d2b273
6
+ metadata.gz: a75146d567c82c901802a52d5b5de733db593f00907ffde817d1f14dc93a763513119c597555cdff3dd68a127c4a7fdedb60fc34f38d2ffc3b747a69015a2e71
7
+ data.tar.gz: f2f0948c8f5ac4a02d9292cb4ede85a476dd9bccfe93516a28b82a9a61db21e95078cd544386bf8fe9f75e4074d523a0fa60d26cd694859636d2aeff5e6580b2
@@ -168,6 +168,7 @@ def make
168
168
  if ARGV.length == 0
169
169
  $targetlist[0].resolve_all
170
170
  else
171
+ p ARGV[0]
171
172
  resolve(ARGV[0], true)
172
173
  end
173
174
 
@@ -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
- str = str.join(" ")
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
- str = str.join(" ")
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 using(*operation)
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'
@@ -1,3 +1,3 @@
1
1
  module RubyMakeScript
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
data/make.md CHANGED
@@ -1 +1,19 @@
1
- # `make.rb` Usage### `make.rb setup <args...>`
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
@@ -4,7 +4,10 @@ make do
4
4
  descr! "setup the environment"
5
5
  arg! "<args...>", "command to run"
6
6
  :setup.from do
7
- r "echo", "Hello", "World"
7
+ use envir("RUST_LOG=trace"), dir('test') do
8
+ r "env"
9
+ r "pwd"
10
+ end
8
11
  end
9
12
  end
10
13
 
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.6
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