autowow 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,27 +1,27 @@
1
- module Autowow
2
- module Commands
3
- module Gem
4
- def release
5
- ["rake", "release"]
6
- end
7
-
8
- def clean
9
- ["gem", "clean"]
10
- end
11
-
12
- def rubocop_parallel
13
- ["rubocop", "--parallel"]
14
- end
15
-
16
- def rubocop_autocorrect(files)
17
- if files.kind_of?(Array)
18
- ["rubocop", "--auto-correct"] + files
19
- else
20
- ["rubocop", "--auto-correct"] + files.split(" ")
21
- end
22
- end
23
-
24
- include ReflectionUtils::CreateModuleFunctions
25
- end
26
- end
27
- end
1
+ module Autowow
2
+ module Commands
3
+ module Gem
4
+ def release
5
+ ["rake", "release"]
6
+ end
7
+
8
+ def clean
9
+ ["gem", "clean"]
10
+ end
11
+
12
+ def rubocop_parallel
13
+ ["rubocop", "--parallel"]
14
+ end
15
+
16
+ def rubocop_autocorrect(files)
17
+ if files.kind_of?(Array)
18
+ ["rubocop", "--auto-correct"] + files
19
+ else
20
+ ["rubocop", "--auto-correct"] + files.split(" ")
21
+ end
22
+ end
23
+
24
+ include ReflectionUtils::CreateModuleFunctions
25
+ end
26
+ end
27
+ end
@@ -1,11 +1,11 @@
1
- module Autowow
2
- module Commands
3
- module Os
4
- def which(cmd)
5
- ["which", cmd]
6
- end
7
-
8
- include ReflectionUtils::CreateModuleFunctions
9
- end
10
- end
11
- end
1
+ module Autowow
2
+ module Commands
3
+ module Os
4
+ def which(cmd)
5
+ ["which", cmd]
6
+ end
7
+
8
+ include ReflectionUtils::CreateModuleFunctions
9
+ end
10
+ end
11
+ end
@@ -1,19 +1,19 @@
1
- module Autowow
2
- module Commands
3
- module Rbenv
4
- def version
5
- ["rbenv", "local"]
6
- end
7
-
8
- def aliases
9
- ["rbenv", "alias"]
10
- end
11
-
12
- def installed_versions
13
- ["rbenv", "versions", "--bare", "--skip-aliases"]
14
- end
15
-
16
- include ReflectionUtils::CreateModuleFunctions
17
- end
18
- end
19
- end
1
+ module Autowow
2
+ module Commands
3
+ module Rbenv
4
+ def version
5
+ ["rbenv", "local"]
6
+ end
7
+
8
+ def aliases
9
+ ["rbenv", "alias"]
10
+ end
11
+
12
+ def installed_versions
13
+ ["rbenv", "versions", "--bare", "--skip-aliases"]
14
+ end
15
+
16
+ include ReflectionUtils::CreateModuleFunctions
17
+ end
18
+ end
19
+ end
@@ -1,87 +1,87 @@
1
- module Autowow
2
- module Commands
3
- module Vcs
4
- def cmd
5
- ["git"]
6
- end
7
-
8
- def terminal_options
9
- ["--no-pager"]
10
- end
11
-
12
- def changes_not_on_remote(branch)
13
- cmd + terminal_options + ["log", branch, "--not", "--remotes"]
14
- end
15
-
16
- def branch_list
17
- cmd + ["for-each-ref", "--format=%(refname)", "refs/heads/"]
18
- end
19
-
20
- def push(branch = nil, remote = nil)
21
- cmd + ["push"] + [branch, remote].compact
22
- end
23
-
24
- def rebase(branch)
25
- cmd + ["rebase", branch]
26
- end
27
-
28
- def git_status
29
- cmd + ["status"]
30
- end
31
-
32
- def stash
33
- cmd + ["stash"]
34
- end
35
-
36
- def stash_pop
37
- cmd + ["stash", "pop"]
38
- end
39
-
40
- def current_branch
41
- cmd + ["symbolic-ref", "--short", "HEAD"]
42
- end
43
-
44
- def checkout(existing_branch)
45
- cmd + ["checkout", existing_branch]
46
- end
47
-
48
- def pull
49
- cmd + ["pull"]
50
- end
51
-
52
- def branch_force_delete(branch)
53
- cmd + ["branch", "-D", branch]
54
- end
55
-
56
- def create(branch)
57
- cmd + ["checkout", "-b", branch]
58
- end
59
-
60
- def set_upstream(remote, branch)
61
- cmd + ["push", "--set-upstream", remote, branch]
62
- end
63
-
64
- def remotes
65
- cmd + ["remote", "-v"]
66
- end
67
-
68
- def fetch(remote)
69
- cmd + ["fetch", remote]
70
- end
71
-
72
- def merge(compare)
73
- cmd + ["merge", compare]
74
- end
75
-
76
- def branch
77
- cmd + ["branch"]
78
- end
79
-
80
- def add_remote(name, url)
81
- cmd + ["remote", "add", name, url]
82
- end
83
-
84
- include ReflectionUtils::CreateModuleFunctions
85
- end
86
- end
87
- end
1
+ module Autowow
2
+ module Commands
3
+ module Vcs
4
+ def cmd
5
+ ["git"]
6
+ end
7
+
8
+ def terminal_options
9
+ ["--no-pager"]
10
+ end
11
+
12
+ def changes_not_on_remote(branch)
13
+ cmd + terminal_options + ["log", branch, "--not", "--remotes"]
14
+ end
15
+
16
+ def branch_list
17
+ cmd + ["for-each-ref", "--format=%(refname)", "refs/heads/"]
18
+ end
19
+
20
+ def push(branch = nil, remote = nil)
21
+ cmd + ["push"] + [branch, remote].compact
22
+ end
23
+
24
+ def rebase(branch)
25
+ cmd + ["rebase", branch]
26
+ end
27
+
28
+ def git_status
29
+ cmd + ["status"]
30
+ end
31
+
32
+ def stash
33
+ cmd + ["stash"]
34
+ end
35
+
36
+ def stash_pop
37
+ cmd + ["stash", "pop"]
38
+ end
39
+
40
+ def current_branch
41
+ cmd + ["symbolic-ref", "--short", "HEAD"]
42
+ end
43
+
44
+ def checkout(existing_branch)
45
+ cmd + ["checkout", existing_branch]
46
+ end
47
+
48
+ def pull
49
+ cmd + ["pull"]
50
+ end
51
+
52
+ def branch_force_delete(branch)
53
+ cmd + ["branch", "-D", branch]
54
+ end
55
+
56
+ def create(branch)
57
+ cmd + ["checkout", "-b", branch]
58
+ end
59
+
60
+ def set_upstream(remote, branch)
61
+ cmd + ["push", "--set-upstream", remote, branch]
62
+ end
63
+
64
+ def remotes
65
+ cmd + ["remote", "-v"]
66
+ end
67
+
68
+ def fetch(remote)
69
+ cmd + ["fetch", remote]
70
+ end
71
+
72
+ def merge(compare)
73
+ cmd + ["merge", compare]
74
+ end
75
+
76
+ def branch
77
+ cmd + ["branch"]
78
+ end
79
+
80
+ def add_remote(name, url)
81
+ cmd + ["remote", "add", name, url]
82
+ end
83
+
84
+ include ReflectionUtils::CreateModuleFunctions
85
+ end
86
+ end
87
+ end
@@ -1,11 +1,11 @@
1
- module StringDecorator
2
- class ::String
3
- def reverse_chomp(str)
4
- reverse.chomp(str.reverse).reverse
5
- end
6
-
7
- def clean_lines
8
- each_line.map(&:strip).reject(&:empty?)
9
- end
10
- end
11
- end
1
+ module StringDecorator
2
+ class ::String
3
+ def reverse_chomp(str)
4
+ reverse.chomp(str.reverse).reverse
5
+ end
6
+
7
+ def clean_lines
8
+ each_line.map(&:strip).reject(&:empty?)
9
+ end
10
+ end
11
+ end
@@ -1,56 +1,77 @@
1
- require "tty-command"
2
-
3
- module Autowow
4
- module Executor
5
- class Pretty < TTY::Command::Printers::Pretty
6
- def print_command_out_data(cmd, *args); end
7
- def print_command_err_data(cmd, *args); end
8
-
9
- def print_command_exit(cmd, status, runtime, *args)
10
- super
11
- write("")
12
- end
13
- end
14
-
15
- class PrettyWithOutput < TTY::Command::Printers::Pretty
16
- def print_command_exit(cmd, status, runtime, *args)
17
- super
18
- write("")
19
- end
20
- end
21
-
22
- class RunWrapper
23
- def initialize(tty_command, fail_silently: false)
24
- @tty_command = tty_command
25
- @fail_silently = fail_silently
26
- end
27
-
28
- def run(array)
29
- begin
30
- @tty_command.run(*array)
31
- rescue TTY::Command::ExitError => e
32
- raise e unless @fail_silently
33
- exit 1
34
- end
35
- end
36
-
37
- def run!(array)
38
- @tty_command.run!(*array)
39
- end
40
- end
41
-
42
- def pretty
43
- @pretty ||= RunWrapper.new(TTY::Command.new(pty: true, printer: Pretty))
44
- end
45
-
46
- def pretty_with_output
47
- @pretty_with_output ||= RunWrapper.new(TTY::Command.new(pty: true, printer: PrettyWithOutput), fail_silently: true)
48
- end
49
-
50
- def quiet
51
- @quiet ||= RunWrapper.new(TTY::Command.new(pty: true, printer: :null))
52
- end
53
-
54
- include ReflectionUtils::CreateModuleFunctions
55
- end
56
- end
1
+ require "tty-command"
2
+
3
+ module Autowow
4
+ module Executor
5
+ class Pretty < TTY::Command::Printers::Pretty
6
+ def print_command_out_data(cmd, *args); end
7
+ def print_command_err_data(cmd, *args); end
8
+
9
+ def print_command_exit(cmd, status, runtime, *args)
10
+ super
11
+ tty_version = Gem::Version.new(TTY::Command::VERSION)
12
+ if tty_version < Gem::Version.new("0.8.0")
13
+ write("")
14
+ else
15
+ write(TTY::Command::Cmd.new("dummy"), "")
16
+ end
17
+ end
18
+ end
19
+
20
+ class PrettyWithOutput < TTY::Command::Printers::Pretty
21
+ def print_command_exit(cmd, status, runtime, *args)
22
+ super
23
+ tty_version = Gem::Version.new(TTY::Command::VERSION)
24
+ if tty_version < Gem::Version.new("0.8.0")
25
+ write("")
26
+ else
27
+ write(TTY::Command::Cmd.new("dummy"), "")
28
+ end
29
+ end
30
+ end
31
+
32
+ class RunWrapper
33
+ def initialize(tty_command, fail_silently: false)
34
+ @tty_command = tty_command
35
+ @fail_silently = fail_silently
36
+ end
37
+
38
+ def run(array)
39
+ begin
40
+ @tty_command.run(*array)
41
+ rescue TTY::Command::ExitError => e
42
+ raise e unless @fail_silently
43
+ exit 1
44
+ end
45
+ end
46
+
47
+ def run!(array)
48
+ @tty_command.run!(*array)
49
+ end
50
+ end
51
+
52
+ def pretty
53
+ @pretty ||= RunWrapper.new(TTY::Command.new(tty_params.merge(printer: Pretty)))
54
+ end
55
+
56
+ def pretty_with_output
57
+ @pretty_with_output ||= RunWrapper.new(TTY::Command.new(tty_params.merge(printer: PrettyWithOutput)), fail_silently: true)
58
+ end
59
+
60
+ def quiet
61
+ @quiet ||= RunWrapper.new(TTY::Command.new(tty_params.merge(printer: :null)))
62
+ end
63
+
64
+ def tty_params
65
+ tty_version = Gem::Version.new(TTY::Command::VERSION)
66
+ if tty_version < Gem::Version.new("0.7.0")
67
+ {}
68
+ elsif tty_version < Gem::Version.new("0.8.0")
69
+ { pty: true }
70
+ else
71
+ { pty: true, verbose: false }
72
+ end
73
+ end
74
+
75
+ include ReflectionUtils::CreateModuleFunctions
76
+ end
77
+ end