hoboken 0.0.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +5 -5
  2. data/.github/dependabot.yml +7 -0
  3. data/.github/workflows/ruby.yml +28 -0
  4. data/.rubocop.yml +33 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile +2 -0
  7. data/IDEAS.md +57 -0
  8. data/LICENSE.txt +1 -1
  9. data/README.md +21 -10
  10. data/Rakefile +14 -6
  11. data/bin/hoboken +2 -1
  12. data/hoboken.gemspec +53 -16
  13. data/lib/hoboken.rb +110 -23
  14. data/lib/hoboken/actions.rb +10 -6
  15. data/lib/hoboken/add_ons/github_action.rb +14 -0
  16. data/lib/hoboken/add_ons/heroku.rb +8 -23
  17. data/lib/hoboken/add_ons/internationalization.rb +10 -6
  18. data/lib/hoboken/add_ons/metrics.rb +39 -14
  19. data/lib/hoboken/add_ons/omniauth.rb +114 -47
  20. data/lib/hoboken/add_ons/rubocop.rb +40 -0
  21. data/lib/hoboken/add_ons/sequel.rb +76 -47
  22. data/lib/hoboken/add_ons/sprockets.rb +67 -65
  23. data/lib/hoboken/add_ons/travis.rb +6 -2
  24. data/lib/hoboken/add_ons/twbs.rb +80 -0
  25. data/lib/hoboken/generate.rb +112 -38
  26. data/lib/hoboken/templates/Gemfile.erb.tt +33 -10
  27. data/lib/hoboken/templates/README.md.tt +105 -35
  28. data/lib/hoboken/templates/Rakefile.tt +10 -22
  29. data/lib/hoboken/templates/classic.rb.tt +35 -8
  30. data/lib/hoboken/templates/config.ru.tt +5 -3
  31. data/lib/hoboken/templates/console.sh +5 -0
  32. data/lib/hoboken/templates/db.rb.tt +24 -0
  33. data/lib/hoboken/templates/github_action.tt +28 -0
  34. data/lib/hoboken/templates/gitignore +8 -1
  35. data/lib/hoboken/templates/metrics.rake.tt +10 -9
  36. data/lib/hoboken/templates/modular.rb.tt +40 -11
  37. data/lib/hoboken/templates/puma.rb.tt +21 -0
  38. data/lib/hoboken/templates/rspec.rake.tt +5 -0
  39. data/lib/hoboken/templates/rubocop.yml.tt +31 -0
  40. data/lib/hoboken/templates/sequel.rake +6 -4
  41. data/lib/hoboken/templates/server.sh +12 -0
  42. data/lib/hoboken/templates/setup.sh +7 -0
  43. data/lib/hoboken/templates/spec/app_spec.rb.tt +15 -0
  44. data/lib/hoboken/templates/spec/rack_matchers.rb.tt +56 -0
  45. data/lib/hoboken/templates/spec/spec_helper.rb.tt +41 -0
  46. data/lib/hoboken/templates/sprockets.rake +13 -7
  47. data/lib/hoboken/templates/sprockets_chain.rb +7 -3
  48. data/lib/hoboken/templates/sprockets_helper.rb +14 -10
  49. data/lib/hoboken/templates/support/rack_helpers.rb.tt +55 -0
  50. data/lib/hoboken/templates/support/rack_test_assertions.rb.tt +111 -0
  51. data/lib/hoboken/templates/test/test_helper.rb.tt +38 -27
  52. data/lib/hoboken/templates/test/unit/app_test.rb.tt +11 -3
  53. data/lib/hoboken/templates/test_unit.rake.tt +18 -0
  54. data/lib/hoboken/templates/views/index.erb.tt +10 -3
  55. data/lib/hoboken/templates/views/layout.erb.tt +4 -1
  56. data/lib/hoboken/version.rb +3 -1
  57. data/test/fixtures/Gemfile +3 -3
  58. data/test/fixtures/Gemfile.pristine +3 -2
  59. data/test/integration/add_on_test.rb +399 -136
  60. data/test/integration/generate_test.rb +170 -38
  61. data/test/test_helper.rb +54 -23
  62. data/test/unit/hoboken_actions_test.rb +70 -61
  63. metadata +441 -16
  64. data/.travis.yml +0 -5
  65. data/lib/hoboken/templates/test/support/rack_test_assertions.rb.tt +0 -92
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.0.0
4
- - 2.1.0
5
- - 2.1.1
@@ -1,92 +0,0 @@
1
- module Rack::Test::Assertions
2
- RESPONSE_CODES = {
3
- :ok => 200,
4
- :not_authorized => 401,
5
- :not_found => 404,
6
- :redirect => 302
7
- }
8
-
9
- CONTENT_TYPES = {
10
- :json => "application/json;charset=utf-8",
11
- :html => "text/html;charset=utf-8"
12
- }
13
-
14
- def assert_body_contains(expected, message=nil)
15
- msg = build_message(message, "expected body to contain <?>\n#{last_response.body}", expected)
16
- assert_block(msg) do
17
- last_response.body.include?(expected)
18
- end
19
- end
20
-
21
- def assert_content_type(content_type)
22
- unless CONTENT_TYPES.keys.include?(content_type)
23
- raise ArgumentError, "unrecognized content_type (#{content_type})"
24
- end
25
-
26
- assert_equal CONTENT_TYPES[content_type], last_response.content_type
27
- end
28
-
29
- def assert_flash(type=:notice, message=nil)
30
- msg = build_message(message, "expected <?> flash to exist, but was nil", type.to_s)
31
- assert_block(msg) do
32
- last_request.env['rack.session']['flash']
33
- end
34
- end
35
-
36
- def assert_flash_message(expected, type=:notice, message=nil)
37
- assert_flash(type, message)
38
- flash = last_request.env['rack.session']['flash'][type.to_s]
39
- msg = build_message(message, "expected flash to be <?> but was <?>", expected, flash)
40
- assert_block(msg) do
41
- expected == flash
42
- end
43
- end
44
-
45
- def assert_has_session(message=nil)
46
- msg = build_message(message, "expected a valid session")
47
- assert_block(msg) do
48
- last_request.env["rack.session"]
49
- end
50
- end
51
-
52
- def assert_session_has_key(key, message=nil)
53
- assert_has_session
54
- msg = build_message(message, "expected session to have key named <?>", key)
55
- assert_block(msg) do
56
- last_request.env["rack.session"].keys.include?(key.to_s)
57
- end
58
- end
59
-
60
- def assert_session(key, expected, message=nil)
61
- assert_session_has_key(key)
62
- actual = last_request.env["rack.session"][key.to_s]
63
- msg = build_message(message, "expected session key <?> to be <?>, but was <?>", key, expected, actual)
64
- assert_block(msg) do
65
- expected == actual
66
- end
67
- end
68
-
69
- def assert_response(expected, message=nil)
70
- status = last_response.status
71
- msg = build_message(
72
- message,
73
- "expected last response to be <?> but was <?>",
74
- "#{RESPONSE_CODES[expected]}:#{expected}",
75
- "#{status}:#{RESPONSE_CODES.key(status)}"
76
- )
77
-
78
- assert_block(msg) do
79
- status == RESPONSE_CODES[expected]
80
- end
81
- end
82
-
83
- def assert_redirected_to(expected, msg=nil)
84
- assert_response(:redirect)
85
- actual = URI(last_response.location).path
86
- msg = build_message(message, "expected to be redirected to <?> but was <?>", expected, actual)
87
-
88
- assert_block(msg) do
89
- expected == actual
90
- end
91
- end
92
- end