exhaust 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 88982d0eb2e47849d63b0475cbb041e475f1e8d7
4
- data.tar.gz: c68b70468e49bcfb3fd081a64fc81fdbdad31e24
3
+ metadata.gz: e0da18cb1578cd0bfc7c4fe19bf2108a72a58783
4
+ data.tar.gz: 4ed1330abe5570e8a955bce30853a47f02085256
5
5
  SHA512:
6
- metadata.gz: 8db2488c5de3cc6746e043caf443638105d49f8d8293db05772d1c5a6808f3e768960f877b71febdc375532d8af77a3e0c906df5c41ffd3e655e2798fcb2d36d
7
- data.tar.gz: 77f86f5a4fce4efe2ea33e447838995d3592faaecad234b389ae347d81e17c94682f4073832a6cb36f65cebdd59b58251fbeb2b01f2cf4744ae4076aa2a689b7
6
+ metadata.gz: b79be856adcd71e211ee28391b7229d75bdb58f957b3f5dfdb7003f4cb382f264da1a09d947c2b22fa46142c4378dabb4fd12950581a84adc2fe3f194b347a9e
7
+ data.tar.gz: ef9dbcad7dca71a8037a88d5289803e812d2b44ec646cda2fa6f54a7985f82da6928aa47487733438eead877b60893fb998adb3e5880b50aa1f64f3ba671a86c
data/README.md CHANGED
@@ -20,7 +20,38 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- 1. Create a .exhaust.yml
23
+ 1. Exhaust sets an ENV variable. Tell Ember how to use it.
24
+
25
+ ```javascript
26
+ // config/environment.js
27
+ if (environment === 'development') {
28
+ // Set the ENV.API_HOST to the environment varibale.
29
+ // I like to set a default but it's all up to you.
30
+ ENV.API_HOST = (process.env.API_HOST || 'http://localhost:3000')
31
+ }
32
+ ```
33
+ If using Ember Data, set the host to whatever adapter
34
+
35
+ ```javascript
36
+ // app/adapters/application.js
37
+ import DS from 'ember-data';
38
+ import config from '../config/environment';
39
+
40
+ export default DS.RESTAdapter.extend({
41
+ host: config.API_HOST
42
+ });
43
+ ```
44
+
45
+ If using Ember.$ reference wherever needed.
46
+ ```javascript
47
+ import Ember from 'ember'
48
+ import config from '../config/environment';
49
+
50
+
51
+ Ember.$.getJSON(config.API_HOST + "/endpoint")
52
+ ```
53
+
54
+ 2. Create a .exhaust.yml
24
55
 
25
56
  ```yaml
26
57
  rails:
@@ -31,17 +62,21 @@ ember:
31
62
  port: 4201
32
63
  ```
33
64
 
34
- 2. Start the servers
65
+ 3. Start the servers
66
+
35
67
  ```ruby
36
68
  Exhaust.run!
37
69
  ```
38
70
 
39
- 3. Stop the servers
71
+ 4. Stop the servers
40
72
  ```ruby
41
73
  Exhaust.shutdown!
42
74
  ```
43
75
 
44
76
  ### Using with Cucumber
77
+
78
+ When used insided a rails app.
79
+
45
80
  ```ruby
46
81
  # Add to features/support/env.rb
47
82
  Exhaust.run!
@@ -49,11 +84,49 @@ at_exit { Exhaust.shutdown! }
49
84
 
50
85
  Capybara.configure do |config|
51
86
  config.run_server = false
87
+ // Use whatever driver you want
88
+ config.default_driver = :webkit
89
+ config.app_host = Exhaust.ember_host
90
+ end
91
+ ```
92
+
93
+ When seperatly from rails.
94
+
95
+ 1. Add your rails app Gemfile to your own
96
+
97
+ ```ruby
98
+ eval_gemfile File.join("/path/to/rails/Gemfile")
99
+ ```
100
+
101
+ 2. Do something like this in your features/support/env.rb
102
+
103
+ ```ruby
104
+ ENV['RAILS_ENV'] ||= 'test'
105
+ path_to_rails = "/path/to/rails"
106
+ require File.expand_path("#{path_to_rails}/config/environment")
107
+
108
+ require 'capybara/cucumber'
109
+ require 'database_cleaner'
110
+ require 'database_cleaner/cucumber'
111
+
112
+ DatabaseCleaner.strategy = :truncation
113
+
114
+ Around do |scenario, block|
115
+ DatabaseCleaner.cleaning(&block)
116
+ end
117
+
118
+ Exhaust.run!
119
+ at_exit { Exhaust.shutdown! }
120
+
121
+ Capybara.configure do |config|
122
+ // Use whatever driver you want
123
+ config.default_driver = :webkit
52
124
  config.app_host = Exhaust.ember_host
53
125
  end
54
126
  ```
