eris 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/.gitignore +6 -0
  2. data/.rspec +2 -0
  3. data/.rvmrc +1 -0
  4. data/Gemfile +4 -0
  5. data/README.md +2 -0
  6. data/Rakefile +2 -0
  7. data/bin/eris +5 -0
  8. data/eris.gemspec +36 -0
  9. data/js_helpers/ErisHelpers.js +84 -0
  10. data/lib/eris.rb +22 -0
  11. data/lib/eris/eris.ru +3 -0
  12. data/lib/eris/lib/eris_config.rb +17 -0
  13. data/lib/eris/lib/jasmine_config_overrides.rb +43 -0
  14. data/lib/eris/lib/jasmine_rspec_runner.rb +34 -0
  15. data/lib/eris/lib/luna_request.rb +51 -0
  16. data/lib/eris/lib/proxied_request.rb +18 -0
  17. data/lib/eris/lib/server.rb +75 -0
  18. data/lib/eris/tasks/generate.rb +19 -0
  19. data/lib/eris/tasks/server.rb +14 -0
  20. data/lib/eris/templates/Gemfile +5 -0
  21. data/lib/eris/templates/Rakefile +32 -0
  22. data/lib/eris/templates/ci_build.sh +16 -0
  23. data/lib/eris/templates/eris_config.json +3 -0
  24. data/lib/eris/templates/jasmine.yml +77 -0
  25. data/lib/eris/templates/sampleSpec.js +13 -0
  26. data/lib/eris/templates/specHelper.js +3 -0
  27. data/lib/eris/version.rb +3 -0
  28. data/spec/fixtures/enyo/0.10/framework/enyo.js +1 -0
  29. data/spec/fixtures/sample_app/app/models/foo.js +1 -0
  30. data/spec/fixtures/sample_app/appinfo.json +10 -0
  31. data/spec/fixtures/sample_app/eris_config.json +3 -0
  32. data/spec/fixtures/sample_app/index.html.erb +20 -0
  33. data/spec/fixtures/sample_app/spec/acceptance/helpers/AppHelper.js +0 -0
  34. data/spec/fixtures/vcr_cassettes/failure.yml +34 -0
  35. data/spec/fixtures/vcr_cassettes/success.yml +62 -0
  36. data/spec/lib/eris/lib/eris_config_spec.rb +25 -0
  37. data/spec/lib/eris/lib/eris_spec.rb +7 -0
  38. data/spec/lib/eris/lib/luna_request_spec.rb +27 -0
  39. data/spec/lib/eris/lib/proxied_request_spec.rb +19 -0
  40. data/spec/lib/eris/lib/server_spec.rb +175 -0
  41. data/spec/lib/eris/tasks/generator_integration_spec.rb +38 -0
  42. data/spec/lib/eris/tasks/generator_spec.rb +90 -0
  43. data/spec/lib/eris/tasks/server_spec.rb +44 -0
  44. data/spec/spec_helper.rb +41 -0
  45. metadata +309 -0
