skellington 0.8.9 → 0.9.0.pre.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +5 -5
  2. data/.ruby-version +1 -0
  3. data/README.md +3 -9
  4. data/Rakefile +2 -32
  5. data/config/config.yaml +21 -7
  6. data/lib/skellington/cli.rb +0 -4
  7. data/lib/skellington/generator.rb +5 -14
  8. data/lib/skellington/helpers.rb +17 -0
  9. data/lib/skellington/version.rb +1 -1
  10. data/lib/skellington.rb +1 -1
  11. data/lib/templates/common/Gemfile +0 -6
  12. data/lib/templates/common/includes/footer +1 -1
  13. data/lib/templates/common/includes/header +1 -15
  14. data/lib/templates/common/includes/libs +14 -0
  15. data/lib/templates/common/includes/nav +11 -24
  16. data/lib/templates/common/sass/colours +12 -1
  17. data/lib/templates/common/sass/footer +2 -17
  18. data/lib/templates/jekyll/_data/libs.yml +1 -6
  19. data/lib/templates/{common/sass/styles → jekyll/css/styles.scss} +3 -4
  20. data/lib/templates/jekyll/post-run +1 -1
  21. data/lib/templates/sinatra/Rakefile +3 -2
  22. data/lib/templates/sinatra/post-run +1 -1
  23. data/lib/templates/sinatra/public/sass/styles.scss +13 -0
  24. data/lib/templates/sinatra/views/includes/js-libs.erb +7 -6
  25. data/skellington.gemspec +8 -9
  26. data/spec/hyphens_spec.rb +1 -1
  27. data/spec/jekyll/404_spec.rb +17 -15
  28. data/spec/jekyll/assets/static_spec.rb +9 -7
  29. data/spec/jekyll/bootstrap/css_spec.rb +111 -115
  30. data/spec/jekyll/cli_spec.rb +19 -8
  31. data/spec/jekyll/data/libs_spec.rb +31 -24
  32. data/spec/jekyll/git_spec.rb +15 -13
  33. data/spec/jekyll/index_md_spec.rb +15 -13
  34. data/spec/jekyll/js/javascript_spec.rb +9 -7
  35. data/spec/jekyll/layout/layout_spec.rb +108 -108
  36. data/spec/jekyll/root_files/code-of-conduct_spec.rb +17 -15
  37. data/spec/jekyll/root_files/config_yml_spec.rb +20 -18
  38. data/spec/jekyll/root_files/gemfile_spec.rb +16 -14
  39. data/spec/jekyll/root_files/license_spec.rb +61 -59
  40. data/spec/jekyll/root_files/rbenv_spec.rb +13 -11
  41. data/spec/jekyll/root_files/readme_spec.rb +13 -11
  42. data/spec/sinatra/app/app_spec.rb +46 -44
  43. data/spec/sinatra/app/config_yml_spec.rb +13 -11
  44. data/spec/sinatra/app/helpers_spec.rb +16 -14
  45. data/spec/sinatra/app/public_spec.rb +9 -7
  46. data/spec/sinatra/app/racks_spec.rb +33 -31
  47. data/spec/sinatra/bootstrap/css_spec.rb +133 -124
  48. data/spec/sinatra/cli_spec.rb +18 -16
  49. data/spec/sinatra/git_spec.rb +14 -12
  50. data/spec/sinatra/javascript/javascript_spec.rb +42 -40
  51. data/spec/sinatra/layout/includes_spec.rb +76 -58
  52. data/spec/sinatra/layout/layout_spec.rb +93 -104
  53. data/spec/sinatra/layout/views_spec.rb +22 -20
  54. data/spec/sinatra/root_files/code-of-conduct_spec.rb +16 -14
  55. data/spec/sinatra/root_files/config_ru_spec.rb +13 -11
  56. data/spec/sinatra/root_files/gemfile_spec.rb +30 -28
  57. data/spec/sinatra/root_files/guardfile_spec.rb +26 -24
  58. data/spec/sinatra/root_files/license_spec.rb +60 -58
  59. data/spec/sinatra/root_files/procfile_spec.rb +12 -10
  60. data/spec/sinatra/root_files/rakefile_spec.rb +30 -27
  61. data/spec/sinatra/root_files/rbenv_spec.rb +12 -10
  62. data/spec/sinatra/root_files/readme_spec.rb +12 -10
  63. data/spec/sinatra/spec/spec_spec.rb +71 -69
  64. data/spec/skellington_spec.rb +31 -2
  65. metadata +25 -47
  66. data/lib/templates/sinatra/config.rb +0 -4
  67. data/spec/jekyll/bootstrap_4/bootstrap_4_spec.rb +0 -54
  68. data/spec/sinatra/bootstrap_4/config_rb_bootstrap_4_spec.rb +0 -20
  69. data/spec/sinatra/bootstrap_4/gemfile_bootstrap_4_spec.rb +0 -39
  70. data/spec/sinatra/bootstrap_4/public_bootstrap_4_spec.rb +0 -35
  71. data/spec/sinatra/root_files/config_rb_spec.rb +0 -19
