heroshell 1.0.1 → 1.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 +4 -4
- data/bin/heroshell +32 -1
- data/lib/heroshell.rb +7 -11
- data/lib/heroshell/heroku_command_cache.rb +5 -5
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c1b80260f98e0f4f592678cd13f17da74165995
|
4
|
+
data.tar.gz: 31cc9fafdaff1e6e4f04b783356012a22bc6f23d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4249dbf5eda5634260f693bda159edcbfa934f579e94fe6576d418a2a7ace7385f7e7ca77255b445ac014c53e36d02921864c1a529049d444f2019ee3b96cfb7
|
7
|
+
data.tar.gz: 5380e3c080fe0c691d1e768268eb216ca6e0efaf327fcca47bdb5725dac46c3f645de784e04b535ff5cc12b4bc552906bfeedc6bb5595ef27313bc807d51b00c
|
data/bin/heroshell
CHANGED
@@ -1,4 +1,35 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'heroshell'
|
4
|
-
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
def get_app_from_heroku_remote()
|
7
|
+
url = `git remote get-url heroku`
|
8
|
+
if url
|
9
|
+
return url.split('/').last.sub(/\.git$/, '').chop
|
10
|
+
else
|
11
|
+
$stderr.puts "No app given in command line and no usable heroku git remote"
|
12
|
+
exit 1
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
options = {
|
17
|
+
:sync => false
|
18
|
+
}
|
19
|
+
parser = OptionParser.new do |parser|
|
20
|
+
parser.banner = 'Usage: heroshell [options] <herokuApp>'
|
21
|
+
parser.on('-s', '--sync', 'Force sync of available commands') do ||
|
22
|
+
options[:sync] = true
|
23
|
+
end
|
24
|
+
parser.on('-h', '--help', 'Show help') do ||
|
25
|
+
puts parser
|
26
|
+
exit 0
|
27
|
+
end
|
28
|
+
end
|
29
|
+
args = parser.parse!
|
30
|
+
unless args.length > 0
|
31
|
+
app = get_app_from_heroku_remote
|
32
|
+
else
|
33
|
+
app = args[0]
|
34
|
+
end
|
35
|
+
HeroShell.new(app, options[:sync]).run
|
data/lib/heroshell.rb
CHANGED
@@ -1,20 +1,16 @@
|
|
1
1
|
require "readline"
|
2
2
|
require "rainbow"
|
3
3
|
|
4
|
-
|
5
4
|
class HeroShell
|
6
|
-
def initialize(herokuApp)
|
7
|
-
|
8
|
-
puts "heroshell <herokuApp>"
|
9
|
-
exit 1
|
10
|
-
end
|
5
|
+
def initialize(herokuApp, forceCommandsSync)
|
6
|
+
@forceCommandSync = forceCommandsSync
|
11
7
|
@app = herokuApp
|
12
|
-
|
13
8
|
end
|
14
9
|
|
15
10
|
def init_completion()
|
16
|
-
autocompleted_commands = HerokuCommandsCache.get_commands()
|
11
|
+
autocompleted_commands = HerokuCommandsCache.get_commands(@forceCommandSync)
|
17
12
|
Readline.completion_append_character = " "
|
13
|
+
Readline.completer_word_break_characters = ""
|
18
14
|
Readline.completion_proc = proc { |s|
|
19
15
|
autocompleted_commands.grep(/^#{Regexp.escape(s)}/)
|
20
16
|
}
|
@@ -25,7 +21,7 @@ class HeroShell
|
|
25
21
|
while buf = Readline.readline("(#{Rainbow(@app).red})> ", false)
|
26
22
|
buf = buf.strip()
|
27
23
|
if buf.empty?
|
28
|
-
next
|
24
|
+
next
|
29
25
|
end
|
30
26
|
if buf.start_with?("switch ")
|
31
27
|
switchTo = buf.split(" ")[1]
|
@@ -36,8 +32,8 @@ class HeroShell
|
|
36
32
|
$stderr.puts "use: \"switch <herokuApp>\" to switch to other app"
|
37
33
|
end
|
38
34
|
else
|
39
|
-
command =
|
40
|
-
res = system(command)
|
35
|
+
command, arguments = buf.split(/\s+/, 2)
|
36
|
+
res = system("heroku #{command} -a #{@app} #{arguments}")
|
41
37
|
if res
|
42
38
|
Readline::HISTORY.push(buf)
|
43
39
|
else
|
@@ -26,18 +26,18 @@ class HeroShell::HerokuCommandsCache
|
|
26
26
|
}
|
27
27
|
end
|
28
28
|
|
29
|
-
def self.get_commands()
|
29
|
+
def self.get_commands(forceSync)
|
30
30
|
def self.read_topics_file()
|
31
31
|
IO.read(@@TOPICS_FILE).split("\n")
|
32
32
|
end
|
33
33
|
|
34
|
-
if File.exist? @@TOPICS_FILE
|
35
|
-
|
36
|
-
else
|
37
|
-
puts "No commands file found - syncing.."
|
34
|
+
if !File.exist? @@TOPICS_FILE || forceSync
|
35
|
+
puts "No commands file found, or sync forced - syncing..."
|
38
36
|
sync()
|
39
37
|
puts "Syncing done."
|
40
38
|
read_topics_file()
|
39
|
+
else
|
40
|
+
read_topics_file()
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroshell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakub Janczak (@kubek2k)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|
@@ -31,9 +31,9 @@ executables:
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
-
- bin/heroshell
|
35
34
|
- lib/heroshell.rb
|
36
35
|
- lib/heroshell/heroku_command_cache.rb
|
36
|
+
- bin/heroshell
|
37
37
|
homepage: http://rubygems.org/gems/heroshell
|
38
38
|
licenses:
|
39
39
|
- MIT
|
@@ -44,17 +44,17 @@ require_paths:
|
|
44
44
|
- lib
|
45
45
|
required_ruby_version: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- -
|
47
|
+
- - '>='
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '0'
|
50
50
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
requirements: []
|
56
56
|
rubyforge_project:
|
57
|
-
rubygems_version: 2.
|
57
|
+
rubygems_version: 2.0.14.1
|
58
58
|
signing_key:
|
59
59
|
specification_version: 4
|
60
60
|
summary: Heroku command shell
|