55
127
 
56
128
  ### Using with Rspec
129
+
57
130
  ```ruby
58
131
  # Add to spec/spec_helper.rb
59
132
  Exhaust.run!
@@ -0,0 +1,6 @@
1
+ rails:
2
+ path: "../../spec/fixtures/rails_example"
3
+ port: 3001
4
+ ember:
5
+ path: "../../spec/fixtures/ember-example"
6
+ port: 4201
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # TODO: Have to hardcode full path?
4
+ eval_gemfile "/Users/mwoods/hashrocket/exhaust/spec/fixtures/rails_example/Gemfile"
5
+
6
+ gem 'exhaust', path: "../../../exhaust"
7
+ gem 'cucumber'
8
+ gem 'capybara-webkit'
9
+ gem 'database_cleaner'
10
+ gem 'pry'
@@ -0,0 +1,173 @@
1
+ PATH
2
+ remote: ~/hashrocket/exhaust
3
+ specs:
4
+ exhaust (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actionmailer (4.2.3)
10
+ actionpack (= 4.2.3)
11
+ actionview (= 4.2.3)
12
+ activejob (= 4.2.3)
13
+ mail (~> 2.5, >= 2.5.4)
14
+ rails-dom-testing (~> 1.0, >= 1.0.5)
15
+ actionpack (4.2.3)
16
+ actionview (= 4.2.3)
17
+ activesupport (= 4.2.3)
18
+ rack (~> 1.6)
19
+ rack-test (~> 0.6.2)
20
+ rails-dom-testing (~> 1.0, >= 1.0.5)
21
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
22
+ actionview (4.2.3)
23
+ activesupport (= 4.2.3)
24
+ builder (~> 3.1)
25
+ erubis (~> 2.7.0)
26
+ rails-dom-testing (~> 1.0, >= 1.0.5)
27
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
+ active_model_serializers (0.9.3)
29
+ activemodel (>= 3.2)
30
+ activejob (4.2.3)
31
+ activesupport (= 4.2.3)
32
+ globalid (>= 0.3.0)
33
+ activemodel (4.2.3)
34
+ activesupport (= 4.2.3)
35
+ builder (~> 3.1)
36
+ activerecord (4.2.3)
37
+ activemodel (= 4.2.3)
38
+ activesupport (= 4.2.3)
39
+ arel (~> 6.0)
40
+ activesupport (4.2.3)
41
+ i18n (~> 0.7)
42
+ json (~> 1.7, >= 1.7.7)
43
+ minitest (~> 5.1)
44
+ thread_safe (~> 0.3, >= 0.3.4)
45
+ tzinfo (~> 1.1)
46
+ arel (6.0.3)
47
+ builder (3.2.2)
48
+ capybara (2.4.4)
49
+ mime-types (>= 1.16)
50
+ nokogiri (>= 1.3.3)
51
+ rack (>= 1.0.0)
52
+ rack-test (>= 0.5.4)
53
+ xpath (~> 2.0)
54
+ capybara-webkit (1.6.0)
55
+ capybara (>= 2.3.0, < 2.5.0)
56
+ json
57
+ coderay (1.1.0)
58
+ cucumber (1.3.20)
59
+ builder (>= 2.1.2)
60
+ diff-lcs (>= 1.1.3)
61
+ gherkin (~> 2.12)
62
+ multi_json (>= 1.7.5, < 2.0)
63
+ multi_test (>= 0.1.2)
64
+ cucumber-rails (1.4.2)
65
+ capybara (>= 1.1.2, < 3)
66
+ cucumber (>= 1.3.8, < 2)
67
+ mime-types (>= 1.16, < 3)
68
+ nokogiri (~> 1.5)
69
+ rails (>= 3, < 5)
70
+ database_cleaner (1.4.1)
71
+ diff-lcs (1.2.5)
72
+ erubis (2.7.0)
73
+ gherkin (2.12.2)
74
+ multi_json (~> 1.3)
75
+ globalid (0.3.6)
76
+ activesupport (>= 4.1.0)
77
+ i18n (0.7.0)
78
+ json (1.8.3)
79
+ loofah (2.0.3)
80
+ nokogiri (>= 1.5.9)
81
+ mail (2.6.3)
82
+ mime-types (>= 1.16, < 3)
83
+ method_source (0.8.2)
84
+ mime-types (2.6.1)
85
+ mini_portile (0.6.2)
86
+ minitest (5.8.0)
87
+ multi_json (1.11.2)
88
+ multi_test (0.1.2)
89
+ nokogiri (1.6.6.2)
90
+ mini_portile (~> 0.6.0)
91
+ pry (0.10.1)
92
+ coderay (~> 1.1.0)
93
+ method_source (~> 0.8.1)
94
+ slop (~> 3.4)
95
+ rack (1.6.4)
96
+ rack-cors (0.4.0)
97
+ rack-test (0.6.3)
98
+ rack (>= 1.0)
99
+ rails (4.2.3)
100
+ actionmailer (= 4.2.3)
101
+ actionpack (= 4.2.3)
102
+ actionview (= 4.2.3)
103
+ activejob (= 4.2.3)
104
+ activemodel (= 4.2.3)
105
+ activerecord (= 4.2.3)
106
+ activesupport (= 4.2.3)
107
+ bundler (>= 1.3.0, < 2.0)
108
+ railties (= 4.2.3)
109
+ sprockets-rails
110
+ rails-deprecated_sanitizer (1.0.3)
111
+ activesupport (>= 4.2.0.alpha)
112
+ rails-dom-testing (1.0.7)
113
+ activesupport (>= 4.2.0.beta, < 5.0)
114
+ nokogiri (~> 1.6.0)
115
+ rails-deprecated_sanitizer (>= 1.0.1)
116
+ rails-html-sanitizer (1.0.2)
117
+ loofah (~> 2.0)
118
+ railties (4.2.3)
119
+ actionpack (= 4.2.3)
120
+ activesupport (= 4.2.3)
121
+ rake (>= 0.8.7)
122
+ thor (>= 0.18.1, < 2.0)
123
+ rake (10.4.2)
124
+ rspec-core (3.3.2)
125
+ rspec-support (~> 3.3.0)
126
+ rspec-expectations (3.3.1)
127
+ diff-lcs (>= 1.2.0, < 2.0)
128
+ rspec-support (~> 3.3.0)
129
+ rspec-mocks (3.3.2)
130
+ diff-lcs (>= 1.2.0, < 2.0)
131
+ rspec-support (~> 3.3.0)
132
+ rspec-rails (3.3.3)
133
+ actionpack (>= 3.0, < 4.3)
134
+ activesupport (>= 3.0, < 4.3)
135
+ railties (>= 3.0, < 4.3)
136
+ rspec-core (~> 3.3.0)
137
+ rspec-expectations (~> 3.3.0)
138
+ rspec-mocks (~> 3.3.0)
139
+ rspec-support (~> 3.3.0)
140
+ rspec-support (3.3.0)
141
+ slop (3.6.0)
142
+ sprockets (3.3.3)
143
+ rack (~> 1.0)
144
+ sprockets-rails (2.3.2)
145
+ actionpack (>= 3.0)
146
+ activesupport (>= 3.0)
147
+ sprockets (>= 2.8, < 4.0)
148
+ sqlite3 (1.3.10)
149
+ thor (0.19.1)
150
+ thread_safe (0.3.5)
151
+ tzinfo (1.2.2)
152
+ thread_safe (~> 0.1)
153
+ xpath (2.0.0)
154
+ nokogiri (~> 1.3)
155
+
156
+ PLATFORMS
157
+ ruby
158
+
159
+ DEPENDENCIES
160
+ active_model_serializers
161
+ capybara-webkit
162
+ cucumber
163
+ cucumber-rails
164
+ database_cleaner
165
+ exhaust!
166
+ pry
167
+ rack-cors
168
+ rails (= 4.2.3)
169
+ rspec-rails
170
+ sqlite3
171
+
172
+ BUNDLED WITH
173
+ 1.10.6
@@ -0,0 +1,18 @@
1
+ Given(/^(\d+) todos$/) do |num|
2
+ num = num.to_i
3
+ num.times do |i|
4
+ Todo.create(title: "Title #{i}")
5
+ end
6
+ end
7
+
8
+ When(/^I visit "(.*?)"$/) do |path|
9
+ visit path
10
+ end
11
+
12
+ Then(/^I should see "(.*?)"$/) do |text|
13
+ expect(page).to have_text(text)
14
+ end
15
+
16
+ Then(/^I see (\d+) todos$/) do |num|
17
+ expect(all(".todo-item").length).to eq num.to_i
18
+ end
@@ -0,0 +1,22 @@
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+ path_to_rails = "../../spec/fixtures/rails_example"
3
+ require File.expand_path("#{path_to_rails}/config/environment")
4
+
5
+ require 'capybara/cucumber'
6
+
7
+ begin
8
+ require 'database_cleaner'
9
+ require 'database_cleaner/cucumber'
10
+
11
+ DatabaseCleaner.strategy = :truncation
12
+ rescue NameError
13
+ raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
14
+ end
15
+
16
+ Exhaust.run!
17
+ at_exit { Exhaust.shutdown! }
18
+
19
+ Capybara.configure do |config|
20
+ config.default_driver = :webkit
21
+ config.app_host = Exhaust.ember_host
22
+ end
@@ -0,0 +1,9 @@
1
+ Feature: Todos
2
+ When a user visits "/todos", they should see all todos
3
+
4
+ Scenario: User views todos
5
+ Given 4 todos
6
+ When I visit "/todos"
7
+ Then I should see "Todo List"
8
+ And I see 4 todos
9
+
data/lib/exhaust.rb CHANGED
@@ -1,4 +1,6 @@
1
- Dir[Dir.pwd + "/lib/exhaust/**/*.rb"].each { |f| require f }
1
+ require 'exhaust/configuration'
2
+ require 'exhaust/runner'
3
+ require 'exhaust/version'
2
4
 
3
5
  module Exhaust
4
6
  def self.run!
@@ -13,7 +15,7 @@ module Exhaust
13
15
  runner.ember_host
14
16
  end
15
17
 
16
- def shutdown!
18
+ def self.shutdown!
17
19
  runner.shutdown!
18
20
  end
19
21
  end
@@ -7,15 +7,18 @@ module Exhaust
7
7
  end
8
8
 
9
9
  def run
10
- while running = ember_server.gets
11
- if running =~ /build successful/i
12
- break
10
+ Timeout::timeout(30) do
11
+ while running = ember_server.gets
12
+ if running =~ /build successful/i
13
+ break
14
+ end
13
15
  end
14
- end
15
16
 
16
- while running = rails_server.gets
17
- if running =~ /info/i
18
- break
17
+ while running = rails_server.gets
18
+ puts running
19
+ if running =~ /info/i
20
+ break
21
+ end
19
22
  end
20
23
  end
21
24
  end
@@ -43,7 +46,7 @@ module Exhaust
43
46
  def ember_server
44
47
  @ember_server ||= begin
45
48
  Dir.chdir(ember_path) do
46
- @ember_server = IO.popen([{"API_HOST" => "http://localhost:3001"}, "ember", "server", "--port", ember_port, "--live-reload", "false", :err => [:child, :out]])
49
+ @ember_server = IO.popen([{"API_HOST" => "http://localhost:#{rails_port}"}, "ember", "server", "--port", ember_port, "--live-reload", "false", :err => [:child, :out]])
47
50
  end
48
51
  end
49
52
  end
@@ -1,3 +1,3 @@
1
1
  module Exhaust
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exhaust
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Woods
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-25 00:00:00.000000000 Z
11
+ date: 2015-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -84,6 +84,12 @@ files:
84
84
  - Rakefile
85
85
  - bin/console
86
86
  - bin/setup
87
+ - examples/cucumber/.exhaust.yml
88
+ - examples/cucumber/Gemfile
89
+ - examples/cucumber/Gemfile.lock
90
+ - examples/cucumber/features/step_definitions/todos_steps.rb
91
+ - examples/cucumber/features/support/env.rb
92
+ - examples/cucumber/features/todos.feature
87
93
  - exhaust.gemspec
88
94
  - lib/exhaust.rb
89
95
  - lib/exhaust/configuration.rb
@@ -109,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
115
  version: '0'
110
116
  requirements: []
111
117
  rubyforge_project:
112
- rubygems_version: 2.4.6
118
+ rubygems_version: 2.4.5.1
113
119
  signing_key:
114
120
  specification_version: 4
115
121
  summary: Exhaust makes smoke testing a Ember/Rails stack easy.