hopskip 0.1.3 → 0.2.0

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.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NmYxOTQ5NTIwN2Q3YjcxOTA5N2NmMGRlYjg1MWQ4OTlhNjk3ZTc3MA==
5
+ data.tar.gz: !binary |-
6
+ MThjZTNlODE0YzkyMjk1MTlhMDAxODY5ZWMxMjNkZTczNzBiMWMwYw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ODY1NjFlZjRiYmIyMGEzZGM0M2E0M2Y0NDMzM2Y5NjRhZTZkMGZjZTY3YWFh
10
+ MDRiODA5MTgwYmE3OWNkMzc1NjJmYWIyZmFhN2Y2MjliMjAzOTVkMDdlNWY5
11
+ Mjc1YTRjNzNkNzgyMDZiZjAzODY5MDRhY2U1MWM3ODA2NDgyNDY=
12
+ data.tar.gz: !binary |-
13
+ YjM2ZTQ5Yjk2MTc3MDZmOTFlOGY1MGE4YzA5ZjNlMWZhNjRjMjEzZGNkYjc1
14
+ NDYxMzM0YTJjMDI3NTU5OGZiMGIyMTA2M2ZmOTA2NTM2MDBkNWRlOGFjNzhj
15
+ N2U0MDM2NjRiZjkyNDZjMmMxMzBmZDYzYWI1Njg5NzY5ZDA5MmY=
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Hopskip
2
2
 
