furoshiki 0.1.0 → 0.1.1
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.
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +11 -0
- data/Gemfile +2 -11
- data/README.rdoc +1 -1
- data/furoshiki.gemspec +7 -0
- data/lib/furoshiki/exceptions.rb +4 -0
- data/lib/furoshiki/shoes/configuration.rb +48 -10
- data/lib/furoshiki/shoes/swt_app.rb +13 -2
- data/lib/furoshiki/shoes/swt_jar.rb +5 -0
- data/lib/furoshiki/version.rb +1 -1
- data/lib/furoshiki.rb +1 -1
- data/spec/shoes/configuration_spec.rb +50 -8
- data/spec/shoes/support/shared_config.rb +3 -1
- data/spec/shoes/swt_app_spec.rb +32 -18
- data/spec/shoes/swt_jar_spec.rb +19 -8
- data/spec/support/shared_zip.rb +8 -6
- data/spec/zip/directory_contents_spec.rb +9 -4
- data/spec/zip/directory_spec.rb +10 -4
- metadata +92 -34
- checksums.yaml +0 -7
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
furoshiki
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
jruby-1.7.4
|
data/.travis.yml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
language: ruby
|
2
|
+
script: "rspec"
|
3
|
+
rvm: jruby
|
4
|
+
notifications:
|
5
|
+
irc: "irc.freenode.org#shoes"
|
6
|
+
email:
|
7
|
+
recipients:
|
8
|
+
- wasnotrice@gmail.com
|
9
|
+
- tobias.pfeiffer@student.hpi.uni-potsdam.de
|
10
|
+
on_success: change # [always|never|change] # default: change
|
11
|
+
on_failure: change # [always|never|change] # default: always
|
data/Gemfile
CHANGED
@@ -1,12 +1,3 @@
|
|
1
|
-
source "
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
|
-
|
4
|
-
gem "plist"
|
5
|
-
gem "warbler"
|
6
|
-
|
7
|
-
# Only for packaging Shoes apps (there is no GUI)
|
8
|
-
gem "shoes"#, :github => "shoes/shoes4"
|
9
|
-
|
10
|
-
group :test, :development do
|
11
|
-
gem "rspec", "~> 2.12"
|
12
|
-
end
|
3
|
+
gemspec
|
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= furoshiki
|
1
|
+
= furoshiki {<img src="https://travis-ci.org/shoes/furoshiki.png?branch=master" alt="Build Status" />}[https://travis-ci.org/shoes/furoshiki] {<img src="https://codeclimate.com/github/shoes/furoshiki.png" />}[https://codeclimate.com/github/shoes/furoshiki]
|
2
2
|
|
3
3
|
風呂敷 (Furoshiki) is a simple way to package your Ruby applications for
|
4
4
|
distribution on Windows, Linux, and OSX. A 風呂敷 is "a type of traditional
|
data/furoshiki.gemspec
CHANGED
@@ -18,4 +18,11 @@ Gem::Specification.new do |s|
|
|
18
18
|
|
19
19
|
s.add_dependency "warbler"
|
20
20
|
s.add_dependency "plist"
|
21
|
+
# only for packaging shoes apps
|
22
|
+
s.add_dependency 'shoes'
|
23
|
+
s.add_dependency 'rubyzip', '< 1.0.0'
|
24
|
+
|
25
|
+
s.add_development_dependency 'rake'
|
26
|
+
s.add_development_dependency 'rspec'
|
27
|
+
|
21
28
|
end
|
data/lib/furoshiki/exceptions.rb
CHANGED
@@ -72,12 +72,14 @@ module Furoshiki
|
|
72
72
|
file = dummy_file.new(options)
|
73
73
|
dir = pathname.parent
|
74
74
|
end
|
75
|
-
|
75
|
+
config = YAML.load(file.read)
|
76
|
+
config[:working_dir] = dir
|
77
|
+
new(config)
|
76
78
|
end
|
77
79
|
|
78
80
|
# @param [Hash] config user options
|
79
81
|
# @param [String] working_dir directory in which do packaging work
|
80
|
-
def initialize(config = {}
|
82
|
+
def initialize(config = {})
|
81
83
|
defaults = {
|
82
84
|
name: 'Shoes App',
|
83
85
|
version: '0.0.0',
|
@@ -92,38 +94,65 @@ module Furoshiki
|
|
92
94
|
dmg: {
|
93
95
|
ds_store: 'path/to/default/.DS_Store',
|
94
96
|
background: 'path/to/default/background.png'
|
95
|
-
}
|
97
|
+
},
|
98
|
+
working_dir: Dir.pwd
|
96
99
|
}
|
97
100
|
|
98
101
|
# Overwrite defaults with supplied config
|
99
102
|
@config = config.inject(defaults) { |c, (k, v)| set_symbol_key c, k, v }
|
100
103
|
|
101
104
|
# Ensure that we always have what we need
|
102
|
-
@config[:shortname] ||= @config[:name].downcase.gsub(/\W+/, '')
|
103
105
|
[:ignore, :gems].each { |k| @config[k] = Array(@config[k]) }
|
104
106
|
@config[:gems] << 'shoes'
|
107
|
+
@config[:working_dir] = Pathname.new(@config[:working_dir])
|
105
108
|
|
106
|
-
# Define reader for each key
|
109
|
+
# Define reader for each key (#shortname defined below)
|
107
110
|
metaclass = class << self; self; end
|
108
|
-
@config.keys.each do |k|
|
111
|
+
@config.keys.reject {|k| k == :shortname}.each do |k|
|
109
112
|
metaclass.send(:define_method, k) do
|
110
113
|
@config[k]
|
111
114
|
end
|
112
115
|
end
|
113
116
|
|
114
|
-
@
|
117
|
+
@errors = []
|
115
118
|
end
|
116
119
|
|
117
|
-
|
118
|
-
|
120
|
+
def shortname
|
121
|
+
@config[:shortname] || @config[:name].downcase.gsub(/\W+/, '')
|
122
|
+
end
|
119
123
|
|
120
124
|
def to_hash
|
121
125
|
@config
|
122
126
|
end
|
123
127
|
|
128
|
+
def validate
|
129
|
+
unless @config[:run] && working_dir.join(@config[:run]).exist?
|
130
|
+
add_missing_file_error(@config[:run], "Run file")
|
131
|
+
end
|
132
|
+
|
133
|
+
if @config[:icons][:osx] && !working_dir.join(@config[:icons][:osx]).exist?
|
134
|
+
add_missing_file_error(@config[:icons][:osx], "OS X icon file")
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
def valid?
|
139
|
+
validate
|
140
|
+
return errors.empty?
|
141
|
+
end
|
142
|
+
|
143
|
+
def errors
|
144
|
+
@errors.dup
|
145
|
+
end
|
146
|
+
|
147
|
+
def error_message_list
|
148
|
+
@errors.map {|m| " - #{m}"}.join("\n")
|
149
|
+
end
|
150
|
+
|
124
151
|
def ==(other)
|
125
152
|
super unless other.class == self.class && other.respond_to?(:to_hash)
|
126
|
-
@config == other.to_hash
|
153
|
+
@config == other.to_hash &&
|
154
|
+
working_dir == other.working_dir &&
|
155
|
+
errors == other.errors
|
127
156
|
end
|
128
157
|
|
129
158
|
private
|
@@ -141,6 +170,15 @@ module Furoshiki
|
|
141
170
|
end
|
142
171
|
config
|
143
172
|
end
|
173
|
+
|
174
|
+
def add_error(message)
|
175
|
+
@errors << message
|
176
|
+
end
|
177
|
+
|
178
|
+
def add_missing_file_error(value, description)
|
179
|
+
message = "#{description} configured as '#{value}', but couldn't find file at #{working_dir.join(value.to_s)}"
|
180
|
+
add_error(message)
|
181
|
+
end
|
144
182
|
end
|
145
183
|
end
|
146
184
|
end
|
@@ -12,9 +12,16 @@ module Furoshiki
|
|
12
12
|
class SwtApp
|
13
13
|
include FileUtils
|
14
14
|
|
15
|
+
REMOTE_TEMPLATE_URL = 'https://s3.amazonaws.com/net.wasnotrice.shoes/wrappers/shoes-app-template-0.0.1.zip'
|
16
|
+
|
15
17
|
# @param [Shoes::Package::Configuration] config user configuration
|
16
18
|
def initialize(config)
|
17
19
|
@config = config
|
20
|
+
|
21
|
+
unless config.valid?
|
22
|
+
raise Furoshiki::ConfigurationError, "Invalid configuration.\n#{config.error_message_list}"
|
23
|
+
end
|
24
|
+
|
18
25
|
home = ENV['FUROSHIKI_HOME'] || Dir.home
|
19
26
|
@cache_dir = Pathname.new(home).join('.furoshiki', 'cache')
|
20
27
|
@default_package_dir = working_dir.join('pkg')
|
@@ -98,7 +105,10 @@ module Furoshiki
|
|
98
105
|
end
|
99
106
|
|
100
107
|
def download_following_redirects(remote_url, local_path, redirect_limit = 5)
|
101
|
-
|
108
|
+
if redirect_limit == 0
|
109
|
+
raise Furoshiki::DownloadError,
|
110
|
+
"Too many redirects trying to reach #{remote_url}"
|
111
|
+
end
|
102
112
|
|
103
113
|
uri = URI(remote_url)
|
104
114
|
Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
|
@@ -128,7 +138,8 @@ module Furoshiki
|
|
128
138
|
end
|
129
139
|
|
130
140
|
def remote_template_url
|
131
|
-
"#{downloads_url}/#{template_basename}-#{latest_template_version}#{template_extension}"
|
141
|
+
#"#{downloads_url}/#{template_basename}-#{latest_template_version}#{template_extension}"
|
142
|
+
REMOTE_TEMPLATE_URL
|
132
143
|
end
|
133
144
|
|
134
145
|
def move_to_package_dir(path)
|
@@ -8,6 +8,11 @@ module Furoshiki
|
|
8
8
|
# @param [Furoshiki::Shoes::Configuration] config user configuration
|
9
9
|
def initialize(config = nil)
|
10
10
|
@shoes_config = config || Furoshiki::Shoes::Configuration.load
|
11
|
+
|
12
|
+
unless config.valid?
|
13
|
+
raise Furoshiki::ConfigurationError, "Invalid configuration.\n#{config.error_message_list}"
|
14
|
+
end
|
15
|
+
|
11
16
|
Dir.chdir working_dir do
|
12
17
|
@config = Warbler::Config.new do |config|
|
13
18
|
config.jar_name = @shoes_config.shortname
|
data/lib/furoshiki/version.rb
CHANGED
data/lib/furoshiki.rb
CHANGED
@@ -14,8 +14,10 @@ describe Furoshiki::Shoes::Configuration do
|
|
14
14
|
its(:icons) { should be_an_instance_of(Hash) }
|
15
15
|
its(:dmg) { should be_an_instance_of(Hash) }
|
16
16
|
its(:run) { should be_nil }
|
17
|
+
its(:working_dir) { should eq(Pathname.new(Dir.pwd)) }
|
18
|
+
it { should_not be_valid } # no :run
|
17
19
|
|
18
|
-
describe "#
|
20
|
+
describe "#icons" do
|
19
21
|
it 'osx is nil' do
|
20
22
|
subject.icons[:osx].should be_nil
|
21
23
|
end
|
@@ -48,19 +50,22 @@ describe Furoshiki::Shoes::Configuration do
|
|
48
50
|
|
49
51
|
context "with options" do
|
50
52
|
include_context 'config'
|
51
|
-
subject { Furoshiki::Shoes::Configuration.load(config_filename) }
|
53
|
+
subject { Furoshiki::Shoes::Configuration.load(@config_filename) }
|
52
54
|
|
53
55
|
its(:name) { should eq('Sugar Clouds') }
|
54
56
|
its(:shortname) { should eq('sweet-nebulae') }
|
55
57
|
its(:ignore) { should include('pkg') }
|
58
|
+
its(:run) { should eq('bin/hello_world') }
|
56
59
|
its(:gems) { should include('rspec') }
|
57
60
|
its(:gems) { should include('shoes') }
|
58
61
|
its(:version) { should eq('0.0.1') }
|
59
62
|
its(:release) { should eq('Mindfully') }
|
60
63
|
its(:icons) { should be_an_instance_of(Hash) }
|
61
64
|
its(:dmg) { should be_an_instance_of(Hash) }
|
65
|
+
its(:working_dir) { should eq(@config_filename.dirname) }
|
66
|
+
it { should be_valid }
|
62
67
|
|
63
|
-
describe "#
|
68
|
+
describe "#icons" do
|
64
69
|
it 'has osx' do
|
65
70
|
subject.icons[:osx].should eq('img/boots.icns')
|
66
71
|
end
|
@@ -87,6 +92,10 @@ describe Furoshiki::Shoes::Configuration do
|
|
87
92
|
it "incorporates custom features" do
|
88
93
|
subject.custom.should eq('my custom feature')
|
89
94
|
end
|
95
|
+
|
96
|
+
it "round-trips" do
|
97
|
+
Furoshiki::Shoes::Configuration.new(subject.to_hash).should eq(subject)
|
98
|
+
end
|
90
99
|
end
|
91
100
|
|
92
101
|
context "with name, but without explicit shortname" do
|
@@ -97,12 +106,45 @@ describe Furoshiki::Shoes::Configuration do
|
|
97
106
|
its(:shortname) { should eq("sugarclouds") }
|
98
107
|
end
|
99
108
|
|
109
|
+
context "when the file to run doens't exist" do
|
110
|
+
let(:options) { {:run => "path/to/non-existent/file"} }
|
111
|
+
subject { Furoshiki::Shoes::Configuration.new options }
|
112
|
+
|
113
|
+
it { should_not be_valid }
|
114
|
+
end
|
115
|
+
|
116
|
+
context "when osx icon is not specified" do
|
117
|
+
include_context 'config'
|
118
|
+
let(:valid_config) { Furoshiki::Shoes::Configuration.load(@config_filename) }
|
119
|
+
let(:options) { valid_config.to_hash.merge(:icons => {}) }
|
120
|
+
subject { Furoshiki::Shoes::Configuration.new(options) }
|
121
|
+
|
122
|
+
it "sets osx icon path to nil" do
|
123
|
+
subject.icons[:osx].should be_nil
|
124
|
+
end
|
125
|
+
|
126
|
+
it "is valid" do
|
127
|
+
subject.should be_valid
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
context "when osx icon is specified, but doesn't exist" do
|
132
|
+
let(:options) { ({:icons => {:osx => "path/to/non-existent/file"}}) }
|
133
|
+
subject { Furoshiki::Shoes::Configuration.new options }
|
134
|
+
|
135
|
+
it "sets osx icon path" do
|
136
|
+
subject.icons[:osx].should eq("path/to/non-existent/file")
|
137
|
+
end
|
138
|
+
|
139
|
+
it { should_not be_valid }
|
140
|
+
end
|
141
|
+
|
100
142
|
context "auto-loading" do
|
101
143
|
include_context 'config'
|
102
144
|
|
103
145
|
context "without a path" do
|
104
146
|
it "looks for 'app.yaml' in current directory" do
|
105
|
-
Dir.chdir config_filename.parent do
|
147
|
+
Dir.chdir @config_filename.parent do
|
106
148
|
config = Furoshiki::Shoes::Configuration.load
|
107
149
|
config.shortname.should eq('sweet-nebulae')
|
108
150
|
end
|
@@ -125,22 +167,22 @@ describe Furoshiki::Shoes::Configuration do
|
|
125
167
|
end
|
126
168
|
|
127
169
|
context "with an 'app.yaml'" do
|
128
|
-
let(:path) { config_filename }
|
170
|
+
let(:path) { @config_filename }
|
129
171
|
it_behaves_like "config with path"
|
130
172
|
end
|
131
173
|
|
132
174
|
context "with a path to a directory containing an 'app.yaml'" do
|
133
|
-
let(:path) { config_filename.parent }
|
175
|
+
let(:path) { @config_filename.parent }
|
134
176
|
it_behaves_like "config with path"
|
135
177
|
end
|
136
178
|
|
137
179
|
context "with a path to a file that is siblings with an 'app.yaml'" do
|
138
|
-
let(:path) { config_filename.parent.join('sibling.rb') }
|
180
|
+
let(:path) { @config_filename.parent.join('sibling.rb') }
|
139
181
|
it_behaves_like "config with path"
|
140
182
|
end
|
141
183
|
|
142
184
|
context "with a path that exists, but no 'app.yaml'" do
|
143
|
-
let(:path) { config_filename.parent.join('bin/hello_world') }
|
185
|
+
let(:path) { @config_filename.parent.join('bin/hello_world') }
|
144
186
|
subject { Furoshiki::Shoes::Configuration.load(path) }
|
145
187
|
|
146
188
|
its(:name) { should eq('hello_world') }
|
@@ -2,5 +2,7 @@ require 'yaml'
|
|
2
2
|
require 'pathname'
|
3
3
|
|
4
4
|
shared_context 'config' do
|
5
|
-
|
5
|
+
before :all do
|
6
|
+
@config_filename = Pathname.new(__FILE__).join('../../test_app/app.yaml').cleanpath
|
7
|
+
end
|
6
8
|
end
|
data/spec/shoes/swt_app_spec.rb
CHANGED
@@ -9,13 +9,12 @@ describe Furoshiki::Shoes::SwtApp do
|
|
9
9
|
include_context 'config'
|
10
10
|
include_context 'package'
|
11
11
|
|
12
|
-
let(:
|
13
|
-
|
14
|
-
|
15
|
-
let(:launcher) { output_file.join('Contents/MacOS/JavaAppLauncher') }
|
16
|
-
let(:icon) { output_file.join('Contents/Resources/boots.icns') }
|
17
|
-
let(:jar) { output_file.join('Contents/Java/sweet-nebulae.jar') }
|
18
|
-
subject { Furoshiki::Shoes::SwtApp.new config }
|
12
|
+
let(:config) {Furoshiki::Shoes::Configuration.load @config_filename }
|
13
|
+
subject {Furoshiki::Shoes::SwtApp.new config}
|
14
|
+
|
15
|
+
let(:launcher) { @output_file.join('Contents/MacOS/JavaAppLauncher') }
|
16
|
+
let(:icon) { @output_file.join('Contents/Resources/boots.icns') }
|
17
|
+
let(:jar) { @output_file.join('Contents/Java/sweet-nebulae.jar') }
|
19
18
|
|
20
19
|
# $FUROSHIKI_HOME is set in spec_helper.rb for testing purposes,
|
21
20
|
# but should default to $HOME
|
@@ -25,6 +24,7 @@ describe Furoshiki::Shoes::SwtApp do
|
|
25
24
|
ENV['FUROSHIKI_HOME'] = nil
|
26
25
|
end
|
27
26
|
|
27
|
+
|
28
28
|
its(:cache_dir) { should eq(Pathname.new(Dir.home).join('.furoshiki', 'cache')) }
|
29
29
|
|
30
30
|
after do
|
@@ -37,28 +37,33 @@ describe Furoshiki::Shoes::SwtApp do
|
|
37
37
|
its(:cache_dir) { should eq(cache_dir) }
|
38
38
|
|
39
39
|
it "sets package dir to {pwd}/pkg" do
|
40
|
-
Dir.chdir app_dir do
|
41
|
-
subject.default_package_dir.should eq(app_dir.join 'pkg')
|
40
|
+
Dir.chdir @app_dir do
|
41
|
+
subject.default_package_dir.should eq(@app_dir.join 'pkg')
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
its(:template_path) { should eq(cache_dir.join('shoes-app-template.zip')) }
|
46
|
-
its(:remote_template_url) { should eq(
|
46
|
+
its(:remote_template_url) { should eq(Furoshiki::Shoes::SwtApp::REMOTE_TEMPLATE_URL) }
|
47
47
|
end
|
48
48
|
|
49
49
|
context "when creating a .app" do
|
50
50
|
before :all do
|
51
|
-
output_dir.rmtree if output_dir.exist?
|
52
|
-
output_dir.mkpath
|
53
|
-
|
54
|
-
|
51
|
+
@output_dir.rmtree if @output_dir.exist?
|
52
|
+
@output_dir.mkpath
|
53
|
+
app_name = 'Sugar Clouds.app'
|
54
|
+
@output_file = @output_dir.join app_name
|
55
|
+
config = Furoshiki::Shoes::Configuration.load @config_filename
|
56
|
+
@subject = Furoshiki::Shoes::SwtApp.new config
|
57
|
+
Dir.chdir @app_dir do
|
58
|
+
@subject.package
|
55
59
|
end
|
56
60
|
end
|
61
|
+
subject { @subject }
|
57
62
|
|
58
63
|
its(:template_path) { should exist }
|
59
64
|
|
60
65
|
it "creates a .app" do
|
61
|
-
output_file.should exist
|
66
|
+
@output_file.should exist
|
62
67
|
end
|
63
68
|
|
64
69
|
it "includes launcher" do
|
@@ -73,7 +78,7 @@ describe Furoshiki::Shoes::SwtApp do
|
|
73
78
|
end
|
74
79
|
|
75
80
|
it "deletes generic icon" do
|
76
|
-
icon.parent.join('GenericApp.icns').should_not exist
|
81
|
+
icon.parent.join('GenericApp.icns').should_not exist
|
77
82
|
end
|
78
83
|
|
79
84
|
it "injects icon" do
|
@@ -85,14 +90,14 @@ describe Furoshiki::Shoes::SwtApp do
|
|
85
90
|
end
|
86
91
|
|
87
92
|
it "removes any extraneous jars" do
|
88
|
-
jar_dir_contents = output_file.join("Contents/Java").children
|
93
|
+
jar_dir_contents = @output_file.join("Contents/Java").children
|
89
94
|
jar_dir_contents.reject {|f| f == jar }.should be_empty
|
90
95
|
end
|
91
96
|
|
92
97
|
describe "Info.plist" do
|
93
98
|
require 'plist'
|
94
99
|
before :all do
|
95
|
-
@plist = Plist.parse_xml(output_file.join 'Contents/Info.plist')
|
100
|
+
@plist = Plist.parse_xml(@output_file.join 'Contents/Info.plist')
|
96
101
|
end
|
97
102
|
|
98
103
|
it "sets identifier" do
|
@@ -116,4 +121,13 @@ describe Furoshiki::Shoes::SwtApp do
|
|
116
121
|
end
|
117
122
|
end
|
118
123
|
end
|
124
|
+
|
125
|
+
describe "with an invalid configuration" do
|
126
|
+
let(:config) { Furoshiki::Shoes::Configuration.new }
|
127
|
+
subject { Furoshiki::Shoes::SwtApp.new config }
|
128
|
+
|
129
|
+
it "fails to initialize" do
|
130
|
+
lambda { subject }.should raise_error(Furoshiki::ConfigurationError)
|
131
|
+
end
|
132
|
+
end
|
119
133
|
end
|
data/spec/shoes/swt_jar_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'spec_helper'
|
1
2
|
require_relative 'spec_helper'
|
2
3
|
require 'pathname'
|
3
4
|
require 'furoshiki/shoes/swt_jar'
|
@@ -10,17 +11,18 @@ describe Furoshiki::Shoes::SwtJar do
|
|
10
11
|
|
11
12
|
context "when creating a .jar" do
|
12
13
|
before :all do
|
13
|
-
output_dir.rmtree if output_dir.exist?
|
14
|
-
output_dir.mkpath
|
15
|
-
|
16
|
-
|
14
|
+
@output_dir.rmtree if @output_dir.exist?
|
15
|
+
@output_dir.mkpath
|
16
|
+
config = Furoshiki::Shoes::Configuration.load(@config_filename)
|
17
|
+
@subject = Furoshiki::Shoes::SwtJar.new(config)
|
18
|
+
Dir.chdir @app_dir do
|
19
|
+
@jar_path = @subject.package(@output_dir)
|
17
20
|
end
|
18
21
|
end
|
19
22
|
|
20
23
|
let(:jar_name) { 'sweet-nebulae.jar' }
|
21
|
-
let(:output_file) { Pathname.new(output_dir.join jar_name) }
|
22
|
-
|
23
|
-
subject { Furoshiki::Shoes::SwtJar.new(config) }
|
24
|
+
let(:output_file) { Pathname.new(@output_dir.join jar_name) }
|
25
|
+
subject { @subject }
|
24
26
|
|
25
27
|
it "creates a .jar" do
|
26
28
|
output_file.should exist
|
@@ -39,7 +41,16 @@ describe Furoshiki::Shoes::SwtJar do
|
|
39
41
|
jar.entries.should_not include("dir_to_ignore/file_to_ignore")
|
40
42
|
end
|
41
43
|
|
42
|
-
its(:default_dir) { should eq(output_dir) }
|
44
|
+
its(:default_dir) { should eq(@output_dir) }
|
43
45
|
its(:filename) { should eq(jar_name) }
|
44
46
|
end
|
47
|
+
|
48
|
+
describe "with an invalid configuration" do
|
49
|
+
let(:config) { Furoshiki::Shoes::Configuration.new }
|
50
|
+
subject { Furoshiki::Shoes::SwtJar.new(config) }
|
51
|
+
|
52
|
+
it "fails to initialize" do
|
53
|
+
lambda { subject }.should raise_error(Furoshiki::ConfigurationError)
|
54
|
+
end
|
55
|
+
end
|
45
56
|
end
|
data/spec/support/shared_zip.rb
CHANGED
@@ -1,21 +1,23 @@
|
|
1
1
|
include ZipHelpers
|
2
2
|
|
3
3
|
shared_context 'package' do
|
4
|
-
|
5
|
-
|
4
|
+
before :all do
|
5
|
+
@app_dir = spec_dir.join 'shoes/test_app'
|
6
|
+
@output_dir = @app_dir.join 'pkg'
|
7
|
+
end
|
6
8
|
end
|
7
9
|
|
8
10
|
shared_context 'zip' do
|
9
11
|
include_context 'package'
|
10
|
-
let(:output_file) { output_dir.join 'zip_directory_spec.zip' }
|
12
|
+
let(:output_file) { @output_dir.join 'zip_directory_spec.zip' }
|
11
13
|
let(:zip) { Zip::ZipFile.open output_file }
|
12
14
|
|
13
15
|
before :all do
|
14
|
-
output_dir.mkpath
|
15
|
-
|
16
|
+
@output_dir.mkpath
|
17
|
+
@output_file = @output_dir.join 'zip_directory_spec.zip'
|
16
18
|
end
|
17
19
|
|
18
20
|
after :all do
|
19
|
-
FileUtils.rm_rf output_dir
|
21
|
+
FileUtils.rm_rf @output_dir
|
20
22
|
end
|
21
23
|
end
|
@@ -3,22 +3,27 @@ require 'fileutils'
|
|
3
3
|
require 'furoshiki/zip'
|
4
4
|
|
5
5
|
describe Furoshiki::Zip::DirectoryContents do
|
6
|
-
subject { Furoshiki::Zip::DirectoryContents.new input_dir, output_file }
|
7
6
|
|
8
7
|
context "output file" do
|
9
8
|
include_context 'zip'
|
10
9
|
|
10
|
+
before :all do
|
11
|
+
zip_directory_contents = Furoshiki::Zip::DirectoryContents.new input_dir, @output_file
|
12
|
+
zip_directory_contents.write
|
13
|
+
@zip = Zip::ZipFile.open @output_file
|
14
|
+
end
|
15
|
+
|
11
16
|
it "exists" do
|
12
|
-
output_file.should exist
|
17
|
+
@output_file.should exist
|
13
18
|
end
|
14
19
|
|
15
20
|
it "does not include input directory without parents" do
|
16
|
-
zip.entries.map(&:name).should_not include(add_trailing_slash input_dir.basename)
|
21
|
+
@zip.entries.map(&:name).should_not include(add_trailing_slash input_dir.basename)
|
17
22
|
end
|
18
23
|
|
19
24
|
relative_input_paths(input_dir).each do |path|
|
20
25
|
it "includes all children of input directory" do
|
21
|
-
zip.entries.map(&:name).should include(path)
|
26
|
+
@zip.entries.map(&:name).should include(path)
|
22
27
|
end
|
23
28
|
end
|
24
29
|
end
|
data/spec/zip/directory_spec.rb
CHANGED
@@ -8,23 +8,29 @@ describe Furoshiki::Zip::Directory do
|
|
8
8
|
context "output file" do
|
9
9
|
include_context 'zip'
|
10
10
|
|
11
|
+
before :all do
|
12
|
+
zip_directory = Furoshiki::Zip::Directory.new input_dir, @output_file
|
13
|
+
zip_directory.write
|
14
|
+
@zip = Zip::ZipFile.open @output_file
|
15
|
+
end
|
16
|
+
|
11
17
|
it "exists" do
|
12
|
-
output_file.should exist
|
18
|
+
@output_file.should exist
|
13
19
|
end
|
14
20
|
|
15
21
|
it "includes input directory without parents" do
|
16
|
-
zip.entries.map(&:name).should include(add_trailing_slash input_dir.basename)
|
22
|
+
@zip.entries.map(&:name).should include(add_trailing_slash input_dir.basename)
|
17
23
|
end
|
18
24
|
|
19
25
|
relative_input_paths(input_dir.parent).each do |path|
|
20
26
|
it "includes all children of input directory" do
|
21
|
-
zip.entries.map(&:name).should include(path)
|
27
|
+
@zip.entries.map(&:name).should include(path)
|
22
28
|
end
|
23
29
|
end
|
24
30
|
|
25
31
|
it "doesn't include extra files" do
|
26
32
|
number_of_files = Dir.glob("#{input_dir}/**/*").push(input_dir).length
|
27
|
-
zip.entries.length.should eq(number_of_files)
|
33
|
+
@zip.entries.length.should eq(number_of_files)
|
28
34
|
end
|
29
35
|
end
|
30
36
|
end
|
metadata
CHANGED
@@ -1,45 +1,113 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: furoshiki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.1
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Steve Klabnik
|
8
|
-
autorequire:
|
9
|
+
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-
|
12
|
+
date: 2013-09-27 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: warbler
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
none: false
|
15
22
|
requirement: !ruby/object:Gem::Requirement
|
16
23
|
requirements:
|
17
24
|
- - '>='
|
18
25
|
- !ruby/object:Gem::Version
|
19
26
|
version: '0'
|
20
|
-
|
27
|
+
none: false
|
21
28
|
prerelease: false
|
29
|
+
type: :runtime
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: plist
|
22
32
|
version_requirements: !ruby/object:Gem::Requirement
|
23
33
|
requirements:
|
24
34
|
- - '>='
|
25
35
|
- !ruby/object:Gem::Version
|
26
36
|
version: '0'
|
37
|
+
none: false
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
none: false
|
44
|
+
prerelease: false
|
45
|
+
type: :runtime
|
27
46
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
47
|
+
name: shoes
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
none: false
|
29
54
|
requirement: !ruby/object:Gem::Requirement
|
30
55
|
requirements:
|
31
56
|
- - '>='
|
32
57
|
- !ruby/object:Gem::Version
|
33
58
|
version: '0'
|
59
|
+
none: false
|
60
|
+
prerelease: false
|
34
61
|
type: :runtime
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rubyzip
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - <
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.0.0
|
69
|
+
none: false
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - <
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 1.0.0
|
75
|
+
none: false
|
35
76
|
prerelease: false
|
77
|
+
type: :runtime
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rake
|
36
80
|
version_requirements: !ruby/object:Gem::Requirement
|
37
81
|
requirements:
|
38
82
|
- - '>='
|
39
83
|
- !ruby/object:Gem::Version
|
40
84
|
version: '0'
|
41
|
-
|
42
|
-
|
85
|
+
none: false
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
none: false
|
92
|
+
prerelease: false
|
93
|
+
type: :development
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rspec
|
96
|
+
version_requirements: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
none: false
|
102
|
+
requirement: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
none: false
|
108
|
+
prerelease: false
|
109
|
+
type: :development
|
110
|
+
description: Create .app, .exe, and $LINUX_PACKAGE versions of your application, with its own embedded Ruby.
|
43
111
|
email: steve@steveklabnik.com
|
44
112
|
executables: []
|
45
113
|
extensions: []
|
@@ -47,6 +115,9 @@ extra_rdoc_files: []
|
|
47
115
|
files:
|
48
116
|
- .gitignore
|
49
117
|
- .rspec
|
118
|
+
- .ruby-gemset
|
119
|
+
- .ruby-version
|
120
|
+
- .travis.yml
|
50
121
|
- Gemfile
|
51
122
|
- LICENSE
|
52
123
|
- README.rdoc
|
@@ -87,8 +158,7 @@ files:
|
|
87
158
|
- vendor/appbundler-1.0.jar
|
88
159
|
homepage: http://github.com/steveklabnik/furoshiki
|
89
160
|
licenses: []
|
90
|
-
|
91
|
-
post_install_message:
|
161
|
+
post_install_message:
|
92
162
|
rdoc_options: []
|
93
163
|
require_paths:
|
94
164
|
- lib
|
@@ -97,35 +167,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
167
|
- - '>='
|
98
168
|
- !ruby/object:Gem::Version
|
99
169
|
version: '0'
|
170
|
+
segments:
|
171
|
+
- 0
|
172
|
+
hash: 2
|
173
|
+
none: false
|
100
174
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
175
|
requirements:
|
102
176
|
- - '>='
|
103
177
|
- !ruby/object:Gem::Version
|
104
178
|
version: '0'
|
179
|
+
segments:
|
180
|
+
- 0
|
181
|
+
hash: 2
|
182
|
+
none: false
|
105
183
|
requirements: []
|
106
|
-
rubyforge_project:
|
107
|
-
rubygems_version:
|
108
|
-
signing_key:
|
109
|
-
specification_version:
|
184
|
+
rubyforge_project:
|
185
|
+
rubygems_version: 1.8.24
|
186
|
+
signing_key:
|
187
|
+
specification_version: 3
|
110
188
|
summary: Package and distribute applications with Ruby.
|
111
|
-
test_files:
|
112
|
-
- spec/shoes/configuration_spec.rb
|
113
|
-
- spec/shoes/spec_helper.rb
|
114
|
-
- spec/shoes/support/shared_config.rb
|
115
|
-
- spec/shoes/swt_app_spec.rb
|
116
|
-
- spec/shoes/swt_jar_spec.rb
|
117
|
-
- spec/shoes/test_app/app.yaml
|
118
|
-
- spec/shoes/test_app/bin/hello_world
|
119
|
-
- spec/shoes/test_app/dir_to_ignore/file_to_ignore.txt
|
120
|
-
- spec/shoes/test_app/img/boots.icns
|
121
|
-
- spec/shoes/test_app/img/boots.ico
|
122
|
-
- spec/shoes/test_app/img/boots_512x512x32.png
|
123
|
-
- spec/shoes/test_app/sibling.rb
|
124
|
-
- spec/spec_helper.rb
|
125
|
-
- spec/support/shared_zip.rb
|
126
|
-
- spec/support/zip/a/a.rb
|
127
|
-
- spec/support/zip/a/b/b.png
|
128
|
-
- spec/support/zip/a/b/c/c.rb
|
129
|
-
- spec/zip/directory_contents_spec.rb
|
130
|
-
- spec/zip/directory_spec.rb
|
131
|
-
has_rdoc:
|
189
|
+
test_files: []
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: de386c74229b401a317c15d3c8ddb5e2b0af9ab4
|
4
|
-
data.tar.gz: 9c590ec9777006a102a182f6ee5586b5c2ce5c3b
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 0e8b5ab686470eb569929192edae4584c911edc8deac8c545d15780034b562e2d9a01fc6e37fa8d6863df07a895cb624cf0bc01ffa491aa58d68ea7cebce973e
|
7
|
-
data.tar.gz: 96eda86a72af8d7888eabc82863b748eca4aa673f6a51c3865522b6d6afb8295509f9d795f37d07cdf5202b6f7bc8adef80920aebeb3569c41991ec84d5ee0b3
|