Skip to content

Commit a35dc7a

Browse files
committed
Support Windows
1 parent 8012cca commit a35dc7a

16 files changed

+79
-24
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
.bundle
33
hello-1.0.0-*
44
*.tar.gz
5+
*.zip
56
vendor
7+
8+
!packaging/*-win32-ffi*.tar.gz

Gemfile.lock

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
activesupport (4.2.4)
4+
activesupport (4.2.6)
55
i18n (~> 0.7)
66
json (~> 1.7, >= 1.7.7)
77
minitest (~> 5.1)
88
thread_safe (~> 0.3, >= 0.3.4)
99
tzinfo (~> 1.1)
10-
addressable (2.3.8)
10+
addressable (2.4.0)
1111
colorize (0.7.7)
12-
csvlint (0.2.4)
12+
csvlint (0.3.1)
1313
activesupport
1414
addressable
1515
colorize
@@ -19,20 +19,22 @@ GEM
1919
thor
2020
typhoeus
2121
uri_template
22-
escape_utils (1.1.0)
23-
ethon (0.8.0)
22+
escape_utils (1.2.1)
23+
ethon (0.9.0)
2424
ffi (>= 1.3.0)
2525
ffi (1.9.6)
2626
i18n (0.7.0)
2727
json (1.8.3)
28-
mime-types (2.6.2)
29-
minitest (5.8.1)
28+
mime-types (3.1)
29+
mime-types-data (~> 3.2015)
30+
mime-types-data (3.2016.0521)
31+
minitest (5.9.0)
3032
open_uri_redirections (0.2.1)
3133
rake (10.4.2)
3234
thor (0.19.1)
3335
thread_safe (0.3.5)
34-
typhoeus (0.8.0)
35-
ethon (>= 0.8.0)
36+
typhoeus (1.0.2)
37+
ethon (>= 0.9.0)
3638
tzinfo (1.2.2)
3739
thread_safe (~> 0.1)
3840
uri_template (0.7.0)
@@ -45,3 +47,6 @@ DEPENDENCIES
4547
ffi (= 1.9.6)
4648
rake
4749
thor
50+
51+
BUNDLED WITH
52+
1.11.2

README.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ This uses the power of [Traveling Ruby](https://github.com/phusion/traveling-rub
44

55
# Support
66

7-
Currently, we support all Linux platforms (32bit and 64bit) and OSX. Windows support may be forthcoming in the future.
7+
We support all Linux platforms (32bit and 64bit), OSX and Windows
88

99
# Installation
1010

11+
## Linux and OSX
12+
1113
To install CSVlint, you'll need `curl` installed on your system.
1214

1315
For Linux:
@@ -23,21 +25,21 @@ For OS X:
2325
brew install curl
2426
```
2527

26-
## Simple installation
28+
### Simple installation
2729

2830
From a Linux or OSX terminal, you can then run the following command to download and unpack CSVlint and set up your `$PATH`:
2931

3032
```
3133
curl -s https://raw.githubusercontent.com/theodi/csvlint.sh/master/scripts/install.sh | bash
3234
```
3335

34-
## Step by step install
36+
### Step by step install
3537

3638
Download the relevant file, based on your platform:
3739

38-
* [Linux 32 bit](https://github.com/theodi/csvlint.sh/releases/download/v1.0.0/csvlint-1.0.0-linux-x86.tar.gz)
39-
* [Linux 64 bit](https://github.com/theodi/csvlint.sh/releases/download/v1.0.0/csvlint-1.0.0-linux-x86_64.tar.gz)
40-
* [OSX](https://github.com/theodi/csvlint.sh/releases/download/v1.0.0/csvlint-1.0.0-osx.tar.gz)
40+
* [Linux 32 bit](https://github.com/theodi/csvlint.sh/releases/download/v0.3.1/csvlint-0.3.1-linux-x86.tar.gz)
41+
* [Linux 64 bit](https://github.com/theodi/csvlint.sh/releases/download/v0.3.1/csvlint-0.3.1-linux-x86_64.tar.gz)
42+
* [OSX](https://github.com/theodi/csvlint.sh/releases/download/v0.3.1/csvlint-0.3.1-osx.tar.gz)
4143

4244
You can then untar the file like so:
4345

@@ -47,6 +49,14 @@ tar xzf csvlint*.tar.gz
4749

4850
Then copy the resulting folder to a sensible place. Make sure to add the location of the `csvlint` binary to your `$PATH`.
4951

52+
## Windows
53+
54+
There is currently no automatic way to install csvlint on Windows, but you can simply [download the zip](https://github.com/theodi/csvlint.sh/releases/download/v0.3.1/csvlint-0.3.1-win32.zip), extract to a folder, then add to your PATH like so:
55+
56+
```
57+
set PATH=%PATH%;C:\{folder you extracted csvlint to}
58+
```
59+
5060
# Generate application files yourself
5161

5262
If you're interested in how this thing works, you can generate the application files yourself.
@@ -62,13 +72,14 @@ Choose below, depending on your platform:
6272
```
6373
rake package:linux:x86 # For Linux 32 bit systems
6474
rake package:linux:x86_64 # For Linux 64 bit systems
65-
rake package:linux:x86 # For OSX
75+
rake package:osx # For OSX
76+
rake package:win32 # For OSX
6677
```
6778

79+
This generates a `tar.gz` file (`zip` for Windows), which you can then use as per the installation instructions.
80+
6881
If you're hacking around and want to have a look what all packages look like, you can run the following to package all versions
6982

7083
```
7184
rake package
7285
```
73-
74-
This generates a `tar.gz` file, which you can then use as per the installation instructions.

Rakefile

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
require 'bundler/setup'
33

44
PACKAGE_NAME = "csvlint"
5-
VERSION = "1.0.0"
5+
VERSION = "0.3.1"
66
TRAVELING_RUBY_VERSION = "20150210-2.1.5"
77
FFI_VERSION = "1.9.6"
88

99
desc "Package your app"
10-
task :package => ['package:linux:x86', 'package:linux:x86_64', 'package:osx']
10+
task :package => ['package:linux:x86', 'package:linux:x86_64', 'package:osx', 'package:win32']
1111

1212
namespace :package do
1313
namespace :linux do
@@ -30,6 +30,13 @@ namespace :package do
3030
create_package("osx")
3131
end
3232

33+
desc "Package your app for Windows"
34+
task :win32 => [:bundle_install, "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-win32.tar.gz",
35+
"packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-win32-ffi-#{FFI_VERSION}.tar.gz"] do
36+
create_package("win32", :win32)
37+
end
38+
39+
3340
desc "Install gems to local directory"
3441
task :bundle_install do
3542
if RUBY_VERSION !~ /^2\.1\./
@@ -62,6 +69,10 @@ file "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-osx.tar.gz" do
6269
download_runtime("osx")
6370
end
6471

72+
file "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-win32.tar.gz" do
73+
download_runtime("win32")
74+
end
75+
6576
file "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-linux-x86-ffi-#{FFI_VERSION}.tar.gz" do
6677
download_native_extension("linux-x86", "ffi-#{FFI_VERSION}")
6778
end
@@ -74,22 +85,32 @@ file "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-osx-ffi-#{FFI_VERSION}.
7485
download_native_extension("osx", "ffi-#{FFI_VERSION}")
7586
end
7687

77-
def create_package(target)
88+
def create_package(target, os_type = :unix)
7889
package_dir = "#{PACKAGE_NAME}-#{VERSION}-#{target}"
7990
sh "rm -rf #{package_dir}"
8091
sh "mkdir #{package_dir}"
8192
sh "mkdir -p #{package_dir}/lib/app"
8293
sh "mkdir #{package_dir}/lib/ruby"
8394
sh "tar -xzf packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-#{target}.tar.gz -C #{package_dir}/lib/ruby"
84-
sh "cp packaging/wrapper.sh #{package_dir}/#{PACKAGE_NAME}"
95+
if os_type == :unix
96+
sh "cp packaging/wrapper.sh #{package_dir}/#{PACKAGE_NAME}"
97+
else
98+
sh "cp csvlint.rb #{package_dir}/lib/app/csvlint.rb"
99+
sh "cp packaging/wrapper.bat #{package_dir}/#{PACKAGE_NAME}.bat"
100+
sh "cp -a packaging/curl/. #{package_dir}/lib/ruby/bin"
101+
end
85102
sh "cp -pR packaging/vendor #{package_dir}/lib/"
86103
sh "cp Gemfile Gemfile.lock #{package_dir}/lib/vendor/"
87104
sh "mkdir #{package_dir}/lib/vendor/.bundle"
88105
sh "cp packaging/bundler-config #{package_dir}/lib/vendor/.bundle/config"
89106
sh "tar -xzf packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-#{target}-ffi-#{FFI_VERSION}.tar.gz " +
90107
"-C #{package_dir}/lib/vendor/ruby"
91108
if !ENV['DIR_ONLY']
92-
sh "tar -czf #{package_dir}.tar.gz #{package_dir}"
109+
if os_type == :unix
110+
sh "tar -czf #{package_dir}.tar.gz #{package_dir}"
111+
else
112+
sh "zip -9r #{package_dir}.zip #{package_dir}"
113+
end
93114
sh "rm -rf #{package_dir}"
94115
end
95116
end

csvlint.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
require 'csvlint'
2+
require 'csvlint/cli'
3+
4+
if ARGV == ["help"]
5+
Csvlint::Cli.start(["help"])
6+
else
7+
Csvlint::Cli.start(ARGV.unshift("validate"))
8+
end

packaging/curl/curl.exe

158 KB
Binary file not shown.

packaging/curl/libcurl.dll

626 KB
Binary file not shown.

packaging/curl/libeay32.dll

1.63 MB
Binary file not shown.

packaging/curl/libidn-11.dll

273 KB
Binary file not shown.

packaging/curl/librtmp.dll

179 KB
Binary file not shown.

0 commit comments

Comments
 (0)