3
- [![Code Climate](https://codeclimate.com/github/boxuk/hopskip.png)](https://codeclimate.com/github/boxuk/hopskip)
4
- [![Build Status](https://travis-ci.org/boxuk/hopskip.png?branch=master)](https://travis-ci.org/boxuk/hopskip)
5
- [![Coverage Status](https://coveralls.io/repos/boxuk/hopskip/badge.png?branch=master)](https://coveralls.io/r/boxuk/hopskip?branch=master)
3
+ | Version | Status | Quality | Coverage |
4
+ |:--------:|:------------:|:-----:|:-----:|
5
+ | [![Gem Version](https://badge.fury.io/rb/hopskip.png)](http://badge.fury.io/rb/hopskip) | [![Build Status](https://travis-ci.org/boxuk/hopskip.png?branch=master)](https://travis-ci.org/boxuk/hopskip) | [![Code Climate](https://codeclimate.com/github/boxuk/hopskip.png)](https://codeclimate.com/github/boxuk/hopskip) | [![Coverage Status](https://coveralls.io/repos/boxuk/hopskip/badge.png?branch=master)](https://coveralls.io/r/boxuk/hopskip?branch=master) |
6
6
 
7
7
  Write [hopscotch](https://github.com/linkedin/hopscotch) introductions simply by adding YAML files to your Rails application.
8
8
 
@@ -86,6 +86,11 @@ index:
86
86
 
87
87
  The `showError` helper will now be executed when next is clicked on the first step. You can pass as many helpers as you like to each callback methods.
88
88
 
89
+
90
+ ## Error Handling
91
+
92
+ If the YAML file is not correctly formatted, Hopskip will raise a `Hopskip::InvalidYAMLError` exception.
93
+
89
94
  ## We use Hopskip
90
95
 
91
96
  We use Hopskip in [FleetSuite](http://www.boxuk.com/fleetsuite/), a business management system offering a set of collaborative project management tools to optimise processes.
@@ -1,4 +1,7 @@
1
1
  module Hopskip
2
+
3
+ class Hopskip::InvalidYAMLError < StandardError; end
4
+
2
5
  class HopscotchParser
3
6
 
4
7
  require 'yaml'
@@ -9,6 +12,8 @@ module Hopskip
9
12
  def initialize(controller)
10
13
  @controller = controller
11
14
  filename = Rails.root.join('app', 'tours', "#{ @controller.controller_name }_tour.yml")
15
+ raise Hopskip::InvalidYAMLError unless valid_yaml_string?(File.open(filename).read)
16
+
12
17
  if File.exists?(filename)
13
18
  @yaml_source = YAML::load(File.open("#{ Rails.root }/app/tours/#{ @controller.controller_name }_tour.yml"))
14
19
  end
@@ -22,5 +27,13 @@ module Hopskip
22
27
  end
23
28
  end
24
29
 
30
+ private
31
+
32
+ def valid_yaml_string?(yaml)
33
+ !!YAML.load(yaml)
34
+ rescue Exception => e
35
+ return false
36
+ end
37
+
25
38
  end
26
39
  end
@@ -1,3 +1,3 @@
1
1
  module Hopskip
2
- VERSION = "0.1.3"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -0,0 +1,3 @@
1
+ class FailureController < ApplicationController
2
+
3
+ end
@@ -0,0 +1,7 @@
1
+ ---
2
+ index:
3
+ steps:
4
+ - title: Create A Person
5
+ content: "Click here to add your first person."
6
+ target- new_person_link
7
+ placement: left
@@ -1340,3 +1340,150 @@ Processing by PeopleController#show as HTML
1340
1340
  Parameters: {"id"=>"1"}
1341
1341
  Completed 200 OK in 3.0ms (Views: 2.7ms | ActiveRecord: 0.0ms)
1342
1342
   (0.1ms) rollback transaction
1343
+ Connecting to database specified by database.yml
1344
+  (0.4ms) begin transaction
1345
+  (0.1ms) rollback transaction
1346
+  (0.0ms) begin transaction
1347
+  (0.1ms) rollback transaction
1348
+  (0.0ms) begin transaction
1349
+  (0.0ms) rollback transaction
1350
+  (0.1ms) begin transaction
1351
+  (0.0ms) rollback transaction
1352
+  (0.1ms) begin transaction
1353
+ Started GET "/people" for 127.0.0.1 at 2013-12-20 13:59:03 +0000
1354
+ Processing by PeopleController#index as HTML
1355
+ Rendered people/index.html.erb within layouts/application (2.4ms)
1356
+ Completed 200 OK in 38.8ms (Views: 38.3ms | ActiveRecord: 0.0ms)
1357
+  (0.1ms) rollback transaction
1358
+  (0.0ms) begin transaction
1359
+ Started GET "/people/1" for 127.0.0.1 at 2013-12-20 13:59:03 +0000
1360
+ Processing by PeopleController#show as HTML
1361
+ Parameters: {"id"=>"1"}
1362
+ Completed 200 OK in 3.3ms (Views: 2.8ms | ActiveRecord: 0.0ms)
1363
+  (0.1ms) rollback transaction
1364
+ Connecting to database specified by database.yml
1365
+  (0.3ms) begin transaction
1366
+  (0.1ms) rollback transaction
1367
+  (0.0ms) begin transaction
1368
+  (0.0ms) rollback transaction
1369
+  (0.0ms) begin transaction
1370
+  (0.0ms) rollback transaction
1371
+  (0.0ms) begin transaction
1372
+  (0.0ms) rollback transaction
1373
+  (0.0ms) begin transaction
1374
+ Started GET "/people" for 127.0.0.1 at 2013-12-20 13:59:49 +0000
1375
+ Processing by PeopleController#index as HTML
1376
+ Rendered people/index.html.erb within layouts/application (2.3ms)
1377
+ Completed 200 OK in 19.2ms (Views: 18.6ms | ActiveRecord: 0.0ms)
1378
+  (0.1ms) rollback transaction
1379
+  (0.1ms) begin transaction
1380
+ Started GET "/people/1" for 127.0.0.1 at 2013-12-20 13:59:49 +0000
1381
+ Processing by PeopleController#show as HTML
1382
+ Parameters: {"id"=>"1"}
1383
+ Completed 200 OK in 3.1ms (Views: 2.7ms | ActiveRecord: 0.0ms)
1384
+  (0.1ms) rollback transaction
1385
+ Connecting to database specified by database.yml
1386
+  (0.3ms) begin transaction
1387
+  (0.0ms) rollback transaction
1388
+  (0.1ms) begin transaction
1389
+  (0.0ms) rollback transaction
1390
+  (0.1ms) begin transaction
1391
+  (0.0ms) rollback transaction
1392
+  (0.1ms) begin transaction
1393
+  (0.0ms) rollback transaction
1394
+  (0.1ms) begin transaction
1395
+ Started GET "/people" for 127.0.0.1 at 2013-12-20 14:02:08 +0000
1396
+ Processing by PeopleController#index as HTML
1397
+ Rendered people/index.html.erb within layouts/application (3.0ms)
1398
+ Completed 200 OK in 16.8ms (Views: 16.4ms | ActiveRecord: 0.0ms)
1399
+  (0.1ms) rollback transaction
1400
+  (0.1ms) begin transaction
1401
+ Started GET "/people/1" for 127.0.0.1 at 2013-12-20 14:02:08 +0000
1402
+ Processing by PeopleController#show as HTML
1403
+ Parameters: {"id"=>"1"}
1404
+ Completed 200 OK in 3.6ms (Views: 3.1ms | ActiveRecord: 0.0ms)
1405
+  (0.1ms) rollback transaction
1406
+ Connecting to database specified by database.yml
1407
+  (0.3ms) begin transaction
1408
+  (0.1ms) rollback transaction
1409
+  (0.1ms) begin transaction
1410
+  (0.0ms) rollback transaction
1411
+  (0.1ms) begin transaction
1412
+  (0.0ms) rollback transaction
1413
+  (0.1ms) begin transaction
1414
+  (0.1ms) rollback transaction
1415
+  (0.1ms) begin transaction
1416
+ Started GET "/people" for 127.0.0.1 at 2013-12-20 14:03:35 +0000
1417
+ Processing by PeopleController#index as HTML
1418
+ Rendered people/index.html.erb within layouts/application (2.0ms)
1419
+ Completed 200 OK in 16.1ms (Views: 15.3ms | ActiveRecord: 0.0ms)
1420
+  (0.1ms) rollback transaction
1421
+  (0.1ms) begin transaction
1422
+ Started GET "/people/1" for 127.0.0.1 at 2013-12-20 14:03:35 +0000
1423
+ Processing by PeopleController#show as HTML
1424
+ Parameters: {"id"=>"1"}
1425
+ Completed 200 OK in 3.5ms (Views: 3.1ms | ActiveRecord: 0.0ms)
1426
+  (0.1ms) rollback transaction
1427
+ Connecting to database specified by database.yml
1428
+  (0.4ms) begin transaction
1429
+  (0.1ms) rollback transaction
1430
+  (0.1ms) begin transaction
1431
+  (0.1ms) rollback transaction
1432
+  (0.1ms) begin transaction
1433
+  (0.1ms) rollback transaction
1434
+  (0.1ms) begin transaction
1435
+  (0.0ms) rollback transaction
1436
+  (0.1ms) begin transaction
1437
+ Started GET "/people" for 127.0.0.1 at 2013-12-20 14:03:47 +0000
1438
+ Processing by PeopleController#index as HTML
1439
+ Rendered people/index.html.erb within layouts/application (2.1ms)
1440
+ Completed 200 OK in 17.1ms (Views: 16.5ms | ActiveRecord: 0.0ms)
1441
+  (0.1ms) rollback transaction
1442
+  (0.0ms) begin transaction
1443
+ Started GET "/people/1" for 127.0.0.1 at 2013-12-20 14:03:47 +0000
1444
+ Processing by PeopleController#show as HTML
1445
+ Parameters: {"id"=>"1"}
1446
+ Completed 200 OK in 3.4ms (Views: 3.0ms | ActiveRecord: 0.0ms)
1447
+  (0.1ms) rollback transaction
1448
+ Connecting to database specified by database.yml
1449
+  (0.3ms) begin transaction
1450
+  (0.1ms) rollback transaction
1451
+  (0.1ms) begin transaction
1452
+  (0.0ms) rollback transaction
1453
+  (0.0ms) begin transaction
1454
+  (0.0ms) rollback transaction
1455
+  (0.0ms) begin transaction
1456
+  (0.0ms) rollback transaction
1457
+  (0.0ms) begin transaction
1458
+ Started GET "/people" for 127.0.0.1 at 2013-12-20 14:04:07 +0000
1459
+ Processing by PeopleController#index as HTML
1460
+ Rendered people/index.html.erb within layouts/application (3.7ms)
1461
+ Completed 200 OK in 20.9ms (Views: 20.4ms | ActiveRecord: 0.0ms)
1462
+  (0.1ms) rollback transaction
1463
+  (0.0ms) begin transaction
1464
+ Started GET "/people/1" for 127.0.0.1 at 2013-12-20 14:04:08 +0000
1465
+ Processing by PeopleController#show as HTML
1466
+ Parameters: {"id"=>"1"}
1467
+ Completed 200 OK in 3.7ms (Views: 3.2ms | ActiveRecord: 0.0ms)
1468
+  (0.1ms) rollback transaction
1469
+ Connecting to database specified by database.yml
1470
+  (0.3ms) begin transaction
1471
+  (0.1ms) rollback transaction
1472
+  (0.1ms) begin transaction
1473
+  (0.0ms) rollback transaction
1474
+  (0.0ms) begin transaction
1475
+  (0.0ms) rollback transaction
1476
+  (0.1ms) begin transaction
1477
+  (0.0ms) rollback transaction
1478
+  (0.0ms) begin transaction
1479
+ Started GET "/people" for 127.0.0.1 at 2013-12-20 14:04:23 +0000
1480
+ Processing by PeopleController#index as HTML
1481
+ Rendered people/index.html.erb within layouts/application (1.9ms)
1482
+ Completed 200 OK in 17.8ms (Views: 17.3ms | ActiveRecord: 0.0ms)
1483
+  (0.1ms) rollback transaction
1484
+  (0.0ms) begin transaction
1485
+ Started GET "/people/1" for 127.0.0.1 at 2013-12-20 14:04:23 +0000
1486
+ Processing by PeopleController#show as HTML
1487
+ Parameters: {"id"=>"1"}
1488
+ Completed 200 OK in 3.2ms (Views: 2.8ms | ActiveRecord: 0.0ms)
1489
+  (0.1ms) rollback transaction
@@ -11,4 +11,10 @@ class HopscotchParserTest < ActiveSupport::TestCase
11
11
  assert_nil a.show
12
12
  end
13
13
 
14
+ test '#invalid YAML should raise error' do
15
+ assert_raises Hopskip::InvalidYAMLError do
16
+ Hopskip::HopscotchParser.new(FailureController.new)
17
+ end
18
+ end
19
+
14
20
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hopskip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Max Woolf
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-12-11 00:00:00.000000000 Z
11
+ date: 2013-12-20 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: sqlite3
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: mysql2
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -80,10 +73,12 @@ files:
80
73
  - test/dummy/app/assets/stylesheets/application.css
81
74
  - test/dummy/app/assets/stylesheets/people.css
82
75
  - test/dummy/app/controllers/application_controller.rb
76
+ - test/dummy/app/controllers/failure_controller.rb
83
77
  - test/dummy/app/controllers/people_controller.rb
84
78
  - test/dummy/app/helpers/application_helper.rb
85
79
  - test/dummy/app/helpers/people_helper.rb
86
80
  - test/dummy/app/tours/application_tour.yml
81
+ - test/dummy/app/tours/failure_tour.yml
87
82
  - test/dummy/app/tours/people_tour.yml
88
83
  - test/dummy/app/views/layouts/application.html.erb
89
84
  - test/dummy/app/views/people/index.html.erb
@@ -123,33 +118,26 @@ files:
123
118
  - test/test_helper.rb
124
119
  homepage: http://boxuk.com
125
120
  licenses: []
121
+ metadata: {}
126
122
  post_install_message:
127
123
  rdoc_options: []
128
124
  require_paths:
129
125
  - lib
130
126
  required_ruby_version: !ruby/object:Gem::Requirement
131
- none: false
132
127
  requirements:
133
128
  - - ! '>='
134
129
  - !ruby/object:Gem::Version
135
130
  version: '0'
136
- segments:
137
- - 0
138
- hash: 1049451874999815942
139
131
  required_rubygems_version: !ruby/object:Gem::Requirement
140
- none: false
141
132
  requirements:
142
133
  - - ! '>='
143
134
  - !ruby/object:Gem::Version
144
135
  version: '0'
145
- segments:
146
- - 0
147
- hash: 1049451874999815942
148
136
  requirements: []
149
137
  rubyforge_project:
150
- rubygems_version: 1.8.25
138
+ rubygems_version: 2.1.11
151
139
  signing_key:
152
- specification_version: 3
140
+ specification_version: 4
153
141
  summary: Hopscotch introductions written more cleanly in YAML
154
142
  test_files:
155
143
  - test/dummy/app/assets/javascripts/application.js
@@ -157,10 +145,12 @@ test_files:
157
145
  - test/dummy/app/assets/stylesheets/application.css
158
146
  - test/dummy/app/assets/stylesheets/people.css
159
147
  - test/dummy/app/controllers/application_controller.rb
148
+ - test/dummy/app/controllers/failure_controller.rb
160
149
  - test/dummy/app/controllers/people_controller.rb
161
150
  - test/dummy/app/helpers/application_helper.rb
162
151
  - test/dummy/app/helpers/people_helper.rb
163
152
  - test/dummy/app/tours/application_tour.yml
153
+ - test/dummy/app/tours/failure_tour.yml
164
154
  - test/dummy/app/tours/people_tour.yml
165
155
  - test/dummy/app/views/layouts/application.html.erb
166
156
  - test/dummy/app/views/people/index.html.erb