@@ -1,58 +1,60 @@
1
1
  module Skellington
2
2
  describe CLI do
3
- let :subject do
4
- described_class.new
5
- end
6
-
7
- it 'generates an app file' do
8
- subject.generate 'dummy-app'
9
- expect('dummy_app/lib/dummy_app.rb').to have_content (
10
- """
11
- require 'sinatra/base'
12
- require 'tilt/erubis'
13
- require 'json'
14
- require 'yaml'
15
-
16
- require_relative 'dummy_app/helpers'
17
- require_relative 'dummy_app/racks'
18
-
19
- module DummyApp
20
- class App < Sinatra::Base
21
- helpers do
22
- include DummyApp::Helpers
23
- end
24
-
25
- get '/' do
26
- headers 'Vary' => 'Accept'
3
+ context 'sinatra' do
4
+ let :subject do
5
+ described_class.new
6
+ end
27
7
 
28
- respond_to do |wants|
29
- wants.html do
30
- @content = '<h1>Hello from DummyApp</h1>'
31
- @title = 'DummyApp'
32
- @github_url = CONFIG['github_url']
33
- erb :index
34
- end
8
+ it 'generates an app file' do
9
+ subject.generate 'dummy-app'
10
+ expect('dummy_app/lib/dummy_app.rb').to have_content (
11
+ """
12
+ require 'sinatra/base'
13
+ require 'tilt/erubis'
14
+ require 'json'
15
+ require 'yaml'
16
+
17
+ require_relative 'dummy_app/helpers'
18
+ require_relative 'dummy_app/racks'
19
+
20
+ module DummyApp
21
+ class App < Sinatra::Base
22
+ helpers do
23
+ include DummyApp::Helpers
24
+ end
35
25
 
36
- wants.json do
37
- {
38
- app: 'DummyApp'
39
- }.to_json
26
+ get '/' do
27
+ headers 'Vary' => 'Accept'
28
+
29
+ respond_to do |wants|
30
+ wants.html do
31
+ @content = '<h1>Hello from DummyApp</h1>'
32
+ @title = 'DummyApp'
33
+ @github_url = CONFIG['github_url']
34
+ erb :index
35
+ end
36
+
37
+ wants.json do
38
+ {
39
+ app: 'DummyApp'
40
+ }.to_json
41
+ end
40
42
  end
41
43
  end
42
- end
43
44
 
44
- # start the server if ruby file executed directly
45
- run! if app_file == $0
45
+ # start the server if ruby file executed directly
46
+ run! if app_file == $0
46
47
 
47
- not_found do
48
- status 404
49
- @title = '404'
50
- erb :oops
48
+ not_found do
49
+ status 404
50
+ @title = '404'
51
+ erb :oops
52
+ end
51
53
  end
52
54
  end
55
+ """
56
+ )
53
57
  end
54
- """
55
- )
56
58
  end
57
59
  end
58
60
  end
@@ -1,17 +1,19 @@
1
1
  module Skellington
2
2
  describe CLI do
3
- let :subject do
4
- described_class.new
5
- end
3
+ context 'sinatra' do
4
+ let :subject do
5
+ described_class.new
6
+ end
6
7
 
