jank 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/base.rb +1 -1
- data/lib/config.rb +0 -2
- data/lib/executor.rb +23 -25
- data/lib/go_command.rb +17 -18
- data/lib/gocode_command.rb +2 -1
- data/lib/godoc_command.rb +2 -1
- data/lib/gofmt_command.rb +2 -1
- data/lib/goimports_command.rb +3 -2
- data/lib/golint_command.rb +3 -3
- data/lib/jank_command.rb +3 -3
- data/lib/janker.rb +7 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37759091c326beb11e7deaa86dfa71e40f579e01
|
4
|
+
data.tar.gz: bd84b8681b031c2eb3f4a828c811dd0acd16159b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb5a6145b23e9f61b50d603df813f0e56f31d6c65ee410be7ed5d3c009fb301ac776b9891487b73f13da287d326be1215e1247a5dee90efb9fb8bad7049fccab
|
7
|
+
data.tar.gz: 62fedca00dd8892439d5fd672b1ee37cc5472703f82f204b200d1ec189df9f78a6dc26787d4b80bfd7c6a213925ce0d43de198d9710a17a8342eefaeb3278986
|
data/lib/base.rb
CHANGED
data/lib/config.rb
CHANGED
data/lib/executor.rb
CHANGED
@@ -6,35 +6,33 @@ module Jank
|
|
6
6
|
@config = c
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
def execute(cmd, args)
|
10
|
+
if @config.janked
|
11
|
+
Dir.chdir(@config.janked_gopath) do
|
12
|
+
janked_args = Array.new
|
13
|
+
args.each do |a|
|
14
|
+
if a.start_with? @config.janked_local_path
|
15
|
+
janked_args << a.sub(@config.janked_local_path, @config.janked_gopath)
|
16
|
+
else
|
17
|
+
janked_args << a
|
18
|
+
end
|
19
|
+
end
|
14
20
|
|
15
|
-
|
16
|
-
|
17
|
-
when /^\./
|
18
|
-
package_applied = true
|
19
|
-
new_args << a.gsub(/^\./, @config.package)
|
20
|
-
when /\//
|
21
|
-
package_applied = true
|
22
|
-
new_args << a
|
23
|
-
when /\.go$/
|
24
|
-
package_applied = true
|
25
|
-
new_args << a
|
26
|
-
else
|
27
|
-
new_args << a
|
21
|
+
Jank.debug_log("🚀 #{@config.janked_gopath}> #{cmd} #{janked_args.inspect}")
|
22
|
+
run(cmd, janked_args)
|
28
23
|
end
|
24
|
+
else
|
25
|
+
Jank.debug_log("🚀 #{cmd} #{args.inspect}")
|
26
|
+
run(cmd, args)
|
29
27
|
end
|
30
|
-
|
31
|
-
new_args << @config.package if !package_applied
|
32
|
-
new_args
|
33
28
|
end
|
34
29
|
|
35
|
-
def
|
36
|
-
|
37
|
-
|
30
|
+
def run(cmd, args)
|
31
|
+
IO.popen(@config.env, [cmd, *args]) do |pipe|
|
32
|
+
while line = pipe.gets
|
33
|
+
puts line
|
34
|
+
end
|
35
|
+
end
|
38
36
|
end
|
39
37
|
end
|
40
|
-
end
|
38
|
+
end
|
data/lib/go_command.rb
CHANGED
@@ -2,42 +2,42 @@ require_relative 'command'
|
|
2
2
|
|
3
3
|
module Jank
|
4
4
|
class GoCommand < Command
|
5
|
-
def
|
6
|
-
@janker.link
|
5
|
+
def go
|
7
6
|
@exec.go(@args)
|
8
7
|
end
|
9
8
|
|
10
|
-
def
|
9
|
+
def go_sync
|
11
10
|
@janker.link
|
12
|
-
@exec.go(
|
11
|
+
@exec.go(@args)
|
12
|
+
@janker.sync_results
|
13
13
|
end
|
14
14
|
|
15
15
|
def build_command
|
16
|
-
|
16
|
+
go_sync
|
17
17
|
end
|
18
18
|
|
19
19
|
def clean_command
|
20
|
-
|
20
|
+
go_sync
|
21
21
|
end
|
22
22
|
|
23
23
|
def env_command
|
24
|
-
|
24
|
+
go
|
25
25
|
end
|
26
26
|
|
27
27
|
def fix_command
|
28
|
-
|
28
|
+
go_sync
|
29
29
|
end
|
30
30
|
|
31
31
|
def fmt_command
|
32
|
-
|
32
|
+
go_sync
|
33
33
|
end
|
34
34
|
|
35
35
|
def help
|
36
|
-
|
36
|
+
go
|
37
37
|
end
|
38
38
|
|
39
39
|
def generate_command
|
40
|
-
|
40
|
+
go_sync
|
41
41
|
end
|
42
42
|
|
43
43
|
def get_command
|
@@ -45,20 +45,19 @@ module Jank
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def install_command
|
48
|
-
|
48
|
+
go_sync
|
49
49
|
end
|
50
50
|
|
51
51
|
def list_command
|
52
|
-
|
53
|
-
run_go_with_janked_package
|
52
|
+
go_sync
|
54
53
|
end
|
55
54
|
|
56
55
|
def run_command
|
57
|
-
|
56
|
+
go_sync
|
58
57
|
end
|
59
58
|
|
60
59
|
def test_command
|
61
|
-
|
60
|
+
go_sync
|
62
61
|
end
|
63
62
|
|
64
63
|
def tool_command
|
@@ -66,11 +65,11 @@ module Jank
|
|
66
65
|
end
|
67
66
|
|
68
67
|
def version_command
|
69
|
-
|
68
|
+
go
|
70
69
|
end
|
71
70
|
|
72
71
|
def vet_command
|
73
|
-
|
72
|
+
go_sync
|
74
73
|
end
|
75
74
|
end
|
76
75
|
end
|
data/lib/gocode_command.rb
CHANGED
@@ -7,7 +7,7 @@ module Jank
|
|
7
7
|
|
8
8
|
@gocode = ENV['JANK_GOCODE'] || `which gocode`.chomp
|
9
9
|
if @gocode.empty?
|
10
|
-
puts "gocode is not installed. See https://github.com/nsf/gocode"
|
10
|
+
STDERR.puts "gocode is not installed. See https://github.com/nsf/gocode"
|
11
11
|
exit(1)
|
12
12
|
end
|
13
13
|
end
|
@@ -15,6 +15,7 @@ module Jank
|
|
15
15
|
def dispatch
|
16
16
|
@janker.link
|
17
17
|
@exec.execute(@gocode, @args)
|
18
|
+
@janker.sync_results
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
data/lib/godoc_command.rb
CHANGED
@@ -7,7 +7,7 @@ module Jank
|
|
7
7
|
|
8
8
|
@godoc = ENV['JANK_GODOC'] || `which godoc`.chomp
|
9
9
|
if @godoc.empty?
|
10
|
-
puts "gocode is not installed. Run:\n go get code.google.com/p/go.tools/cmd/godoc"
|
10
|
+
STDERR.puts "gocode is not installed. Run:\n go get code.google.com/p/go.tools/cmd/godoc"
|
11
11
|
exit(1)
|
12
12
|
end
|
13
13
|
end
|
@@ -15,6 +15,7 @@ module Jank
|
|
15
15
|
def dispatch
|
16
16
|
@janker.link
|
17
17
|
@exec.execute(@godoc, @args)
|
18
|
+
@janker.sync_results
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
data/lib/gofmt_command.rb
CHANGED
@@ -7,7 +7,7 @@ module Jank
|
|
7
7
|
|
8
8
|
@gofmt = ENV['JANK_GOFMT'] || `which gofmt`.chomp
|
9
9
|
if @gofmt.empty?
|
10
|
-
puts "gofmt is not installed. See: https://golang.org/cmd/gofmt/"
|
10
|
+
STDERR.puts "gofmt is not installed. See: https://golang.org/cmd/gofmt/"
|
11
11
|
exit(1)
|
12
12
|
end
|
13
13
|
end
|
@@ -15,6 +15,7 @@ module Jank
|
|
15
15
|
def dispatch
|
16
16
|
@janker.link
|
17
17
|
@exec.execute(@gofmt, @args)
|
18
|
+
@janker.sync_results
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
data/lib/goimports_command.rb
CHANGED
@@ -7,7 +7,7 @@ module Jank
|
|
7
7
|
|
8
8
|
@goimports = ENV['JANK_GOIMPORTS'] || `which goimports`.chomp
|
9
9
|
if @goimports.empty?
|
10
|
-
puts "goimports is not installed. See http://godoc.org/golang.org/x/tools/cmd/goimports"
|
10
|
+
STDERR.puts "goimports is not installed. See http://godoc.org/golang.org/x/tools/cmd/goimports"
|
11
11
|
exit(1)
|
12
12
|
end
|
13
13
|
end
|
@@ -15,6 +15,7 @@ module Jank
|
|
15
15
|
def dispatch
|
16
16
|
@janker.link
|
17
17
|
@exec.execute(@goimports, @args)
|
18
|
+
@janker.sync_results
|
18
19
|
end
|
19
20
|
end
|
20
|
-
end
|
21
|
+
end
|
data/lib/golint_command.rb
CHANGED
@@ -7,15 +7,15 @@ module Jank
|
|
7
7
|
|
8
8
|
@golint = ENV['JANK_GOLINT'] || `which golint`.chomp
|
9
9
|
if @golint.empty?
|
10
|
-
puts "golint is not installed. See https://github.com/golang/lint"
|
10
|
+
STDERR.puts "golint is not installed. See https://github.com/golang/lint"
|
11
11
|
exit(1)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
def dispatch
|
16
|
-
@args = @exec.apply_package(@args)
|
17
16
|
@janker.link
|
18
17
|
@exec.execute(@golint, @args)
|
18
|
+
@janker.sync_results
|
19
19
|
end
|
20
20
|
end
|
21
|
-
end
|
21
|
+
end
|
data/lib/jank_command.rb
CHANGED
@@ -24,15 +24,14 @@ module Jank
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def package_command
|
27
|
-
@janker.sync_packages
|
28
|
-
|
29
27
|
if ARGV[1] == '-r' || ARGV[1] == '--reverse'
|
30
28
|
package = ARGV[2]
|
31
29
|
if package == nil
|
32
|
-
puts package_help_text
|
30
|
+
STDERR.puts puts package_help_text
|
33
31
|
exit(1)
|
34
32
|
end
|
35
33
|
|
34
|
+
@janker.sync_packages
|
36
35
|
puts @janker.location_of_package(package)
|
37
36
|
exit
|
38
37
|
end
|
@@ -43,6 +42,7 @@ module Jank
|
|
43
42
|
exit
|
44
43
|
end
|
45
44
|
|
45
|
+
@janker.sync_packages
|
46
46
|
puts @janker.package_for_location path
|
47
47
|
end
|
48
48
|
|
data/lib/janker.rb
CHANGED
@@ -113,13 +113,19 @@ module Jank
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
+
def sync_results()
|
117
|
+
return if !@config.janked
|
118
|
+
rsync(@config.janked_gopath, @config.janked_local_path)
|
119
|
+
end
|
120
|
+
|
116
121
|
def rsync(src, dest)
|
117
122
|
return if src == dest
|
118
123
|
|
119
|
-
exclude = %w{JANKED .bzr .bzringore .hg .hgignore .git .gitignore .nfs}
|
124
|
+
exclude = %w{.jank JANKED .bzr .bzringore .hg .hgignore .git .gitignore .nfs}
|
120
125
|
opts = "--delete"
|
121
126
|
exclude.each {|e| opts += " --exclude #{e}"}
|
122
127
|
|
128
|
+
Jank.debug_log("🚀 rsync -az #{opts} \"#{src}/\" \"#{dest}\"")
|
123
129
|
`rsync -az #{opts} "#{src}/" "#{dest}"`
|
124
130
|
end
|
125
131
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jank
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred McCann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Jank is a suite of scripts that wrap the go command and a collection
|
14
14
|
of utility commands for go programming. Jank will rewrite the gopath dynamically
|