newline_hw 1.0.2 → 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/Rakefile +2 -2
- data/exe/newline_hw_stream +6 -3
- data/lib/newline_hw/chrome_manifest.rb +2 -2
- data/lib/newline_hw/cli.rb +11 -3
- data/lib/newline_hw/gui_trigger.rb +5 -5
- data/lib/newline_hw/shell/function.rb +2 -11
- data/lib/newline_hw/shell/setup.rb +1 -1
- data/lib/newline_hw/stream_command_handler.rb +5 -3
- data/lib/newline_hw/version.rb +1 -1
- data/lib/newline_hw.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47e9a294c46a166978832a4c69eb2799929c3269
|
4
|
+
data.tar.gz: 0d8a73542cba16a4c3d87b82d3affa95d272eec0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 622cdabdaaea06f40f03461dbcca2842d4bb4f234b0e512ac4eed1a53943f4aceeea8bc9a7c69cadaff4c0956528dcee05ea41b49b0cb23d3119e9fbb6b8c9c8
|
7
|
+
data.tar.gz: cd7a505d02f64a3e17f5d111fc4ec53fa8d8d79286f2575644e3716d21dcd3c0a4b90569aeacc55c4db5eb0dca3b2570dffafdab48f32c1369e0b998a696c913
|
data/Rakefile
CHANGED
data/exe/newline_hw_stream
CHANGED
@@ -8,9 +8,12 @@ logger = Logger.new(File.new(File.expand_path(NewlineHw.config.log_file), "a+"))
|
|
8
8
|
|
9
9
|
begin
|
10
10
|
NewlineHw::StreamProcessor
|
11
|
-
.new($stdin, $stdout, logger: logger)
|
12
|
-
|
13
|
-
|
11
|
+
.new($stdin, $stdout, logger: logger)
|
12
|
+
.on_message do |msg|
|
13
|
+
Thread.new do
|
14
|
+
send_message(NewlineHw::StreamCommandHandler.new(msg).call)
|
15
|
+
end
|
16
|
+
end
|
14
17
|
rescue StandardError => e
|
15
18
|
logger.error e
|
16
19
|
exit 1
|
@@ -28,9 +28,9 @@ module NewlineHw
|
|
28
28
|
|
29
29
|
def write
|
30
30
|
create_native_messaging_manifest_directory
|
31
|
-
|
31
|
+
|
32
32
|
File.open(native_messaging_manifest_path, "w+") do |f|
|
33
|
-
f.write(JSON.pretty_generate(
|
33
|
+
f.write(JSON.pretty_generate(generate))
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
data/lib/newline_hw/cli.rb
CHANGED
@@ -12,21 +12,29 @@ module NewlineHw
|
|
12
12
|
end
|
13
13
|
|
14
14
|
desc "install newlinehw config file and chrome adapter",
|
15
|
-
|
15
|
+
"will setup a logging file and a chrome manifest to allow this app to be communicated to by the newline-assistant chrome extension."
|
16
16
|
def install
|
17
17
|
NewlineHw.make_log_directory
|
18
18
|
ChromeManifest.write
|
19
19
|
NewlineHw::Config.install_default
|
20
20
|
say "Installed a config file to `#{NewlineHw::Config::CONFIG_PATH}`"
|
21
|
-
|
21
|
+
install_chrome
|
22
22
|
say ""
|
23
23
|
say ("*" * 30) + " YOU MUST!! Add this line to your shell profile " + ("*" * 30), :red
|
24
24
|
say '$ eval "$(newline_hw init)"'
|
25
25
|
say ("*" * 30), :red
|
26
26
|
end
|
27
27
|
|
28
|
+
desc "install chrome adapter",
|
29
|
+
"will setup a logging file and a chrome manifest to allow this app to be communicated to by the newline-assistant chrome extension."
|
30
|
+
def install_chrome
|
31
|
+
NewlineHw.make_log_directory
|
32
|
+
ChromeManifest.write
|
33
|
+
say "Chrome Native Messaging Hook installed for Newline Assistant", :green
|
34
|
+
end
|
35
|
+
|
28
36
|
desc "setup SUBMISSION_ID",
|
29
|
-
|
37
|
+
"generate a shell command to clone and setup a given SUBMISSION_ID"
|
30
38
|
option :editor
|
31
39
|
def setup_command(submission_id)
|
32
40
|
puts Shell::Setup.new(submission_id, config).cmd
|
@@ -19,10 +19,10 @@ module NewlineHw
|
|
19
19
|
|
20
20
|
def call
|
21
21
|
applescript = case application
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
when "iTerm2"
|
23
|
+
applescript_for_iterm
|
24
|
+
else
|
25
|
+
applescript_for_terminal
|
26
26
|
end
|
27
27
|
|
28
28
|
{ terminal_output: `osascript -e '#{applescript}'` }
|
@@ -40,7 +40,7 @@ module NewlineHw
|
|
40
40
|
end
|
41
41
|
|
42
42
|
private def applescript_for_iterm
|
43
|
-
|
43
|
+
<<-APPLESCRIPT
|
44
44
|
tell application \"#{application}\"
|
45
45
|
set newWindow to (create window with default profile)
|
46
46
|
|
@@ -1,21 +1,12 @@
|
|
1
|
-
# if [[ $# -eq 0 ]] ; then
|
2
|
-
# echo 'WARNING: You must provide a git url, pull-request url or a Newline Submission ID.'
|
3
|
-
# exit 0
|
4
|
-
# fi
|
5
|
-
# OUTPUT="$(#{path} run_command $PWD $*)"
|
6
|
-
# eval $OUTPUT
|
7
|
-
|
8
1
|
module NewlineHw
|
9
2
|
module Shell
|
10
3
|
##
|
11
4
|
# Produce a bash / zsh function to be called by a tty compatible shell
|
12
|
-
#
|
13
|
-
# WARNING: all bash lines below must be terminated in a semicolon, line
|
14
|
-
# endings do not survive being passed through the heredoc correctly for the
|
15
|
-
# shell to interpreter correctly.
|
16
5
|
module Function
|
17
6
|
HW_FUNCTION = "hw".freeze
|
7
|
+
|
18
8
|
module_function
|
9
|
+
|
19
10
|
def path
|
20
11
|
File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "exe", "newline_hw"))
|
21
12
|
end
|
@@ -40,7 +40,7 @@ module NewlineHw
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def github_project_link?
|
43
|
-
url.starts_with?("https://github.com") && URI(url).path.split("/").reject
|
43
|
+
url.starts_with?("https://github.com") && URI(url).path.split("/").reject(&:empty?).size == 2
|
44
44
|
end
|
45
45
|
|
46
46
|
def git?
|
@@ -37,18 +37,20 @@ module NewlineHw
|
|
37
37
|
version: NewlineHw::VERSION,
|
38
38
|
newline_cli_version: NewlineCli::VERSION,
|
39
39
|
ruby_version: RUBY_VERSION,
|
40
|
-
config_path: Config::CONFIG_PATH
|
40
|
+
config_path: Config::CONFIG_PATH,
|
41
|
+
path: NewlineHw.root_path
|
41
42
|
}
|
42
43
|
}
|
43
44
|
end
|
44
45
|
|
45
46
|
def check_if_cloneable
|
47
|
+
setup = Shell::Setup.new(data["id"], Config.new)
|
46
48
|
{
|
47
49
|
status: :ok,
|
48
50
|
message_at: message_at,
|
49
51
|
data: {
|
50
|
-
cloneable:
|
51
|
-
|
52
|
+
cloneable: setup.cloneable?,
|
53
|
+
submission_info: setup.submission_info
|
52
54
|
}
|
53
55
|
}
|
54
56
|
end
|
data/lib/newline_hw/version.rb
CHANGED
data/lib/newline_hw.rb
CHANGED