7
- it 'generates a config/config.yml file' do
8
- subject.generate 'dummy-app'
9
- expect('dummy_app/config/config.yml').to have_content (
10
- """
11
- #google-analytics-tag: UA-00000000-0
12
- #github_url: https://github.com # also uncomment the `include` line in `styles.scss`
13
- """
14
- )
8
+ it 'generates a config/config.yml file' do
9
+ subject.generate 'dummy-app'
10
+ expect('dummy_app/config/config.yml').to have_content (
11
+ """
12
+ #google-analytics-tag: UA-00000000-0
13
+ #github_url: https://github.com # also uncomment the `include` line in `styles.scss`
14
+ """
15
+ )
16
+ end
15
17
  end
16
18
  end
17
19
  end
@@ -1,24 +1,26 @@
1
1
  module Skellington
2
2
  describe CLI do
3
- let :subject do
4
- described_class.new
5
- end
3
+ context 'sinatra' do
4
+ let :subject do
5
+ described_class.new
6
+ end
6
7
 
7
- it 'generates an app file' do
8
- subject.generate 'dummy-app'
9
- expect('dummy_app/lib/dummy_app/helpers.rb').to have_content (
10
- """
11
- module DummyApp
12
- CONFIG = YAML.load_file('config/config.yml') || {}
8
+ it 'generates an app file' do
9
+ subject.generate 'dummy-app'
10
+ expect('dummy_app/lib/dummy_app/helpers.rb').to have_content (
11
+ """
12
+ module DummyApp
13
+ CONFIG = YAML.load_file('config/config.yml') || {}
13
14
 
14
- module Helpers
15
- def hello
16
- 'Hello'
15
+ module Helpers
16
+ def hello
17
+ 'Hello'
18
+ end
17
19
  end
18
20
  end
21
+ """
22
+ )
19
23
  end
20
- """
21
- )
22
24
  end
23
25
  end
24
26
  end
@@ -1,14 +1,16 @@
1
1
  module Skellington
2
2
  describe CLI do
3
- let :subject do
4
- described_class.new
5
- end
3
+ context 'sinatra' do
4
+ let :subject do
5
+ described_class.new
6
+ end
6
7
 
7
- it 'generates placeholders for static files' do
8
- subject.generate 'dummy-app'
8
+ it 'generates placeholders for static files' do
9
+ subject.generate 'dummy-app'
9
10
 
10
- expect(File).to exist 'dummy_app/public/js/dummy_app.js'
11
- expect(File).to exist 'dummy_app/public/assets/favicon.ico'
11
+ expect(File).to exist 'dummy_app/public/js/dummy_app.js'
12
+ expect(File).to exist 'dummy_app/public/assets/favicon.ico'
13
+ end
12
14
  end
13
15
  end
14
16
  end
@@ -1,46 +1,48 @@
1
1
  module Skellington
2
2
  describe CLI do
3
- let :subject do
4
- described_class.new
5
- end
3
+ context 'sinatra' do
4
+ let :subject do
5
+ described_class.new
6
+ end
6
7
 
7
- it 'generates an app file' do
8
- subject.generate 'dummy-app'
9
- expect('dummy_app/lib/dummy_app/racks.rb').to have_content (
10
- """
11
- require 'rack/conneg'
12
- require 'rack/tracker'
8
+ it 'generates an app file' do
9
+ subject.generate 'dummy-app'
10
+ expect('dummy_app/lib/dummy_app/racks.rb').to have_content (
11
+ """
12
+ require 'rack/conneg'
13
+ require 'rack/tracker'
13
14
 
14
- module DummyApp
15
- class App < Sinatra::Base
16
- set :public_folder, 'public'
17
- set :views, 'views'
15
+ module DummyApp
16
+ class App < Sinatra::Base
17
+ set :public_folder, 'public'
18
+ set :views, 'views'
18
19
 
19
- if CONFIG['google-analytics-tag']
20
- use Rack::Tracker do
21
- handler :google_analytics, { tracker: CONFIG['google-analytics-tag'] }
20
+ if CONFIG['google-analytics-tag']
21
+ use Rack::Tracker do
22
+ handler :google_analytics, { tracker: CONFIG['google-analytics-tag'] }
23
+ end
22
24
  end
23
- end
24
25
 
25
- use Rack::Conneg do |conneg|
26
- conneg.set :accept_all_extensions, true
27
- conneg.set :fallback, :html
28
- conneg.ignore_contents_of 'public'
29
- conneg.provide [
30
- :html,
31
- :json
32
- ]
33
- end
26
+ use Rack::Conneg do |conneg|
27
+ conneg.set :accept_all_extensions, true
28
+ conneg.set :fallback, :html
29
+ conneg.ignore_contents_of 'public'
30
+ conneg.provide [
31
+ :html,
32
+ :json
33
+ ]
34
+ end
34
35
 
35
- before do
36
- if negotiated?
37
- content_type negotiated_type
36
+ before do
37
+ if negotiated?
38
+ content_type negotiated_type
39
+ end
38
40
  end
39
41
  end
40
42
  end
43
+ """
44
+ )
41
45
  end
42
- """
43
- )
44
46
  end
