skipjack 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/skipjack/fsharp.rb +5 -8
- data/lib/skipjack/version.rb +1 -1
- data/spec/lib/skipjack/fsharp_spec.rb +18 -25
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e197313df74648d36c9608a97523791d2982d239
|
4
|
+
data.tar.gz: 9e0d38d5fd325164bf6975b79beb768e90dd75eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0a3059a796649cf21344eaacf2e872bafd39752906d49e0cfe4e5dcd20cdd3be3bd943660fbb941f570952ff1a5549a26eec828a93e18776337d6c156dfd283
|
7
|
+
data.tar.gz: 4743affd7b7db28f0a2c08e72600d567f89733b4bf194e96445000ba5ab3e723710033a75ae5bff12ad0651445a896488d2eff754841b9de743a33bbd499abcf
|
data/lib/skipjack/fsharp.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module Skipjack
|
2
2
|
class FSharpCompiler
|
3
3
|
attr_reader :target
|
4
|
-
attr_accessor :output_folder, :output_file
|
5
4
|
attr_writer :references
|
6
5
|
|
7
6
|
def initialize *args
|
@@ -26,29 +25,27 @@ module Skipjack
|
|
26
25
|
@references ||= []
|
27
26
|
end
|
28
27
|
|
29
|
-
def create_file_task
|
30
|
-
output_file_name = output_folder ? "#{output_folder}/#{output_file}" : output_file
|
28
|
+
def create_file_task *args
|
31
29
|
dependencies = source_files
|
32
|
-
file_task = Rake::FileTask::define_task
|
30
|
+
file_task = Rake::FileTask::define_task *args do |t|
|
33
31
|
if t.application.windows?
|
34
32
|
compiler = "fsc"
|
35
33
|
else
|
36
34
|
compiler = "fsharpc"
|
37
35
|
end
|
38
36
|
|
39
|
-
out = "--out:#{
|
37
|
+
out = "--out:#{t.name}"
|
40
38
|
src = source_files.join(" ")
|
41
39
|
refs = references.each {|r| r.prepend("--reference:") }
|
42
40
|
refs = refs.join(" ")
|
43
41
|
cmd = "#{compiler} #{refs} #{out} --target:#{target.to_s} #{src}"
|
44
42
|
raise "Error executing command" unless Kernel.system cmd
|
45
43
|
end
|
44
|
+
file_task.enhance dependencies
|
46
45
|
end
|
47
46
|
|
48
47
|
def create_task
|
49
|
-
|
50
|
-
file_task = create_file_task
|
51
|
-
task.enhance [file_task]
|
48
|
+
create_file_task *@args
|
52
49
|
end
|
53
50
|
end
|
54
51
|
end
|
data/lib/skipjack/version.rb
CHANGED
@@ -17,20 +17,22 @@ describe 'fsharp' do
|
|
17
17
|
context "when a task is not executed" do
|
18
18
|
it "does not call the system" do
|
19
19
|
expect_no_system_call
|
20
|
-
@task = fsc
|
20
|
+
@task = fsc "dummy.exe"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
describe "command line args" do
|
25
25
|
before :each do
|
26
|
-
expect_compiler_call
|
26
|
+
expect_compiler_call do |opts|
|
27
|
+
@opts = opts
|
28
|
+
end
|
27
29
|
end
|
28
30
|
|
29
31
|
let :options do
|
30
|
-
|
31
|
-
t.output_file = "dummy.exe" # in case test doesn't set one up
|
32
|
+
task = fsc "dummy.exe" do |t|
|
32
33
|
@setup.call(t) if @setup
|
33
34
|
end
|
35
|
+
task.invoke
|
34
36
|
@opts
|
35
37
|
end
|
36
38
|
|
@@ -90,20 +92,11 @@ describe 'fsharp' do
|
|
90
92
|
|
91
93
|
describe "output" do
|
92
94
|
it "sets the output file" do
|
93
|
-
|
94
|
-
t
|
95
|
-
t.output_file = "p.exe"
|
96
|
-
end
|
97
|
-
expect(options.out).to eq("f/p.exe")
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
context "when folder not specified" do
|
102
|
-
it "sets the output file" do
|
103
|
-
@setup = lambda do |t|
|
104
|
-
t.output_file = "p.exe"
|
95
|
+
task = fsc "f/p.exe" do |t|
|
96
|
+
@setup.call(t) if @setup
|
105
97
|
end
|
106
|
-
|
98
|
+
task.invoke
|
99
|
+
expect(@opts.out).to eq("f/p.exe")
|
107
100
|
end
|
108
101
|
end
|
109
102
|
|
@@ -112,24 +105,24 @@ describe 'fsharp' do
|
|
112
105
|
it "calls the compiler", :focus => true do
|
113
106
|
FileUtils.touch('./p.exe')
|
114
107
|
FileUtils.touch('s.fs')
|
115
|
-
|
108
|
+
task = fsc "p.exe" do |t|
|
116
109
|
t.target = :exe
|
117
|
-
t.output_file = "p.exe"
|
118
110
|
t.source_files = ["s.fs"]
|
119
111
|
end
|
120
|
-
|
112
|
+
task.invoke
|
113
|
+
expect(@opts).to_not be_nil
|
121
114
|
end
|
122
115
|
end
|
123
116
|
context "build output is newer than source files" do
|
124
117
|
it "does not call the compiler", :focus => true do
|
125
118
|
FileUtils.touch('s.fs')
|
126
119
|
FileUtils.touch('./p.exe')
|
127
|
-
|
120
|
+
task = fsc "p.exe" do |t|
|
128
121
|
t.target = :exe
|
129
|
-
t.output_file = "p.exe"
|
130
122
|
t.source_files = ["s.fs"]
|
131
123
|
end
|
132
|
-
|
124
|
+
task.invoke
|
125
|
+
expect(@opts).to be_nil
|
133
126
|
end
|
134
127
|
end
|
135
128
|
end
|
@@ -138,11 +131,11 @@ describe 'fsharp' do
|
|
138
131
|
describe "target type" do
|
139
132
|
it "fails when using invalid target option" do
|
140
133
|
op = lambda do
|
141
|
-
|
134
|
+
task = fsc "p.exe" do |t|
|
142
135
|
t.target = :invalid_option
|
143
136
|
end
|
144
137
|
end
|
145
|
-
expect(op).to raise_error
|
138
|
+
expect(op).to raise_error(/^Invalid target/)
|
146
139
|
end
|
147
140
|
end
|
148
141
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skipjack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Strøiman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|