@@ -0,0 +1,38 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+
3
+ describe Eris do
4
+ before :each do
5
+ @tmp_dir = "/tmp/eris-test/"
6
+ FileUtils.rm_r @tmp_dir if File.exists?(@tmp_dir)
7
+ FileUtils.mkdir_p @tmp_dir
8
+
9
+ @thor = Thor.new
10
+ end
11
+
12
+ describe "generate command" do
13
+ before :each do
14
+ # capture_output do
15
+ Dir.chdir @tmp_dir do
16
+ @thor.invoke Eris::Tasks, "generate"
17
+ end
18
+ # end
19
+ end
20
+
21
+ it "should run jasmine:ci" do
22
+ Bundler.with_clean_env do
23
+ gem_dir = File.expand_path('../../../../', File.dirname(__FILE__))
24
+ sleep 5
25
+ system! "cd #{gem_dir} && bundle exec rake build"
26
+ system! "mkdir -p #{@tmp_dir}/vendor/cache/"
27
+ system! "cp #{gem_dir}/pkg/eris-#{Eris::VERSION}.gem #{@tmp_dir}/vendor/cache/"
28
+ system "cd #{@tmp_dir} && rvm-exec ruby-1.9.2-p180@palm-test bash -c 'gem uninstall -aIx eris'"
29
+ system! "cd #{@tmp_dir} && rvm-exec ruby-1.9.2-p180@palm-test bash -c 'gem list | grep bundler || gem install bundler'"
30
+ system! "cd #{@tmp_dir} && rvm-exec ruby-1.9.2-p180@palm-test bash -c 'bundle install'"
31
+ system! "cd #{@tmp_dir} && rvm-exec ruby-1.9.2-p180@palm-test bash -c 'bundle exec gem list | grep eris'"
32
+ system! "cd #{@tmp_dir} && rvm-exec ruby-1.9.2-p180@palm-test bash -c 'bundle exec gem list | grep jasmine'"
33
+ system "cd #{@tmp_dir} && rvm-exec ruby-1.9.2-p180@palm-test bash -c 'bundle show jasmine'"
34
+ system("cd #{@tmp_dir} && rvm-exec ruby-1.9.2-p180@palm-test bash -c 'bundle exec rake jasmine:ci'").should be_true
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,90 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+
3
+ describe Eris do
4
+ before :each do
5
+ @tmp_dir = "/tmp/eris-test/"
6
+ FileUtils.rm_r @tmp_dir if File.exists?(@tmp_dir)
7
+ FileUtils.mkdir_p @tmp_dir
8
+
9
+ @thor = Thor.new
10
+ end
11
+
12
+ describe "generate command" do
13
+ before :each do
14
+ # capture_output do
15
+ Dir.chdir @tmp_dir do
16
+ @thor.invoke Eris::Tasks, "generate"
17
+ end
18
+ # end
19
+ end
20
+
21
+ it "should generate a Gemfile" do
22
+ Dir.chdir @tmp_dir do
23
+ gemfile_contents = File.read("Gemfile")
24
+ gemfile_contents.should include('source "http://rubygems.org"')
25
+ gemfile_contents.should include('gem "eris"')
26
+ end
27
+ end
28
+
29
+ it "should generate a Rakefile" do
30
+ Dir.chdir @tmp_dir do
31
+ rakefile_contents = File.read("Rakefile")
32
+ rakefile_contents.should include('namespace :jasmine do')
33
+ end
34
+ end
35
+
36
+ it "should generate a spec/unit/support/jasmine.yml" do
37
+ Dir.chdir @tmp_dir do
38
+ rakefile_contents = File.read("spec/unit/support/jasmine.yml")
39
+ rakefile_contents.should include('src_files:')
40
+ end
41
+ end
42
+
43
+ it "should generate a spec/unit/source/sampleSpec.js" do
44
+ Dir.chdir @tmp_dir do
45
+ rakefile_contents = File.read("spec/unit/source/sampleSpec.js")
46
+ rakefile_contents.should include('describe')
47
+ end
48
+ end
49
+
50
+ it "should generate a spec/unit/source/mock" do
51
+ Dir.chdir @tmp_dir do
52
+ File.exists?("spec/unit/source/mock").should be_true
53
+ end
54
+ end
55
+
56
+ it "should generate a spec/unit/specHelper.js" do
57
+ Dir.chdir @tmp_dir do
58
+ rakefile_contents = File.read("spec/unit/specHelper.js")
59
+ rakefile_contents.should include('getJson')
60
+ end
61
+ end
62
+
63
+ it "should generate a rvmrc" do
64
+ Dir.chdir @tmp_dir do
65
+ rakefile_contents = File.read(".rvmrc")
66
+ rakefile_contents.should include('rvm use ruby-1.9.2-p180@palm')
67
+ end
68
+ end
69
+
70
+ it "should generate a ci_build.sh" do
71
+ Dir.chdir @tmp_dir do
72
+ rakefile_contents = File.read("ci_build.sh")
73
+ rakefile_contents.should include('bundle exec rake jasmine:ci')
74
+ end
75
+ end
76
+
77
+ it "ci_build.sh should be executable" do
78
+ Dir.chdir @tmp_dir do
79
+ File.executable?("ci_build.sh").should be_true
80
+ end
81
+ end
82
+
83
+ it "should generate a eris_config.json" do
84
+ Dir.chdir @tmp_dir do
85
+ contents = File.read("eris_config.json")
86
+ contents.should include('enyoRoot')
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eris, "`server`" do
4
+
5
+ describe "(with defaults)" do
6
+ before :each do
7
+ @server_pid = fork do
8
+ sample_app_dir = File.join(File.dirname(__FILE__), '..', '..', '..', 'fixtures', 'sample_app/')
9
+ Dir.chdir sample_app_dir do
10
+ exec("eris server")
11
+ end
12
+ end
13
+ sleep 3
14
+ end
15
+
16
+ it "should start the Eris server on the default port" do
17
+ `curl -s http://localhost:9999/`.should match("<html>")
18
+ end
19
+ end
20
+
21
+ describe "(with optional port)" do
22
+ let :port do
23
+ '6578'
24
+ end
25
+
26
+ before :each do
27
+ @server_pid = fork do
28
+ sample_app_dir = File.join(File.dirname(__FILE__), '..', '..', '..', 'fixtures', 'sample_app/')
29
+ Dir.chdir sample_app_dir do
30
+ exec("eris server --port=#{port}")
31
+ end
32
+ end
33
+ sleep 2
34
+ end
35
+
36
+ it "should start the Eris server on the requested port" do
37
+ `curl -s http://localhost:#{port}/`.should match("<html>")
38
+ end
39
+ end
40
+
41
+ after :each do
42
+ Process.kill 9, @server_pid
43
+ end
44
+ end
@@ -0,0 +1,41 @@
1
+ require 'bundler/setup'
2
+
3
+ require 'rack/test'
4
+ require 'nokogiri'
5
+ require 'uri'
6
+
7
+ require 'vcr'
8
+ require 'rspec'
9
+
10
+ require 'eris'
11
+
12
+ VCR.config do |c|
13
+ c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
14
+ c.stub_with :webmock
15
+ end
16
+
17
+ RSpec.configure do |c|
18
+ c.extend VCR::RSpec::Macros
19
+ end
20
+
21
+ #tmp_dir = "#{Dir.tmpdir}/eris"
22
+ #FileUtils.rm_rf tmp_dir
23
+ #FileUtils.mkdir_p tmp_dir
24
+ #Dir.chdir(tmp_dir)
25
+
26
+ #def app
27
+ # Eris::Server.new("/tmp")
28
+ #end
29
+
30
+ def capture_output
31
+ output = StringIO.new
32
+ $stdout = output
33
+ yield
34
+ output.string
35
+ ensure
36
+ $stdout = STDOUT
37
+ end
38
+
39
+ def system!(command)
40
+ system(command) || raise("Failed: #{command}")
41
+ end
metadata ADDED
@@ -0,0 +1,309 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: eris
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - HP webOS
14
+ - Pivotal Labs
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2011-07-21 00:00:00 -07:00
20
+ default_executable:
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: rack
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 0
33
+ version: "0"
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: json
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ type: :runtime
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: sinatra
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ type: :runtime
63
+ version_requirements: *id003
64
+ - !ruby/object:Gem::Dependency
65
+ name: erubis
66
+ prerelease: false
67
+ requirement: &id004 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ type: :runtime
77
+ version_requirements: *id004
78
+ - !ruby/object:Gem::Dependency
79
+ name: thor
80
+ prerelease: false
81
+ requirement: &id005 !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ hash: 3
87
+ segments:
88
+ - 0
89
+ version: "0"
90
+ type: :runtime
91
+ version_requirements: *id005
92
+ - !ruby/object:Gem::Dependency
93
+ name: curb
94
+ prerelease: false
95
+ requirement: &id006 !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ hash: 3
101
+ segments:
102
+ - 0
103
+ version: "0"
104
+ type: :runtime
105
+ version_requirements: *id006
106
+ - !ruby/object:Gem::Dependency
107
+ name: rspec
108
+ prerelease: false
109
+ requirement: &id007 !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ hash: 3
115
+ segments:
116
+ - 0
117
+ version: "0"
118
+ type: :development
119
+ version_requirements: *id007
120
+ - !ruby/object:Gem::Dependency
121
+ name: rack-test
122
+ prerelease: false
123
+ requirement: &id008 !ruby/object:Gem::Requirement
124
+ none: false
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ hash: 3
129
+ segments:
130
+ - 0
131
+ version: "0"
132
+ type: :development
133
+ version_requirements: *id008
134
+ - !ruby/object:Gem::Dependency
135
+ name: fuubar
136
+ prerelease: false
137
+ requirement: &id009 !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ hash: 3
143
+ segments:
144
+ - 0
145
+ version: "0"
146
+ type: :development
147
+ version_requirements: *id009
148
+ - !ruby/object:Gem::Dependency
149
+ name: nokogiri
150
+ prerelease: false
151
+ requirement: &id010 !ruby/object:Gem::Requirement
152
+ none: false
153
+ requirements:
154
+ - - ">="
155
+ - !ruby/object:Gem::Version
156
+ hash: 3
157
+ segments:
158
+ - 0
159
+ version: "0"
160
+ type: :development
161
+ version_requirements: *id010
162
+ - !ruby/object:Gem::Dependency
163
+ name: vcr
164
+ prerelease: false
165
+ requirement: &id011 !ruby/object:Gem::Requirement
166
+ none: false
167
+ requirements:
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ hash: 3
171
+ segments:
172
+ - 0
173
+ version: "0"
174
+ type: :development
175
+ version_requirements: *id011
176
+ - !ruby/object:Gem::Dependency
177
+ name: webmock
178
+ prerelease: false
179
+ requirement: &id012 !ruby/object:Gem::Requirement
180
+ none: false
181
+ requirements:
182
+ - - ">="
183
+ - !ruby/object:Gem::Version
184
+ hash: 3
185
+ segments:
186
+ - 0
187
+ version: "0"
188
+ type: :development
189
+ version_requirements: *id012
190
+ - !ruby/object:Gem::Dependency
191
+ name: rake
192
+ prerelease: false
193
+ requirement: &id013 !ruby/object:Gem::Requirement
194
+ none: false
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ hash: 3
199
+ segments:
200
+ - 0
201
+ version: "0"
202
+ type: :development
203
+ version_requirements: *id013
204
+ description: ""
205
+ email:
206
+ - pair@pivotallabs.com
207
+ executables:
208
+ - eris
209
+ extensions: []
210
+
211
+ extra_rdoc_files: []
212
+
213
+ files:
214
+ - .gitignore
215
+ - .rspec
216
+ - .rvmrc
217
+ - Gemfile
218
+ - README.md
219
+ - Rakefile
220
+ - bin/eris
221
+ - eris.gemspec
222
+ - js_helpers/ErisHelpers.js
223
+ - lib/eris.rb
224
+ - lib/eris/eris.ru
225
+ - lib/eris/lib/eris_config.rb
226
+ - lib/eris/lib/jasmine_config_overrides.rb
227
+ - lib/eris/lib/jasmine_rspec_runner.rb
228
+ - lib/eris/lib/luna_request.rb
229
+ - lib/eris/lib/proxied_request.rb
230
+ - lib/eris/lib/server.rb
231
+ - lib/eris/tasks/generate.rb
232
+ - lib/eris/tasks/server.rb
233
+ - lib/eris/templates/Gemfile
234
+ - lib/eris/templates/Rakefile
235
+ - lib/eris/templates/ci_build.sh
236
+ - lib/eris/templates/eris_config.json
237
+ - lib/eris/templates/jasmine.yml
238
+ - lib/eris/templates/sampleSpec.js
239
+ - lib/eris/templates/specHelper.js
240
+ - lib/eris/version.rb
241
+ - spec/fixtures/enyo/0.10/framework/enyo.js
242
+ - spec/fixtures/sample_app/app/models/foo.js
243
+ - spec/fixtures/sample_app/appinfo.json
244
+ - spec/fixtures/sample_app/eris_config.json
245
+ - spec/fixtures/sample_app/index.html.erb
246
+ - spec/fixtures/sample_app/spec/acceptance/helpers/AppHelper.js
247
+ - spec/fixtures/vcr_cassettes/failure.yml
248
+ - spec/fixtures/vcr_cassettes/success.yml
249
+ - spec/lib/eris/lib/eris_config_spec.rb
250
+ - spec/lib/eris/lib/eris_spec.rb
251
+ - spec/lib/eris/lib/luna_request_spec.rb
252
+ - spec/lib/eris/lib/proxied_request_spec.rb
253
+ - spec/lib/eris/lib/server_spec.rb
254
+ - spec/lib/eris/tasks/generator_integration_spec.rb
255
+ - spec/lib/eris/tasks/generator_spec.rb
256
+ - spec/lib/eris/tasks/server_spec.rb
257
+ - spec/spec_helper.rb
258
+ has_rdoc: true
259
+ homepage: ""
260
+ licenses: []
261
+
262
+ post_install_message:
263
+ rdoc_options: []
264
+
265
+ require_paths:
266
+ - lib
267
+ required_ruby_version: !ruby/object:Gem::Requirement
268
+ none: false
269
+ requirements:
270
+ - - ">="
271
+ - !ruby/object:Gem::Version
272
+ hash: 3
273
+ segments:
274
+ - 0
275
+ version: "0"
276
+ required_rubygems_version: !ruby/object:Gem::Requirement
277
+ none: false
278
+ requirements:
279
+ - - ">="
280
+ - !ruby/object:Gem::Version
281
+ hash: 3
282
+ segments:
283
+ - 0
284
+ version: "0"
285
+ requirements: []
286
+
287
+ rubyforge_project: eris
288
+ rubygems_version: 1.3.7
289
+ signing_key:
290
+ specification_version: 3
291
+ summary: Eris is a gem to help test driving webOS Enyo application development
292
+ test_files:
293
+ - spec/fixtures/enyo/0.10/framework/enyo.js
294
+ - spec/fixtures/sample_app/app/models/foo.js
295
+ - spec/fixtures/sample_app/appinfo.json
296
+ - spec/fixtures/sample_app/eris_config.json
297
+ - spec/fixtures/sample_app/index.html.erb
298
+ - spec/fixtures/sample_app/spec/acceptance/helpers/AppHelper.js
299
+ - spec/fixtures/vcr_cassettes/failure.yml
300
+ - spec/fixtures/vcr_cassettes/success.yml
301
+ - spec/lib/eris/lib/eris_config_spec.rb
302
+ - spec/lib/eris/lib/eris_spec.rb
303
+ - spec/lib/eris/lib/luna_request_spec.rb
304
+ - spec/lib/eris/lib/proxied_request_spec.rb
305
+ - spec/lib/eris/lib/server_spec.rb
306
+ - spec/lib/eris/tasks/generator_integration_spec.rb
307
+ - spec/lib/eris/tasks/generator_spec.rb
308
+ - spec/lib/eris/tasks/server_spec.rb
309
+ - spec/spec_helper.rb