45
47
  end
46
48
  end
@@ -1,153 +1,162 @@
1
1
  module Skellington
2
2
  describe CLI do
3
- let :subject do
4
- described_class.new
5
- end
3
+ context 'sinatra' do
4
+ let :subject do
5
+ described_class.new
6
+ end
7
+
8
+ it 'installs bootstrap' do
9
+ subject.generate 'dummy-app'
10
+
11
+ expect(File).to exist 'dummy_app/public/sass/palettes/_default.scss'
12
+ expect('dummy_app/public/sass/_colours.scss').to have_content (
13
+ """
14
+ @import 'palettes/default';
15
+
16
+ //$brand-primary: $rgba-primary-0;
17
+ //$brand-complement: $rgba-complement-0;
18
+ //$brand-secondary-1: $rgba-secondary-1-0;
19
+ //$brand-secondary-2: $rgba-secondary-2-0;
20
+
21
+ $grey: rgb(127, 127, 127);
22
+ $light-grey: lighten($grey, 25%);
23
+ $dark-grey: darken($grey, 25%);
24
+
25
+ $theme-colors: (
26
+ primary: $rgba-primary-0,
27
+ secondary: $rgba-secondary-1-0,
28
+ // success: $green,
29
+ // info: $cyan,
30
+ // warning: $yellow,
31
+ // danger: $red,
32
+ // light: $gray-100,
33
+ // dark: $gray-800
34
+ )
35
+ """
36
+ )
37
+ expect('dummy_app/public/sass/_fonts.scss').to have_content (
38
+ """
39
+ $font-primary: 'Ubuntu Mono';
40
+ """
41
+ )
42
+
43
+ expect('dummy_app/public/sass/_footer.scss').to have_content (
44
+ """
45
+ html {
46
+ position: relative;
47
+ min-height: 100%;
48
+ }
6
49
 
7
- it 'installs bootstrap' do
8
- subject.generate 'dummy-app'
9
-
10
- expect(File).to exist 'dummy_app/public/sass/palettes/_default.scss'
11
- expect('dummy_app/public/sass/_colours.scss').to have_content (
12
- """
13
- @import 'palettes/default';
14
-
15
- $brand-primary: $rgba-primary-0;
16
- //$brand-complement: $rgba-complement-0;
17
- //$brand-secondary-1: $rgba-secondary-1-0;
18
- //$brand-secondary-2: $rgba-secondary-2-0;
19
-
20
- $grey: rgb(127, 127, 127);
21
- $light-grey: lighten($grey, 25%);
22
- $dark-grey: darken($grey, 25%);
23
- """
24
- )
25
- expect('dummy_app/public/sass/_fonts.scss').to have_content (
26
- """
27
- $font-primary: 'Ubuntu Mono';
28
- """
29
- )
30
-
31
- expect('dummy_app/public/sass/_footer.scss').to have_content (
32
- """
33
- html {
34
- position: relative;
35
- min-height: 100%;
36
- }
37
-
38
- body {
39
- margin-bottom: $footer-height;
40
- }
41
-
42
- .footer {
43
- position: absolute;
44
- bottom: 0;
45
- width: 100%;
46
-
47
- text-align: center;
48
-
49
- margin-top: $padding-large-vertical;
50
- background: $brand-primary;
51
- color: white;
52
- height: $footer-height;
53
-
54
- padding: $padding-large-vertical $padding-large-horizontal;
55
-
56
- ul {
57
- @extend .list-inline;
50
+ body {
51
+ margin-bottom: $footer-height;
58
52
  }
59
53
 
60
- a {
54
+ .footer {
55
+ position: absolute;
56
+ bottom: 0;
57
+ width: 100%;
58
+
59
+ text-align: center;
60
+
61
+ background: map-get($theme-colors, primary);
61
62
  color: white;
63
+ height: $footer-height;
64
+
65
+ ul {
66
+ @extend .list-inline;
67
+ }
68
+
69
+ a {
70
+ color: white;
71
+ }
62
72
  }
63
- }
64
- """
65
- )
66
-
67
- expect('dummy_app/public/sass/_nav.scss').to have_content (
68
- """
69
- .navbar-default {
70
- .navbar-nav {
71
- li {
72
- a {
73
- color: $brand-primary;
73
+ """
74
+ )
75
+
76
+ expect('dummy_app/public/sass/_nav.scss').to have_content (
77
+ """
78
+ .navbar-default {
79
+ .navbar-nav {
80
+ li {
81
+ a {
82
+ color: $brand-primary;
83
+ }
74
84
  }
75
85
  }
76
86
  }
77
- }
78
- """
79
- )
80
-
81
- expect('dummy_app/public/sass/_github-corner.scss').to have_content (
82
- """
83
- .octo-background {
84
- fill: $brand-primary;
85
- }
86
-
87
- .octo-arm, .octo-body {
88
- fill: white;
89
- }
90
-
91
- .github-corner:hover .octo-arm {
92
- animation: octocat-wave 560ms ease-in-out
93
- }
94
-
95
- @keyframes octocat-wave {
96
- 0%, 100% {
97
- transform: rotate(0)
98
- }
87
+ """
88
+ )
99
89
 
100
- 20%, 60% {
101
- transform: rotate(-25deg)
90
+ expect('dummy_app/public/sass/_github-corner.scss').to have_content (
91
+ """
92
+ .octo-background {
93
+ fill: $brand-primary;
102
94
  }
103
95
 
104
- 40%, 80% {
105
- transform: rotate(10deg)
96
+ .octo-arm, .octo-body {
97
+ fill: white;
106
98
  }
107
- }
108
99
 
109
- @media (max-width: 500px) {
110
100
  .github-corner:hover .octo-arm {
111
- animation: none
101
+ animation: octocat-wave 560ms ease-in-out
112
102
  }
113
103
 
114
- .github-corner .octo-arm {
115
- animation: octocat-wave 560ms ease-in-out
104
+ @keyframes octocat-wave {
105
+ 0%, 100% {
106
+ transform: rotate(0)
107
+ }
108
+
109
+ 20%, 60% {
110
+ transform: rotate(-25deg)
111
+ }
112
+
113
+ 40%, 80% {
114
+ transform: rotate(10deg)
115
+ }
116
116
  }
117
- }
118
117
 
119
- .github-corner {
120
- svg {
121
- position: absolute;
122
- top: $navbar-height;
123
- right: 0;
118
+ @media (max-width: 500px) {
119
+ .github-corner:hover .octo-arm {
120
+ animation: none
121
+ }
122
+
123
+ .github-corner .octo-arm {
124
+ animation: octocat-wave 560ms ease-in-out
125
+ }
124
126
  }
125
- }
126
- """
127
- )
128
- end
129
127
 
130
- it 'sets up sass' do
131
- subject.generate 'dummy-app'
128
+ .github-corner {
129
+ svg {
130
+ position: absolute;
131
+ top: $navbar-height;
132
+ right: 0;
133
+ }
134
+ }
135
+ """
136
+ )
137
+ end
138
+
139
+ it 'sets up sass' do
140
+ subject.generate 'dummy-app'
132
141
 
133
- expect('dummy_app/public/sass/styles.scss').to have_content (
134
- """
135
- @import 'variables';
136
- @import 'colours';
137
- @import 'fonts';
142
+ expect('dummy_app/public/sass/styles.scss').to have_content (
143
+ """
144
+ @import 'variables';
145
+ @import 'colours';
146
+ @import 'fonts';
138
147
 
139
- @import 'bootstrap';
148
+ @import '../../_sass/bootstrap';
140
149
 
141
- @import 'footer';
142
- @import 'nav';
143
- //@import 'github-corner';
150
+ @import 'footer';
151
+ //@import 'github-corner';
144
152
 
145
- h1 {
146
- color: $brand-primary;
147
- font-family: $font-primary;
148
- }
149
- """
150
- )
153
+ h1 {
154
+ color: map-get($theme-colors, primary);
155
+ font-family: $font-primary;
156
+ }
157
+ """
158
+ )
159
+ end
151
160
  end
152
161
  end
153
162
  end
@@ -1,22 +1,23 @@
1
1
  module Skellington
2
2
  describe CLI do
3
- let :subject do
4
- described_class.new
5
- end
3
+ context 'sinatra' do
4
+ let :subject do
5
+ described_class.new
6
+ end
6
7
 
7
- it 'has a version' do
8
- expect { subject.version }.to output(/^skellington version #{VERSION}$/).to_stdout
9
- end
8
+ it 'has a version' do
9
+ expect { subject.version }.to output(/^skellington version #{VERSION}$/).to_stdout
10
+ end
10
11
 
11
- it 'generates correct output' do
12
- expect { subject.generate 'dummy-app' }.to output(/
12
+ it 'generates correct output' do
13
+ expect { subject.generate 'dummy-app' }.to output(/
13
14
  Your new Sinatra app DummyApp has been created
14
15
 
15
16
  \(Note that 'dummy-app' has been changed to 'dummy_app' because Ruby finds '-'s troubling\)
16
17
 
17
18
  Now do
18
19
 
19
- cd dummy_app
20
+ cd \.\/dummy_app
20
21
  bundle
21
22
  bundle exec rake
22
23
 
@@ -38,20 +39,21 @@ For post-install hints, try
38
39
 
39
40
  skellington postinstall
40
41
  /).to_stdout
41
- end
42
+ end
42
43
 
43
- it 'suppresses the LICENSE help when supplied with a licensor' do
44
- subject.options = {licensor: 'Beyoncé'}
45
- expect { subject.generate 'dummy-app' }.to_not output(/
44
+ it 'suppresses the LICENSE help when supplied with a licensor' do
45
+ subject.options = {licensor: 'Beyoncé'}
46
+ expect { subject.generate 'dummy-app' }.to_not output(/
46
47
  You should also fill in your name in LICENSE.md
47
48
  /).to_stdout
48
- end
49
+ end
49
50
 
50
- it 'gives helpful post-generate advice' do
51
- expect { subject.postinstall }.to output(/For some other things you might find useful, see this gist:
51
+ it 'gives helpful post-generate advice' do
52
+ expect { subject.postinstall }.to output(/For some other things you might find useful, see this gist:
52
53
 
53
54
  https:\/\/gist.github.com\/pikesley\/1789cab7b10f0d8765d4
54
55
  /).to_stdout
56
+ end
55
57
  end
56
58
  end
57
59
  end
@@ -1,19 +1,21 @@
1
1
  module Skellington
2
2
  describe CLI do
3
- let :subject do
4
- described_class.new
5
- end
3
+ context 'sinatra' do
4
+ let :subject do
5
+ described_class.new
6
+ end
6
7
 
7
- it 'initialises a git repo' do
8
- subject.generate 'dummy-app'
9
- expect(Dir).to exist 'dummy_app/.git'
8
+ it 'initialises a git repo' do
9
+ subject.generate 'dummy-app'
10
+ expect(Dir).to exist 'dummy_app/.git'
10
11
 
11
- expect('dummy_app/.gitignore').to have_content (
12
- """
13
- coverage/
14
- .sass-cache
15
- """
16
- )
12
+ expect('dummy_app/.gitignore').to have_content (
13
+ """
14
+ coverage/
15
+ .sass-cache
16
+ """
17
+ )
18
+ end
17
19
  end
18
20
  end
19
21
  end