jank 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5c7b5f0d00fc555316cdbd2b1b036eb5b2cd56d7
4
+ data.tar.gz: 58b6eccf657e1f623a5eb6e7e2d4d4c955d30dca
5
+ SHA512:
6
+ metadata.gz: 95aaed1454cd31109c374c9a758cd0f36c69e632f45208399f341d72741bd652af145b185a365fffc78514176a851bb53a85918027dd5381e8c48ebadfa66f8d
7
+ data.tar.gz: 336bfb20761a261a73484d01b0f6fe180ee6d61796cb4c64e0c197b7affe4b91a90ddab7f4fb206d818afe9fa1f80708c867e213bb76ee31b5b88f9e822e4e28
data/bin/jank ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/base'
4
+ require_relative '../lib/jank_command'
5
+
6
+ module Jank
7
+ def self.main
8
+ config = Config.new
9
+ JankCommand.new(ARGV, config, Janker.new(config), Executor.new(config)).dispatch
10
+ end
11
+ end
12
+
13
+ Jank.main
data/bin/jgo ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/base'
4
+ require_relative '../lib/go'
5
+ require_relative '../lib/go_command'
6
+
7
+ module Jank
8
+ def self.main
9
+ config = Config.new
10
+ GoCommand.new(ARGV, config, Janker.new(config), Go.new(config)).dispatch
11
+ end
12
+ end
13
+
14
+ Jank.main
data/bin/jgocode ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/base'
4
+ require_relative '../lib/gocode_command'
5
+
6
+ module Jank
7
+ def self.main
8
+ config = Config.new
9
+ GocodeCommand.new(ARGV, config, Janker.new(config), Executor.new(config)).dispatch
10
+ end
11
+ end
12
+
13
+ Jank.main
data/bin/jgodoc ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/base'
4
+ require_relative '../lib/godoc_command'
5
+
6
+ module Jank
7
+ def self.main
8
+ config = Config.new
9
+ GodocCommand.new(ARGV, config, Janker.new(config), Executor.new(config)).dispatch
10
+ end
11
+ end
12
+
13
+ Jank.main
data/bin/jgofmt ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/base'
4
+ require_relative '../lib/gofmt_command'
5
+
6
+ module Jank
7
+ def self.main
8
+ config = Config.new
9
+ GofmtCommand.new(ARGV, config, Janker.new(config), Executor.new(config)).dispatch
10
+ end
11
+ end
12
+
13
+ Jank.main
data/bin/jgoimports ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/base'
4
+ require_relative '../lib/goimports_command'
5
+
6
+ module Jank
7
+ def self.main
8
+ config = Config.new
9
+ GoimportsCommand.new(ARGV, config, Janker.new(config), Executor.new(config)).dispatch
10
+ end
11
+ end
12
+
13
+ Jank.main
data/bin/jgolint ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/base'
4
+ require_relative '../lib/golint_command'
5
+
6
+ module Jank
7
+ def self.main
8
+ config = Config.new
9
+ GolintCommand.new(ARGV, config, Janker.new(config), Executor.new(config)).dispatch
10
+ end
11
+ end
12
+
13
+ Jank.main
data/lib/base.rb ADDED
@@ -0,0 +1,6 @@
1
+ require_relative '../lib/config'
2
+ require_relative '../lib/debug'
3
+ require_relative '../lib/executor'
4
+ require_relative '../lib/janker'
5
+
6
+ Jank.debug_log("#{$0} #{ARGV.inspect}")
data/lib/command.rb ADDED
@@ -0,0 +1,19 @@
1
+ module Jank
2
+ class Command
3
+ def initialize(args, config, janker, executor)
4
+ @config = config
5
+ @janker = janker
6
+ @exec = executor
7
+ @args = args
8
+ end
9
+
10
+ def dispatch
11
+ command = "#{@args[0]}_command"
12
+ if !self.respond_to? command
13
+ command = 'help'
14
+ end
15
+
16
+ self.send(command)
17
+ end
18
+ end
19
+ end
data/lib/config.rb ADDED
@@ -0,0 +1,135 @@
1
+ require 'yaml'
2
+
3
+ module Jank
4
+ class Config
5
+ attr_reader :go, :gopaths, :janked_gopaths, :pwd, :home, :package, :janked_packge, :janked, :rsync, :janked_local_path, :janked_gopath, :janked, :local_gopath, :env
6
+
7
+ def initialize
8
+ # Ignore or include ENV gopath
9
+ @include_env_gopath = nil
10
+
11
+ # Path to go
12
+ @go = ENV['JANK_GO'] || `which go`.chomp
13
+
14
+ # Path to rsync
15
+ @rsync = ENV['JANK_RSYNC'] || `which rsync`.chomp
16
+
17
+ if @go.empty?
18
+ STDERR.write "go not found"
19
+ exit(1)
20
+ end
21
+
22
+ if @rsync.empty?
23
+ STDERR.write "rsync not found"
24
+ exit(1)
25
+ end
26
+
27
+ # Working directory
28
+ if ENV.has_key? 'TM_DIRECTORY'
29
+ @pwd = ENV['TM_DIRECTORY']
30
+ else
31
+ @pwd = Dir.pwd
32
+ end
33
+
34
+ # Home directory
35
+ @home = Dir.home
36
+
37
+ # Current Go package
38
+ @package = nil
39
+
40
+ # Janked Go package (might be higher in the filesystem than the current package)
41
+ @janked_package = nil
42
+
43
+ # Path to root of go package in gopath
44
+ @janked_gopath = nil
45
+
46
+ # Path to root of go package in local project
47
+ @janked_local_path = nil
48
+
49
+ # true if this package is to be janked into a gopath
50
+ @janked = false
51
+
52
+ # ENV supplied gopaths
53
+ @gopaths = ENV['GOPATH'] || ENV['JANK_GOPATH'] || ENV['TM_GOPATH']
54
+ if @gopaths == nil
55
+ @gopaths = Array.new
56
+ else
57
+ @gopaths = @gopaths.split(/:/).select {|p| p != ''}
58
+ end
59
+
60
+ # Array of janked_gopaths
61
+ @janked_gopaths = Array.new
62
+
63
+ # The gopath that contains the working directory, null if janked
64
+ @local_gopath = nil
65
+
66
+ read_config_files
67
+
68
+ @env = ENV
69
+
70
+ if @include_env_gopath == false
71
+ @env['GOPATH'] = @gopaths.uniq.join(':')
72
+ else
73
+ @env['GOPATH'] = (@janked_gopaths + @gopaths).uniq.join(':')
74
+ end
75
+
76
+ Jank.debug_log("GOPATH = #{@env['GOPATH']}")
77
+ end
78
+
79
+ private
80
+ def read_config_files
81
+ curdir = @pwd
82
+ parse_config(curdir)
83
+
84
+ until curdir == @home do
85
+ curdir = File.expand_path('..', curdir)
86
+ parse_config(curdir)
87
+ end
88
+ end
89
+
90
+ def parse_config(dir)
91
+ return if !File.exist?("#{dir}/.jank")
92
+ yaml = YAML.load_file("#{dir}/.jank")
93
+
94
+ if @include_env_gopath == nil && yaml.has_key?('env_gopath') && !yaml['env_gopath'].empty?
95
+ if yaml['env_gopath'] == 0 || yaml['env_gopath'] =~/false/i
96
+ @include_env_gopath = false
97
+ else
98
+ @include_env_gopath = true
99
+ end
100
+ end
101
+
102
+ if @local_gopath == nil && @janked_package == nil && yaml.has_key?('package') && !yaml['package'].empty?
103
+ @janked_package = yaml['package']
104
+ @janked = true
105
+
106
+ if @gopaths.length > 0
107
+ @janked_local_path = dir
108
+ @janked_gopath = "#{@gopaths.first}/src/#{@janked_package}"
109
+ @package = @pwd.gsub(/^#{@janked_local_path}/, @janked_package)
110
+ end
111
+ end
112
+
113
+ if yaml.has_key?('gopath')
114
+ if !yaml['gopath'].kind_of?(Array)
115
+ yaml['gopath'] = Array.new( yaml['gopath'] )
116
+ end
117
+
118
+ yaml['gopath'].each do |gp|
119
+ gp = abs_gopath(dir, gp)
120
+ @janked_gopaths << gp
121
+
122
+ if @local_gopath == nil && !@janked && @pwd.start_with?(gp)
123
+ @local_gopath = gp
124
+ @package = @pwd.slice((@local_gopath.length + 5)..(@pwd.length))
125
+ end
126
+ end
127
+ end
128
+ end
129
+
130
+ def abs_gopath(dir, gp)
131
+ return gp if gp =~ /^\//
132
+ File.realpath("#{dir}/#{gp}")
133
+ end
134
+ end
135
+ end
data/lib/debug.rb ADDED
@@ -0,0 +1,9 @@
1
+ module Jank
2
+ def Jank.debug_log(msg)
3
+ if ENV.has_key? 'JANK_DEBUG'
4
+ open("/tmp/jank.log", 'a') do |f|
5
+ f.puts msg
6
+ end
7
+ end
8
+ end
9
+ end
data/lib/executor.rb ADDED
@@ -0,0 +1,40 @@
1
+ require_relative 'debug'
2
+
3
+ module Jank
4
+ class Executor
5
+ def initialize(c)
6
+ @config = c
7
+ end
8
+
9
+ def apply_package(args)
10
+ return args if @config.package == nil
11
+
12
+ new_args = Array.new
13
+ package_applied = false
14
+
15
+ args.each do |a|
16
+ case a
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
28
+ end
29
+ end
30
+
31
+ new_args << @config.package if !package_applied
32
+ new_args
33
+ end
34
+
35
+ def execute(cmd, args)
36
+ Jank.debug_log("🚀 #{cmd} #{args.inspect}")
37
+ Kernel.exec(@config.env, cmd, *args)
38
+ end
39
+ end
40
+ end
data/lib/go.rb ADDED
@@ -0,0 +1,9 @@
1
+ require_relative 'executor'
2
+
3
+ module Jank
4
+ class Go < Executor
5
+ def go(args)
6
+ execute(@config.go, args)
7
+ end
8
+ end
9
+ end
data/lib/go_command.rb ADDED
@@ -0,0 +1,76 @@
1
+ require_relative 'command'
2
+
3
+ module Jank
4
+ class GoCommand < Command
5
+ def run_go
6
+ @janker.link
7
+ @exec.go(@args)
8
+ end
9
+
10
+ def run_go_with_janked_package
11
+ @janker.link
12
+ @exec.go( @exec.apply_package(@args) )
13
+ end
14
+
15
+ def build_command
16
+ run_go_with_janked_package
17
+ end
18
+
19
+ def clean_command
20
+ run_go_with_janked_package
21
+ end
22
+
23
+ def env_command
24
+ run_go
25
+ end
26
+
27
+ def fix_command
28
+ run_go_with_janked_package
29
+ end
30
+
31
+ def fmt_command
32
+ run_go_with_janked_package
33
+ end
34
+
35
+ def help
36
+ run_go
37
+ end
38
+
39
+ def generate_command
40
+ run_go_with_janked_package
41
+ end
42
+
43
+ def get_command
44
+ run_go
45
+ end
46
+
47
+ def install_command
48
+ run_go_with_janked_package
49
+ end
50
+
51
+ def list_command
52
+ @janker.link
53
+ run_go_with_janked_package
54
+ end
55
+
56
+ def run_command
57
+ run_go
58
+ end
59
+
60
+ def test_command
61
+ run_go_with_janked_package
62
+ end
63
+
64
+ def tool_command
65
+ run_go
66
+ end
67
+
68
+ def version_command
69
+ run_go
70
+ end
71
+
72
+ def vet_command
73
+ run_go_with_janked_package
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,20 @@
1
+ require_relative 'command'
2
+
3
+ module Jank
4
+ class GocodeCommand < Command
5
+ def initialize(args, config, janker, executor)
6
+ super(args, config, janker, executor)
7
+
8
+ @gocode = ENV['JANK_GOCODE'] || `which gocode`.chomp
9
+ if @gocode.empty?
10
+ puts "gocode is not installed. See https://github.com/nsf/gocode"
11
+ exit(1)
12
+ end
13
+ end
14
+
15
+ def dispatch
16
+ @janker.link
17
+ @exec.execute(@gocode, @args)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require_relative 'command'
2
+
3
+ module Jank
4
+ class GodocCommand < Command
5
+ def initialize(args, config, janker, executor)
6
+ super(args, config, janker, executor)
7
+
8
+ @godoc = ENV['JANK_GODOC'] || `which godoc`.chomp
9
+ if @godoc.empty?
10
+ puts "gocode is not installed. Run:\n go get code.google.com/p/go.tools/cmd/godoc"
11
+ exit(1)
12
+ end
13
+ end
14
+
15
+ def dispatch
16
+ @janker.link
17
+ @exec.execute(@godoc, @args)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require_relative 'command'
2
+
3
+ module Jank
4
+ class GofmtCommand < Command
5
+ def initialize(args, config, janker, executor)
6
+ super(args, config, janker, executor)
7
+
8
+ @gofmt = ENV['JANK_GOFMT'] || `which gofmt`.chomp
9
+ if @gofmt.empty?
10
+ puts "gofmt is not installed. See: https://golang.org/cmd/gofmt/"
11
+ exit(1)
12
+ end
13
+ end
14
+
15
+ def dispatch
16
+ @janker.link
17
+ @exec.execute(@gofmt, @args)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require_relative 'command'
2
+
3
+ module Jank
4
+ class GoimportsCommand < Command
5
+ def initialize(args, config, janker, executor)
6
+ super(args, config, janker, executor)
7
+
8
+ @goimports = ENV['JANK_GOIMPORTS'] || `which goimports`.chomp
9
+ if @goimports.empty?
10
+ puts "goimports is not installed. See http://godoc.org/golang.org/x/tools/cmd/goimports"
11
+ exit(1)
12
+ end
13
+ end
14
+
15
+ def dispatch
16
+ @janker.link
17
+ @exec.execute(@goimports, @args)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,21 @@
1
+ require_relative 'command'
2
+
3
+ module Jank
4
+ class GolintCommand < Command
5
+ def initialize(args, config, janker, executor)
6
+ super(args, config, janker, executor)
7
+
8
+ @golint = ENV['JANK_GOLINT'] || `which golint`.chomp
9
+ if @golint.empty?
10
+ puts "golint is not installed. See https://github.com/golang/lint"
11
+ exit(1)
12
+ end
13
+ end
14
+
15
+ def dispatch
16
+ @args = @exec.apply_package(@args)
17
+ @janker.link
18
+ @exec.execute(@golint, @args)
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,174 @@
1
+ require_relative 'command'
2
+
3
+ module Jank
4
+ class JankCommand < Command
5
+ def config_command
6
+ puts @config.to_yaml
7
+ end
8
+
9
+ def help
10
+ topic_help = "#{@args[1]}_help_text"
11
+ if self.respond_to? topic_help
12
+ puts self.send(topic_help)
13
+ else
14
+ puts jank_help_text
15
+ end
16
+ end
17
+
18
+ def gopath_command
19
+ puts @config.env['GOPATH']
20
+ end
21
+
22
+ def link_command
23
+ puts "Package #{@config.package || '[UNKNOWN]'} is not jankable" if !@janker.link
24
+ end
25
+
26
+ def package_command
27
+ @janker.sync_packages
28
+
29
+ if ARGV[1] == '-r' || ARGV[1] == '--reverse'
30
+ package = ARGV[2]
31
+ if package == nil
32
+ puts package_help_text
33
+ exit(1)
34
+ end
35
+
36
+ puts @janker.location_of_package(package)
37
+ exit
38
+ end
39
+
40
+ path = ARGV[1]
41
+ if path == nil
42
+ puts @config.package
43
+ exit
44
+ end
45
+
46
+ puts @janker.package_for_location path
47
+ end
48
+
49
+ def stat_command
50
+ @janker.sync_packages
51
+ @janker.walk_janked_packages do |package, local_path, go_path|
52
+ puts "#{package} --> #{local_path}"
53
+ end
54
+ end
55
+
56
+ def sync_command
57
+ @janker.sync_packages
58
+ end
59
+
60
+ def unlink_command
61
+ all = @args[1] == '-a' || @args[1] == '--all'
62
+
63
+ if all
64
+ @janker.unlink_all
65
+ else
66
+ puts "Package #{@config.package || '[UNKNOWN]'} is not jankable" if !@janker.unlink
67
+ end
68
+ end
69
+
70
+ def jank_help_text
71
+ <<-HELPTEXT
72
+ Jank - the janky Go build tool.
73
+
74
+ Usage:
75
+
76
+ jank command [arguments]
77
+
78
+ The commands are:
79
+
80
+ config show the jank configuration for the directory
81
+ gopath displays gopath for the directory
82
+ help show this!
83
+ link link a go-gettable source tree into the gopath
84
+ package displays the package for the current directory
85
+ stat lists packages linked into gopath
86
+ sync syncs packages linked into gopath
87
+ unlink unlink a go-gettable source tree from the gopath
88
+
89
+ Use "jank help [command]" for more information about a command.
90
+ HELPTEXT
91
+ end
92
+
93
+ def config_help_text
94
+ <<-HELPTEXT
95
+ usage: jank config
96
+
97
+ Displays the jank configuration for the current directory.
98
+ HELPTEXT
99
+ end
100
+
101
+ def gopath_help_text
102
+ <<-HELPTEXT
103
+ usage: jank path
104
+
105
+ Displays additional gopaths for this directory. Paths can
106
+ be added by placing .jank files in directories with the
107
+ key 'gopath'. The gopath key can map to a string or an array
108
+ of additional gopaths. Gopaths are scanned for in this manner
109
+ up the filesystem until the user's home directory.
110
+
111
+ Gopaths specified in the .jank file can be either absolute
112
+ paths or paths relative to the directory.
113
+ HELPTEXT
114
+ end
115
+
116
+ def link_help_text
117
+ <<-HELPTEXT
118
+ usage: jank link
119
+
120
+ For packages developed in a go-gettable stlye outside the
121
+ gopath, invoking link will link the package into the gopath.
122
+ This requires that the directory or some parent contains a
123
+ .jank file with the 'package' key set to go package name.
124
+ HELPTEXT
125
+ end
126
+
127
+ def package_help_text
128
+ <<-HELPTEXT
129
+ usage: jank package [flags] [path]
130
+
131
+ Flags:
132
+ -r, --reverse
133
+ Return directory for go package
134
+
135
+ Displays the package for the current directory or the path
136
+ if specified. Specifiying the reverse flag returns the
137
+ filesystem path of a go package.
138
+ HELPTEXT
139
+ end
140
+
141
+ def stat_help_text
142
+ <<-HELPTEXT
143
+ usage: jank stat
144
+
145
+ Displays a mapping of packages in the gopath that are linked
146
+ to go-gettable source trees that reside outside of the gopath.
147
+ HELPTEXT
148
+ end
149
+
150
+ def sync_help_text
151
+ <<-HELPTEXT
152
+ usage: jank sync
153
+
154
+ Syncs all packages linked into the gopath.
155
+ HELPTEXT
156
+ end
157
+
158
+ def unlink_help_text
159
+ <<-HELPTEXT
160
+ usage: jank unlink [flags]
161
+
162
+ Flags:
163
+ -a, --all
164
+ Unlink all linked packages
165
+
166
+ For packages developed in a go-gettable stlye outside the
167
+ gopath, invoking unlink will remove the package from the
168
+ gopath. This requires that the directory or some parent
169
+ contains a .jank file with the 'package' key set to go
170
+ package name.
171
+ HELPTEXT
172
+ end
173
+ end
174
+ end
data/lib/janker.rb ADDED
@@ -0,0 +1,126 @@
1
+ require 'fileutils'
2
+ require 'find'
3
+
4
+ module Jank
5
+ class Janker
6
+ def initialize(config)
7
+ @config = config
8
+ end
9
+
10
+ def link
11
+ return false if !@config.janked
12
+ mark_janked_package
13
+ sync_packages
14
+ true
15
+ end
16
+
17
+ def unlink
18
+ return false if !@config.janked
19
+ unmark_janked_package
20
+ sync_packages
21
+ true
22
+ end
23
+
24
+ def package_for_location(path)
25
+ Dir.chdir(File.realpath(path)) do
26
+ conf = Config.new
27
+ return conf.package
28
+ end
29
+ end
30
+
31
+ def location_of_package(pkg)
32
+ local_gp = nil
33
+ path = nil
34
+
35
+ # Find location in gopath
36
+ (@config.janked_gopaths + @config.gopaths).each do |gp|
37
+ path = "#{gp}/src/#{pkg}"
38
+ next if !File.exist?(path) || !File.directory?(path)
39
+ local_gp = gp
40
+ break
41
+ end
42
+
43
+ return "" if local_gp == nil
44
+
45
+ # Translate path if janked
46
+ root = "#{local_gp}/src"
47
+ dir = path
48
+ janked_path = nil
49
+ janked_location = nil
50
+
51
+ while dir != root
52
+ jankfile = "#{dir}/JANKED"
53
+ if File.exist?(jankfile)
54
+ janked_path = dir
55
+ janked_location = File.read(jankfile)
56
+ break
57
+ end
58
+
59
+ dir = File.realpath("#{dir}/..")
60
+ end
61
+
62
+ if janked_path != nil
63
+ return path.gsub(/^#{janked_path}/, janked_location)
64
+ end
65
+
66
+ return path
67
+ end
68
+
69
+ def walk_janked_packages
70
+ @config.gopaths.each do |gp|
71
+ Find.find("#{gp}/src") do |path|
72
+ next if !FileTest.directory?(path)
73
+ Find.prune if File.basename(path).start_with? '.'
74
+
75
+ janked_file = "#{path}/JANKED"
76
+ if File.exist?(janked_file)
77
+ package = path.slice(gp.length+5..path.length)
78
+ yield package, File.read(janked_file), path
79
+ Find.prune
80
+ end
81
+ end
82
+ end
83
+ end
84
+
85
+ def mark_janked_package
86
+ if @config.janked_local_path.start_with? @config.janked_gopath
87
+ raise "Trying to link a package already inside the gopath!"
88
+ end
89
+
90
+ FileUtils.mkdir_p(@config.janked_gopath)
91
+ File.open("#{@config.janked_gopath}/JANKED", 'w') {|f| f.write(@config.janked_local_path) }
92
+ end
93
+
94
+ def unmark_janked_package
95
+ if File.exist?(@config.janked_gopath)
96
+ FileUtils.rm_rf(@config.janked_gopath)
97
+ end
98
+ end
99
+
100
+ def sync_packages
101
+ walk_janked_packages do |package, local_path, go_path|
102
+ if File.exist?(local_path) && File.directory?(local_path) && ! File.symlink?(local_path)
103
+ rsync(local_path, go_path)
104
+ else
105
+ FileUtils.rm_rf(go_path)
106
+ end
107
+ end
108
+ end
109
+
110
+ def unlink_all
111
+ walk_janked_packages do |package, local_path, go_path|
112
+ FileUtils.rm_rf(go_path)
113
+ end
114
+ end
115
+
116
+ def rsync(src, dest)
117
+ return if src == dest
118
+
119
+ exclude = %w{JANKED .bzr .bzringore .hg .hgignore .git .gitignore .nfs}
120
+ opts = "--delete"
121
+ exclude.each {|e| opts += " --exclude #{e}"}
122
+
123
+ `rsync -az #{opts} "#{src}/" "#{dest}"`
124
+ end
125
+ end
126
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jank
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Fred McCann
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-17 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Jank is a suite of scripts that wrap the go command and a collection
14
+ of utility commands for go programming. Jank will rewrite the gopath dynamically
15
+ to support development of go-gettable and arbitrarily laid out projects outside
16
+ of a global gopath. These tools can be subsituted for the real versions to transparently
17
+ augment their behavior.
18
+ email:
19
+ - fred@sharpnoodles.com
20
+ executables:
21
+ - jank
22
+ - jgo
23
+ - jgocode
24
+ - jgodoc
25
+ - jgofmt
26
+ - jgoimports
27
+ - jgolint
28
+ extensions: []
29
+ extra_rdoc_files: []
30
+ files:
31
+ - bin/jank
32
+ - bin/jgo
33
+ - bin/jgocode
34
+ - bin/jgodoc
35
+ - bin/jgofmt
36
+ - bin/jgoimports
37
+ - bin/jgolint
38
+ - lib/base.rb
39
+ - lib/command.rb
40
+ - lib/config.rb
41
+ - lib/debug.rb
42
+ - lib/executor.rb
43
+ - lib/go.rb
44
+ - lib/go_command.rb
45
+ - lib/gocode_command.rb
46
+ - lib/godoc_command.rb
47
+ - lib/gofmt_command.rb
48
+ - lib/goimports_command.rb
49
+ - lib/golint_command.rb
50
+ - lib/jank_command.rb
51
+ - lib/janker.rb
52
+ homepage: http://gojank.com
53
+ licenses:
54
+ - BSD
55
+ metadata: {}
56
+ post_install_message:
57
+ rdoc_options: []
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ requirements: []
71
+ rubyforge_project:
72
+ rubygems_version: 2.4.7
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: jank - the janky Go build tool
76
+ test_files: []