hoboken 0.0.1.beta2 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +5 -5
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +33 -0
  3. data/.github/ISSUE_TEMPLATE/code_change.md +11 -0
  4. data/.github/PULL_REQUEST_TEMPLATE.md +25 -0
  5. data/.github/dependabot.yml +7 -0
  6. data/.github/workflows/ruby.yml +28 -0
  7. data/.gitignore +3 -0
  8. data/.rubocop.yml +41 -0
  9. data/.ruby-version +1 -0
  10. data/.tool-versions +1 -0
  11. data/CHANGELOG.md +131 -0
  12. data/CODE_OF_CONDUCT.md +8 -0
  13. data/CONTRIBUTING.md +16 -0
  14. data/Gemfile +2 -0
  15. data/IDEAS.md +57 -0
  16. data/LICENSE.txt +1 -1
  17. data/README.md +28 -17
  18. data/Rakefile +14 -8
  19. data/bin/hoboken +2 -1
  20. data/hoboken.gemspec +63 -16
  21. data/lib/hoboken/actions.rb +11 -6
  22. data/lib/hoboken/add_ons/active_record.rb +142 -0
  23. data/lib/hoboken/add_ons/airbrake.rb +64 -0
  24. data/lib/hoboken/add_ons/github_action.rb +14 -0
  25. data/lib/hoboken/add_ons/heroku.rb +29 -0
  26. data/lib/hoboken/add_ons/internationalization.rb +28 -0
  27. data/lib/hoboken/add_ons/metrics.rb +60 -0
  28. data/lib/hoboken/add_ons/omniauth.rb +174 -0
  29. data/lib/hoboken/add_ons/rubocop.rb +46 -0
  30. data/lib/hoboken/add_ons/sequel.rb +135 -0
  31. data/lib/hoboken/add_ons/sidekiq.rb +137 -0
  32. data/lib/hoboken/add_ons/travis.rb +15 -0
  33. data/lib/hoboken/add_ons/turnip.rb +109 -0
  34. data/lib/hoboken/add_ons/twbs.rb +50 -0
  35. data/lib/hoboken/add_ons/vcr.rb +54 -0
  36. data/lib/hoboken/generate.rb +146 -46
  37. data/lib/hoboken/templates/Gemfile.erb.tt +43 -8
  38. data/lib/hoboken/templates/README.md.tt +117 -35
  39. data/lib/hoboken/templates/Rakefile.tt +20 -16
  40. data/lib/hoboken/templates/active_record.rake +11 -0
  41. data/lib/hoboken/templates/airbrake.rb.tt +13 -0
  42. data/lib/hoboken/templates/classic.rb.tt +25 -11
  43. data/lib/hoboken/templates/classic_environment.rb.tt +51 -0
  44. data/lib/hoboken/templates/config.ru.tt +4 -2
  45. data/lib/hoboken/templates/console +19 -0
  46. data/lib/hoboken/templates/db.rb.tt +24 -0
  47. data/lib/hoboken/templates/example_worker.rb.tt +14 -0
  48. data/lib/hoboken/templates/github_action.tt +28 -0
  49. data/lib/hoboken/templates/gitignore +8 -0
  50. data/lib/hoboken/templates/metrics.rake.tt +12 -9
  51. data/lib/hoboken/templates/modular.rb.tt +28 -15
  52. data/lib/hoboken/templates/modular_environment.rb.tt +62 -0
  53. data/lib/hoboken/templates/puma.rb.tt +21 -0
  54. data/lib/hoboken/templates/rspec.rake.tt +9 -0
  55. data/lib/hoboken/templates/rubocop.yml.tt +51 -0
  56. data/lib/hoboken/templates/seeds.rb +12 -0
  57. data/lib/hoboken/templates/sequel.rake +21 -0
  58. data/lib/hoboken/templates/server +15 -0
  59. data/lib/hoboken/templates/setup +28 -0
  60. data/lib/hoboken/templates/sidekiq.rb.tt +21 -0
  61. data/lib/hoboken/templates/spec/app_spec.rb.tt +13 -0
  62. data/lib/hoboken/templates/spec/example_worker_spec.rb.tt +16 -0
  63. data/lib/hoboken/templates/spec/rack_matchers.rb.tt +58 -0
  64. data/lib/hoboken/templates/spec/spec_helper.rb.tt +37 -0
  65. data/lib/hoboken/templates/spec/turnip_helper.rb.tt +10 -0
  66. data/lib/hoboken/templates/styles.css.tt +1 -1
  67. data/lib/hoboken/templates/support/rack_helpers.rb.tt +55 -0
  68. data/lib/hoboken/templates/support/rack_test_assertions.rb.tt +113 -0
  69. data/lib/hoboken/templates/test/test_helper.rb.tt +47 -0
  70. data/lib/hoboken/templates/test/unit/app_test.rb.tt +11 -3
  71. data/lib/hoboken/templates/test/unit/example_worker_test.rb.tt +20 -0
  72. data/lib/hoboken/templates/test_unit.rake.tt +18 -0
  73. data/lib/hoboken/templates/vcr_setup.rb.tt +15 -0
  74. data/lib/hoboken/templates/views/index.erb.tt +11 -4
  75. data/lib/hoboken/templates/views/layout.erb.tt +7 -4
  76. data/lib/hoboken/version.rb +3 -1
  77. data/lib/hoboken.rb +147 -325
  78. data/test/fixtures/Gemfile +3 -3
  79. data/test/fixtures/Gemfile.pristine +3 -2
  80. data/test/integration/active_record_test.rb +66 -0
  81. data/test/integration/airbrake_test.rb +31 -0
  82. data/test/integration/generate_classic_test.rb +75 -0
  83. data/test/integration/generate_modular_test.rb +83 -0
  84. data/test/integration/github_action_test.rb +13 -0
  85. data/test/integration/heroku_test.rb +14 -0
  86. data/test/integration/internationalization_test.rb +26 -0
  87. data/test/integration/metrics_test.rb +54 -0
  88. data/test/integration/omniauth_test.rb +143 -0
  89. data/test/integration/rubocop_test.rb +39 -0
  90. data/test/integration/sequel_test.rb +64 -0
  91. data/test/integration/sidekiq_test.rb +105 -0
  92. data/test/integration/travis_test.rb +13 -0
  93. data/test/integration/turnip_test.rb +51 -0
  94. data/test/integration/twitter_bootstrap_test.rb +39 -0
  95. data/test/integration/vcr_test.rb +54 -0
  96. data/test/test_helper.rb +109 -0
  97. data/test/unit/hoboken_actions_test.rb +82 -53
  98. data/www/Gemfile +4 -0
  99. data/www/README.md +2 -0
  100. data/www/config.rb +11 -0
  101. data/www/source/documentation.html.erb +274 -0
  102. data/www/source/images/hoboken-running.png +0 -0
  103. data/www/source/images/hoboken.png +0 -0
  104. data/www/source/images/sinatra.png +0 -0
  105. data/www/source/index.html.erb +44 -0
  106. data/www/source/javascripts/all.js +1 -0
  107. data/www/source/layouts/layout.erb +38 -0
  108. data/www/source/stylesheets/all.css.scss +116 -0
  109. data/www/source/stylesheets/normalize.css +375 -0
  110. metadata +655 -29
  111. data/lib/hoboken/templates/sprockets.rake +0 -33
  112. data/lib/hoboken/templates/sprockets_chain.rb +0 -26
  113. data/lib/hoboken/templates/sprockets_helper.rb +0 -13
  114. data/lib/hoboken/templates/test/support/rack_test_assertions.rb.tt +0 -79
  115. data/lib/hoboken/templates/test/unit/test_helper.rb.tt +0 -36
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../test_helper'
4
+
5
+ class TurnipTest < IntegrationTestCase
6
+ def test_turnip_add_on_classic
7
+ run_hoboken(:generate, test_framework: 'rspec') do
8
+ bin_path = File.expand_path('../../bin/hoboken', __dir__)
9
+ result = execute("#{bin_path} add:turnip")
10
+ assert_match(/Gemfile updated/, result)
11
+
12
+ assert_file('Gemfile', /turnip/)
13
+ assert_file('Rakefile', /task ci: %w\[spec turnip\]/)
14
+ assert_file('Rakefile', /task default: %w\[spec turnip\]/)
15
+ assert_file('spec/features/example.feature')
16
+ assert_file('spec/support/steps/example_steps.rb')
17
+ assert_file('spec/turnip_helper.rb')
18
+ assert_file('tasks/turnip.rake')
19
+
20
+ assert_directory('spec/features')
21
+ assert_directory('spec/support/steps')
22
+ end
23
+ end
24
+
25
+ def test_turnip_add_on_modular
26
+ run_hoboken(:generate, type: :modular, test_framework: 'rspec') do
27
+ bin_path = File.expand_path('../../bin/hoboken', __dir__)
28
+ result = execute("#{bin_path} add:turnip")
29
+ assert_match(/Gemfile updated/, result)
30
+
31
+ assert_file('Gemfile', /turnip/)
32
+ assert_file('Rakefile', /task ci: %w\[spec turnip\]/)
33
+ assert_file('Rakefile', /task default: %w\[spec turnip\]/)
34
+ assert_file('spec/features/example.feature')
35
+ assert_file('spec/support/steps/example_steps.rb')
36
+ assert_file('spec/turnip_helper.rb')
37
+ assert_file('tasks/turnip.rake')
38
+
39
+ assert_directory('spec/features')
40
+ assert_directory('spec/support/steps')
41
+ end
42
+ end
43
+
44
+ def test_turnip_without_rspec
45
+ run_hoboken(:generate, rubocop: false, run_tests: false) do
46
+ bin_path = File.expand_path('../../bin/hoboken', __dir__)
47
+ result = execute("#{bin_path} add:turnip")
48
+ assert_match(/Turnip requires RSpec/, result)
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../test_helper'
4
+
5
+ class TwitterBootstrapTest < IntegrationTestCase
6
+ def test_twitter_bootstrap_add_on_classic
7
+ run_hoboken(:generate) do
8
+ bin_path = File.expand_path('../../bin/hoboken', __dir__)
9
+ result = execute("#{bin_path} add:twbs")
10
+ assert_match(/Gemfile updated/, result)
11
+
12
+ assert_file('Gemfile', /bootstrap/)
13
+ assert_file('config/environment.rb', /require 'bootstrap'/)
14
+ assert_file('assets/stylesheets/styles.scss', /@import "bootstrap"/)
15
+ assert_file('assets/javascripts/app.js', /require popper/)
16
+ assert_file('assets/javascripts/app.js', /require bootstrap-sprockets/)
17
+ assert_file_does_not_have_content('views/layout.erb', /normalize/)
18
+ execute('bundle exec rake assets:precompile')
19
+ assert_directory('public/assets')
20
+ end
21
+ end
22
+
23
+ def test_twitter_bootstrap_add_on_modular
24
+ run_hoboken(:generate, type: :modular) do
25
+ bin_path = File.expand_path('../../bin/hoboken', __dir__)
26
+ result = execute("#{bin_path} add:twbs")
27
+ assert_match(/Gemfile updated/, result)
28
+
29
+ assert_file('Gemfile', /bootstrap/)
30
+ assert_file('config/environment.rb', /require 'bootstrap'/)
31
+ assert_file('assets/stylesheets/styles.scss', /@import "bootstrap"/)
32
+ assert_file('assets/javascripts/app.js', /require popper/)
33
+ assert_file('assets/javascripts/app.js', /require bootstrap-sprockets/)
34
+ assert_file_does_not_have_content('views/layout.erb', /normalize/)
35
+ execute('bundle exec rake assets:precompile')
36
+ assert_directory('public/assets')
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../test_helper'
4
+
5
+ class VcrTest < IntegrationTestCase
6
+ # rubocop:disable Metrics/MethodLength
7
+ def test_vcr_add_on_test_unit
8
+ run_hoboken(:generate) do
9
+ bin_path = File.expand_path('../../bin/hoboken', __dir__)
10
+ result = execute("#{bin_path} add:vcr")
11
+ assert_match(/Gemfile updated/, result)
12
+
13
+ assert_file('Gemfile', /vcr/)
14
+ assert_file('Gemfile', /webmock/)
15
+ assert_file('test/support/vcr_setup.rb')
16
+ assert_file('test/test_helper.rb', "require_relative 'support/vcr_setup'")
17
+
18
+ assert_file(
19
+ 'test/support/vcr_setup.rb',
20
+ "c.cassette_library_dir = 'test/fixtures/vcr_cassettes'"
21
+ )
22
+
23
+ assert_file_does_not_have_content(
24
+ 'test/support/vcr_setup.rb',
25
+ 'c.configure_rspec_metadata!'
26
+ )
27
+
28
+ assert_directory('test/fixtures/vcr_cassettes')
29
+ end
30
+ end
31
+ # rubocop:enable Metrics/MethodLength
32
+
33
+ def test_vcr_add_on_rspec
34
+ run_hoboken(:generate, test_framework: 'rspec') do
35
+ bin_path = File.expand_path('../../bin/hoboken', __dir__)
36
+ result = execute("#{bin_path} add:vcr")
37
+ assert_match(/Gemfile updated/, result)
38
+
39
+ assert_file('Gemfile', /vcr/)
40
+ assert_file('Gemfile', /webmock/)
41
+ assert_file('spec/support/vcr_setup.rb')
42
+ assert_file('spec/spec_helper.rb', "require 'support/vcr_setup'")
43
+
44
+ assert_file(
45
+ 'spec/support/vcr_setup.rb',
46
+ "c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'"
47
+ )
48
+
49
+ assert_file('spec/support/vcr_setup.rb', 'c.configure_rspec_metadata!')
50
+
51
+ assert_directory('spec/fixtures/vcr_cassettes')
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,109 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/setup'
4
+
5
+ require 'warning'
6
+
7
+ # Ignore all warnings in Gem dependencies
8
+ Gem.path.each { |path| Warning.ignore(//, path) }
9
+
10
+ require 'test/unit'
11
+ require 'fileutils'
12
+
13
+ # rubocop:disable Style/GlobalVars
14
+ $hoboken_counter = 0
15
+ DESTINATION = File.expand_path('tmp', __dir__)
16
+ FileUtils.rm_rf(DESTINATION)
17
+
18
+ class IntegrationTestCase < Test::Unit::TestCase
19
+ def teardown
20
+ if passed?
21
+ FileUtils.rm_rf("#{DESTINATION}/#{$hoboken_counter}")
22
+ else
23
+ puts "Left #{DESTINATION}/#{$hoboken_counter}/sample in place since test failed."
24
+ end
25
+ end
26
+
27
+ def run_hoboken(command, **opts)
28
+ options = extract_cli_options(opts)
29
+ check_rubocop = opts.fetch(:rubocop, true)
30
+ run_app_tests_or_specs = opts.fetch(:run_tests, true)
31
+
32
+ $hoboken_counter += 1
33
+ bin_path = File.expand_path('../bin/hoboken', __dir__)
34
+
35
+ # rubocop:disable Layout/LineLength
36
+ `#{bin_path} #{command} #{DESTINATION}/#{$hoboken_counter}/sample #{options.join(' ')}`
37
+ # rubocop:enable Layout/LineLength
38
+ yield
39
+
40
+ assert_match(/0 failures/, execute('rake')) if run_app_tests_or_specs
41
+ assert_match(/no offenses detected/, execute('rubocop')) if check_rubocop
42
+ end
43
+
44
+ def execute(command)
45
+ FileUtils.cd("#{DESTINATION}/#{$hoboken_counter}/sample") do
46
+ `#{command}`
47
+ end
48
+ end
49
+
50
+ def assert_file(filename, *contents)
51
+ full_path = File.join(DESTINATION, $hoboken_counter.to_s, 'sample', filename)
52
+ assert_block("expected #{filename.inspect} to exist") do
53
+ File.exist?(full_path)
54
+ end
55
+
56
+ return if contents.empty?
57
+
58
+ read = File.read(full_path)
59
+ contents.each do |content|
60
+ assert_block("expected #{filename.inspect} to contain #{content}:\n#{read}") do
61
+ pattern = content.is_a?(Regexp) ? content : Regexp.new(Regexp.quote(content))
62
+ read =~ pattern
63
+ end
64
+ end
65
+ end
66
+
67
+ def assert_file_does_not_have_content(filename, *contents)
68
+ full_path = File.join(DESTINATION, $hoboken_counter.to_s, 'sample', filename)
69
+ assert_block("expected #{filename.inspect} to exist") do
70
+ File.exist?(full_path)
71
+ end
72
+
73
+ read = File.read(full_path)
74
+ contents.each do |content|
75
+ assert_block("expected #{filename.inspect} to not contain #{content}:\n#{read}") do
76
+ pattern = content.is_a?(Regexp) ? content : Regexp.new(Regexp.quote(content))
77
+ read !~ pattern
78
+ end
79
+ end
80
+ end
81
+
82
+ def assert_directory(name)
83
+ assert_block("expected #{name} directory to exist") do
84
+ File.directory?(File.join(DESTINATION, $hoboken_counter.to_s, 'sample', name))
85
+ end
86
+ end
87
+
88
+ def refute_directory(name)
89
+ assert_block("did not expect directory #{name} to exist") do
90
+ !File.directory?(File.join(DESTINATION, $hoboken_counter.to_s, 'sample', name))
91
+ end
92
+ end
93
+
94
+ private
95
+
96
+ # rubocop:disable Metrics/AbcSize
97
+ def extract_cli_options(opts)
98
+ [].tap do |o|
99
+ o << '--git' if opts.fetch(:git, false)
100
+ o << '--tiny' if opts.fetch(:tiny, false)
101
+ o << '--api-only' if opts.fetch(:api_only, false)
102
+ o << "--test_framework=#{opts[:test_framework]}" if opts.key?(:test_framework)
103
+ o << "--type=#{opts[:type]}" if opts.key?(:type)
104
+ o << "--ruby-version=#{opts[:ruby_version]}" if opts.key?(:ruby_version)
105
+ end
106
+ end
107
+ # rubocop:enable Metrics/AbcSize
108
+ end
109
+ # rubocop:enable Style/GlobalVars
@@ -1,8 +1,10 @@
1
- require "test/unit"
2
- require_relative "../../lib/hoboken/actions.rb"
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../test_helper'
4
+ require_relative '../../lib/hoboken/actions'
3
5
 
4
6
  module Hoboken
5
- require "thor"
7
+ require 'thor'
6
8
  class Target < Thor::Group
7
9
  include Thor::Actions
8
10
  include Hoboken::Actions
@@ -12,80 +14,107 @@ module Hoboken
12
14
  attr_reader :gemfile_path, :gemfile, :target
13
15
 
14
16
  def setup
15
- @gemfile_path = File.join("test", "fixtures")
16
- @gemfile = File.join(gemfile_path, "Gemfile")
17
+ @gemfile_path = File.join('test', 'fixtures')
18
+ @gemfile = File.join(gemfile_path, 'Gemfile')
17
19
  @target = Target.new([], {}, destination_root: gemfile_path)
18
- FileUtils.copy(File.join(gemfile_path, "Gemfile.pristine"), gemfile)
20
+ FileUtils.copy(File.join(gemfile_path, 'Gemfile.pristine'), gemfile)
19
21
  end
20
22
 
21
23
  def test_gem_appends_to_gemfile
22
- target.gem "sinatra", "1.4.4", verbose: false
24
+ target.gem 'sinatra', verbose: false
25
+ expected =
26
+ "source 'https://rubygems.org'\n" \
27
+ "ruby '2.0.0'\n\n" \
28
+ "gem 'sinatra'\n"
29
+
30
+ assert_equal(expected, File.read(gemfile))
31
+ end
32
+
33
+ def test_gem_with_version
34
+ target.gem 'sinatra', version: '1.4.4', verbose: false
23
35
  expected =
24
- "source \"https://rubygems.org\"\n" +
25
- "ruby \"2.0.0\"\n\n" +
26
- "gem \"sinatra\", \"~> 1.4.4\""
36
+ "source 'https://rubygems.org'\n" \
37
+ "ruby '2.0.0'\n\n" \
38
+ "gem 'sinatra', '~> 1.4.4'\n"
39
+
40
+ assert_equal(expected, File.read(gemfile))
41
+ end
42
+
43
+ def test_get_with_blank_version
44
+ target.gem 'sinatra', version: '', verbose: false
45
+ expected =
46
+ "source 'https://rubygems.org'\n" \
47
+ "ruby '2.0.0'\n\n" \
48
+ "gem 'sinatra'\n"
27
49
 
28
50
  assert_equal(expected, File.read(gemfile))
29
51
  end
30
52
 
31
53
  def test_gem_with_group
32
- target.gem "sinatra", "1.4.4", group: :test, verbose: false
54
+ target.gem 'sinatra', version: '1.4.4', group: :test, verbose: false
33
55
  expected =
34
- "source \"https://rubygems.org\"\n" +
35
- "ruby \"2.0.0\"\n\n" +
36
- "gem \"sinatra\", \"~> 1.4.4\", group: :test"
56
+ "source 'https://rubygems.org'\n" \
57
+ "ruby '2.0.0'\n\n" \
58
+ "gem 'sinatra', '~> 1.4.4', group: :test\n"
37
59
 
38
60
  assert_equal(expected, File.read(gemfile))
39
61
  end
40
62
 
41
63
  def test_gem_with_multiple_groups
42
- target.gem "sinatra", "1.4.4", group: [:test, :development], verbose: false
64
+ target.gem 'sinatra', version: '1.4.4', group: %i[test development], verbose: false
43
65
  expected =
44
- "source \"https://rubygems.org\"\n" +
45
- "ruby \"2.0.0\"\n\n" +
46
- "gem \"sinatra\", \"~> 1.4.4\", group: [:test, :development]"
66
+ "source 'https://rubygems.org'\n" \
67
+ "ruby '2.0.0'\n\n" \
68
+ "gem 'sinatra', '~> 1.4.4', group: [:test, :development]\n"
47
69
 
48
70
  assert_equal(expected, File.read(gemfile))
49
71
  end
50
72
 
51
73
  def test_gem_with_require
52
- target.gem "sinatra", "1.4.4", require: false, verbose: false
74
+ target.gem 'sinatra', version: '1.4.4', require: false, verbose: false
53
75
  expected =
54
- "source \"https://rubygems.org\"\n" +
55
- "ruby \"2.0.0\"\n\n" +
56
- "gem \"sinatra\", \"~> 1.4.4\", require: false"
76
+ "source 'https://rubygems.org'\n" \
77
+ "ruby '2.0.0'\n\n" \
78
+ "gem 'sinatra', '~> 1.4.4', require: false\n"
57
79
 
58
80
  assert_equal(expected, File.read(gemfile))
59
81
  end
60
82
 
61
83
  def test_gem_with_require_and_group
62
- target.gem "sinatra", "1.4.4", require: false, group: :test, verbose: false
84
+ target.gem 'sinatra', version: '1.4.4', require: false, group: :test, verbose: false
63
85
  expected =
64
- "source \"https://rubygems.org\"\n" +
65
- "ruby \"2.0.0\"\n\n" +
66
- "gem \"sinatra\", \"~> 1.4.4\", require: false, group: :test"
86
+ "source 'https://rubygems.org'\n" \
87
+ "ruby '2.0.0'\n\n" \
88
+ "gem 'sinatra', '~> 1.4.4', require: false, group: :test\n"
67
89
 
68
90
  assert_equal(expected, File.read(gemfile))
69
91
  end
70
92
 
71
93
  def test_gem_with_require_and_multiple_groups
72
- target.gem "sinatra", "1.4.4", require: false, group: [:test, :development], verbose: false
94
+ target.gem(
95
+ 'sinatra',
96
+ version: '1.4.4',
97
+ require: false,
98
+ group: %i[test development],
99
+ verbose: false
100
+ )
101
+
73
102
  expected =
74
- "source \"https://rubygems.org\"\n" +
75
- "ruby \"2.0.0\"\n\n" +
76
- "gem \"sinatra\", \"~> 1.4.4\", require: false, group: [:test, :development]"
103
+ "source 'https://rubygems.org'\n" \
104
+ "ruby '2.0.0'\n\n" \
105
+ "gem 'sinatra', '~> 1.4.4', require: false, group: [:test, :development]\n"
77
106
 
78
107
  assert_equal(expected, File.read(gemfile))
79
108
  end
80
109
 
81
110
  def test_gem_multiple
82
- target.gem "sinatra", "1.4.4", verbose: false
83
- target.gem "thin", "1.4.4", verbose: false
111
+ target.gem 'sinatra', version: '1.4.4', verbose: false
112
+ target.gem 'thin', version: '1.4.4', verbose: false
84
113
  expected =
85
- "source \"https://rubygems.org\"\n" +
86
- "ruby \"2.0.0\"\n\n" +
87
- "gem \"sinatra\", \"~> 1.4.4\"\n" +
88
- "gem \"thin\", \"~> 1.4.4\""
114
+ "source 'https://rubygems.org'\n" \
115
+ "ruby '2.0.0'\n\n" \
116
+ "gem 'sinatra', '~> 1.4.4'\n" \
117
+ "gem 'thin', '~> 1.4.4'\n"
89
118
 
90
119
  assert_equal(expected, File.read(gemfile))
91
120
  end
@@ -96,32 +125,32 @@ module Hoboken
96
125
 
97
126
  def setup
98
127
  @target = Target.new
99
- @text = <<-TEXT
128
+ @text = <<~TEXT
100
129
 
101
- This is some
102
- text that needs
103
- to be indented.
104
- TEXT
130
+ This is some
131
+ text that needs
132
+ to be indented.
133
+ TEXT
105
134
  end
106
135
 
107
136
  def test_indent_with_one_space
108
- expected = <<-TEXT
109
-
110
- This is some
111
- text that needs
112
- to be indented.
113
- TEXT
137
+ expected = <<~TEXT
138
+ #{' '}
139
+ This is some
140
+ text that needs
141
+ to be indented.
142
+ TEXT
114
143
 
115
144
  assert_equal(expected, target.indent(text, 1))
116
145
  end
117
146
 
118
147
  def test_indent_with_two_spaces
119
- expected = <<-TEXT
120
-
121
- This is some
122
- text that needs
123
- to be indented.
124
- TEXT
148
+ expected = <<~TEXT
149
+ #{' '}
150
+ This is some
151
+ text that needs
152
+ to be indented.
153
+ TEXT
125
154
 
126
155
  assert_equal(expected, target.indent(text, 2))
127
156
  end
data/www/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'middleman', '~> 4.4'
4
+ gem 'middleman-livereload', '~> 3.4'
data/www/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # Hoboken Docs
2
+ Project site for [Hoboken](https://github.com/bnadlerjr/hoboken).
data/www/config.rb ADDED
@@ -0,0 +1,11 @@
1
+ set :css_dir, 'stylesheets'
2
+ set :js_dir, 'javascripts'
3
+ set :images_dir, 'images'
4
+
5
+ configure :build do
6
+ activate :minify_css
7
+ activate :minify_javascript
8
+ activate :asset_hash
9
+ activate :relative_assets
10
+ set :relative_links, true
11
+ end