Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Windows support #4

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PATH
remote: .
specs:
chelsea (0.0.1)
bundler (~> 2.0.0)
chelsea (0.0.2)
bundler (>= 1.2.0, < 3)
pastel (~> 0.7.2)
rest-client (~> 2.0.2)
slop (~> 4.8.0)
Expand All @@ -16,6 +16,7 @@ GEM
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
equatable (0.6.1)
ffi (1.12.2-x64-mingw32)
http-cookie (1.0.3)
domain_name (~> 0.5)
mime-types (3.3.1)
Expand All @@ -30,6 +31,11 @@ GEM
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rest-client (2.0.2-x64-mingw32)
ffi (~> 1.9)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
Expand All @@ -43,6 +49,8 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.2)
rspec_junit_formatter (0.4.1)
rspec-core (>= 2, < 4, != 2.12.0)
slop (4.8.0)
tty-color (0.5.1)
tty-cursor (0.7.1)
Expand All @@ -55,11 +63,13 @@ GEM

PLATFORMS
ruby
x64-mingw32

DEPENDENCIES
chelsea!
rake (~> 10.0)
rspec (~> 3.0)
rspec_junit_formatter (~> 0.4.1)

BUNDLED WITH
2.0.2
5 changes: 5 additions & 0 deletions bin/chelseawin.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
require ".\\lib\\chelsea.rb"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you want to use require_relative here, as once this is deployed out into the ether (RubyGems), it will struggle to find that file, at least from my experience publishing 0.0.1, lol

Also, I wonder if in bin/chelsea you can just do a quick check on Host OS, and switch the require based on that? I don't know for sure if you even need this tho, because I did some quick googling and from what I understand Ruby treats paths identically across platforms?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you're right I think require_relative should be used here and I do believe Ruby treats paths with / correctly according to the platform so a require_relative should work on Linux + Windows and elsewhere.


Chelsea::CLI.new.main
3 changes: 3 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off
echo Installing Ruby dependencies...
bundle install --deployment %*
3 changes: 3 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
echo Installing Ruby dependencies...
bundle install "$@"
2 changes: 2 additions & 0 deletions chelsea.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need a chelsea.cmd? I'd been Googling around to try and see exactly what you need for a cross platform Ruby CLI app (surprisingly hard to find).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's strictly needed but it's a convenience feature to save some keystrokes plus people may not be sure how to go about launching the CLI . Usually with DevAudit and the ther tools we'd have a .cmd and .sh launcher scripts for Windows and Linux.

ruby .\bin\chelseawin.rb %*