katapult 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/README.md +61 -35
- data/bin/katapult +24 -34
- data/features/authenticate.feature +344 -0
- data/features/basics.feature +590 -0
- data/features/binary.feature +33 -1
- data/features/model.feature +9 -13
- data/features/step_definitions/rails_steps.rb +3 -2
- data/features/wui.feature +49 -4
- data/lib/generators/katapult/basics/basics_generator.rb +63 -17
- data/lib/generators/katapult/basics/templates/.gitignore +1 -0
- data/lib/generators/katapult/basics/templates/.ruby-version +1 -1
- data/lib/generators/katapult/basics/templates/Capfile +25 -0
- data/lib/generators/katapult/basics/templates/Gemfile +14 -6
- data/lib/generators/katapult/basics/templates/Guardfile +44 -0
- data/lib/generators/katapult/basics/templates/config/database.sample.yml +3 -2
- data/lib/generators/katapult/basics/templates/config/database.yml +3 -2
- data/lib/generators/katapult/basics/templates/config/deploy/production.rb +8 -0
- data/lib/generators/katapult/basics/templates/config/deploy/staging.rb +7 -0
- data/lib/generators/katapult/basics/templates/config/deploy.rb +37 -0
- data/lib/generators/katapult/basics/templates/config/initializers/ext.rb +3 -0
- data/lib/generators/katapult/basics/templates/features/support/factory_girl.rb +1 -0
- data/lib/generators/katapult/basics/templates/features/support/paths.rb +6 -0
- data/lib/generators/katapult/basics/templates/lib/capistrano/tasks/db.rake +28 -0
- data/lib/generators/katapult/basics/templates/lib/capistrano/tasks/deploy.rake +15 -0
- data/lib/generators/katapult/basics/templates/lib/capistrano/tasks/passenger.rake +8 -0
- data/lib/generators/katapult/basics/templates/{config/initializers → lib/ext/action_view}/form_for_with_development_errors.rb +0 -2
- data/lib/generators/katapult/basics/templates/lib/ext/action_view/spec_label.rb +46 -0
- data/lib/generators/katapult/basics/templates/{config/initializers → lib/ext/active_record}/find_by_anything.rb +0 -0
- data/lib/generators/katapult/basics/templates/lib/ext/active_record/these.rb +7 -0
- data/lib/generators/katapult/basics/templates/lib/ext/array/xss_aware_join.rb +10 -0
- data/lib/generators/katapult/basics/templates/lib/ext/enumerable/natural_sort.rb +15 -0
- data/lib/generators/katapult/basics/templates/lib/ext/hash/infinite.rb +7 -0
- data/lib/generators/katapult/basics/templates/lib/ext/string/html_entities.rb +11 -0
- data/lib/generators/katapult/basics/templates/lib/ext/string/to_sort_atoms.rb +52 -0
- data/lib/generators/katapult/basics/templates/lib/tasks/pending_migrations.rake +24 -0
- data/lib/generators/katapult/basics/templates/spec/factories/factories.rb +9 -0
- data/lib/generators/katapult/basics/templates/spec/support/factory_girl.rb +3 -0
- data/lib/generators/katapult/clearance/clearance_generator.rb +125 -0
- data/lib/generators/katapult/clearance/templates/app/controllers/passwords_controller.rb +16 -0
- data/lib/generators/katapult/clearance/templates/app/views/clearance_mailer/change_password.html.haml +6 -0
- data/lib/generators/katapult/clearance/templates/app/views/clearance_mailer/change_password.text.erb +3 -0
- data/lib/generators/katapult/clearance/templates/app/views/passwords/create.html.haml +5 -0
- data/lib/generators/katapult/clearance/templates/app/views/passwords/edit.html.haml +16 -0
- data/lib/generators/katapult/clearance/templates/app/views/passwords/new.html.haml +14 -0
- data/lib/generators/katapult/clearance/templates/app/views/sessions/new.html.haml +19 -0
- data/lib/generators/katapult/clearance/templates/config/initializers/clearance.rb +15 -0
- data/lib/generators/katapult/clearance/templates/config/locales/clearance.en.yml +59 -0
- data/lib/generators/katapult/clearance/templates/features/authentication.feature +94 -0
- data/lib/generators/katapult/clearance/templates/features/step_definitions/authentication_steps.rb +4 -0
- data/lib/generators/katapult/cucumber_features/templates/feature.feature +11 -7
- data/lib/generators/katapult/haml/haml_generator.rb +5 -0
- data/lib/generators/katapult/haml/templates/_form.html.haml +4 -4
- data/lib/generators/katapult/haml/templates/app/views/layouts/_flashes.html.haml +3 -0
- data/lib/generators/katapult/haml/templates/app/views/layouts/application.html.haml +9 -3
- data/lib/generators/katapult/haml/templates/index.html.haml +1 -1
- data/lib/generators/katapult/haml/templates/show.html.haml +2 -4
- data/lib/generators/katapult/install/templates/lib/katapult/application_model.rb +9 -7
- data/lib/generators/katapult/model/model_generator.rb +1 -1
- data/lib/generators/katapult/w_u_i/templates/controller.rb +1 -1
- data/lib/generators/katapult/w_u_i/w_u_i_generator.rb +4 -2
- data/lib/katapult/application_model.rb +8 -1
- data/lib/katapult/attribute.rb +10 -11
- data/lib/katapult/authentication.rb +25 -0
- data/lib/katapult/binary_util.rb +37 -0
- data/lib/katapult/element.rb +1 -1
- data/lib/katapult/generator.rb +6 -0
- data/lib/katapult/model.rb +13 -1
- data/lib/katapult/parser.rb +7 -0
- data/lib/katapult/version.rb +1 -1
- data/lib/katapult/wui.rb +4 -0
- data/lib/katapult.rb +2 -0
- data/spec/attribute_spec.rb +13 -0
- data/spec/element_spec.rb +5 -0
- data/spec/model_spec.rb +5 -4
- data/spec/util_spec.rb +8 -8
- data/spec/wui_spec.rb +19 -0
- metadata +44 -8
- data/features/katapult.feature +0 -271
- data/lib/katapult/util.rb +0 -16
data/features/katapult.feature
DELETED
@@ -1,271 +0,0 @@
|
|
1
|
-
Feature: Katapult in general
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given a pristine Rails application
|
5
|
-
|
6
|
-
|
7
|
-
Scenario: Install katapult
|
8
|
-
When I install katapult
|
9
|
-
Then the file "lib/katapult/application_model.rb" should contain exactly:
|
10
|
-
"""
|
11
|
-
# Here you define the fundamentals of your application.
|
12
|
-
#
|
13
|
-
# Add a model:
|
14
|
-
# model 'customer' do |customer|
|
15
|
-
# customer.attr :name
|
16
|
-
# customer.attr :birth, type: :date
|
17
|
-
# customer.attr :email
|
18
|
-
# end
|
19
|
-
#
|
20
|
-
# Add a web user interface:
|
21
|
-
# wui 'customer' do |wui|
|
22
|
-
# wui.action :index
|
23
|
-
# wui.action :show
|
24
|
-
# wui.action :lock, scope: :member, method: :post
|
25
|
-
# end
|
26
|
-
#
|
27
|
-
# Add navigation
|
28
|
-
# navigation :main
|
29
|
-
|
30
|
-
"""
|
31
|
-
|
32
|
-
|
33
|
-
Scenario: Generate basic files and settings
|
34
|
-
Given I install katapult
|
35
|
-
|
36
|
-
When I generate katapult basics
|
37
|
-
Then the file ".ruby-version" should contain "2.1.5"
|
38
|
-
|
39
|
-
|
40
|
-
And the file "config/cucumber.yml" should contain:
|
41
|
-
"""
|
42
|
-
default: <%= std_opts %> features
|
43
|
-
wip: --tags @wip:3 --wip features
|
44
|
-
parallel: <%= std_opts %> features <%= log_failures %>
|
45
|
-
rerun: -r features --format pretty --strict <%= rerun_failures %> <%= log_failures %>
|
46
|
-
"""
|
47
|
-
|
48
|
-
|
49
|
-
And the file ".gitignore" should contain "config/database.yml"
|
50
|
-
And the file "Gemfile" should contain "gem 'rails', '4.2.4'"
|
51
|
-
And the file "Gemfile" should contain exactly:
|
52
|
-
"""
|
53
|
-
source 'https://rubygems.org'
|
54
|
-
|
55
|
-
# from original Gemfile
|
56
|
-
gem 'rails', '4.2.4'
|
57
|
-
gem 'jquery-rails'
|
58
|
-
gem 'jbuilder', '~> 2.0'
|
59
|
-
gem 'katapult', path: '../../..'
|
60
|
-
|
61
|
-
# engines
|
62
|
-
gem 'haml-rails'
|
63
|
-
gem 'mysql2', '~> 0.3.18' # Work around require-error in Rails 4.2
|
64
|
-
|
65
|
-
# internal
|
66
|
-
gem 'exception_notification'
|
67
|
-
gem 'breach-mitigation-rails'
|
68
|
-
|
69
|
-
# better coding
|
70
|
-
gem 'modularity'
|
71
|
-
gem 'edge_rider'
|
72
|
-
gem 'andand'
|
73
|
-
|
74
|
-
# models
|
75
|
-
gem 'has_defaults'
|
76
|
-
gem 'assignable_values'
|
77
|
-
|
78
|
-
# gem 'carrierwave'
|
79
|
-
# gem 'mini_magick'
|
80
|
-
|
81
|
-
# gem 'spreadsheet'
|
82
|
-
# gem 'vcard'
|
83
|
-
|
84
|
-
# views
|
85
|
-
# gem 'simple_form'
|
86
|
-
# gem 'nested_form'
|
87
|
-
gem 'will_paginate'
|
88
|
-
gem 'makandra-navy', require: 'navy'
|
89
|
-
|
90
|
-
# assets
|
91
|
-
gem 'bootstrap-sass'
|
92
|
-
gem 'sass-rails'
|
93
|
-
gem 'autoprefixer-rails'
|
94
|
-
gem 'coffee-rails'
|
95
|
-
gem 'uglifier'
|
96
|
-
gem 'compass-rails', '>= 2.0.4' # fixes "uninitialized constant Sprockets::SassCacheStore"
|
97
|
-
gem 'compass-rgbapng'
|
98
|
-
|
99
|
-
group :development do
|
100
|
-
gem 'query_diet'
|
101
|
-
gem 'better_errors'
|
102
|
-
gem 'binding_of_caller'
|
103
|
-
gem 'thin'
|
104
|
-
|
105
|
-
gem 'parallel_tests'
|
106
|
-
gem 'guard-livereload', require: false
|
107
|
-
gem 'rack-livereload'
|
108
|
-
gem 'spring-commands-rspec'
|
109
|
-
gem 'spring-commands-cucumber'
|
110
|
-
end
|
111
|
-
|
112
|
-
group :development, :test do
|
113
|
-
gem 'byebug'
|
114
|
-
gem 'factory_girl_rails'
|
115
|
-
gem 'rspec-rails'
|
116
|
-
gem 'spring'
|
117
|
-
end
|
118
|
-
|
119
|
-
group :test do
|
120
|
-
gem 'database_cleaner'
|
121
|
-
gem 'timecop'
|
122
|
-
gem 'launchy'
|
123
|
-
|
124
|
-
gem 'capybara'
|
125
|
-
gem 'capybara-screenshot'
|
126
|
-
gem 'cucumber-rails', require: false
|
127
|
-
gem 'cucumber_factory'
|
128
|
-
gem 'selenium-webdriver'
|
129
|
-
gem 'spreewald'
|
130
|
-
|
131
|
-
gem 'rspec'
|
132
|
-
gem 'shoulda-matchers', require: false
|
133
|
-
end
|
134
|
-
|
135
|
-
"""
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
# Config
|
140
|
-
And the file "config/application.rb" should contain "config.time_zone = 'Berlin'"
|
141
|
-
And the file "config/database.yml" should contain exactly:
|
142
|
-
"""
|
143
|
-
common: &common
|
144
|
-
adapter: mysql2
|
145
|
-
encoding: utf8
|
146
|
-
username: katapult
|
147
|
-
password: secret
|
148
|
-
|
149
|
-
development:
|
150
|
-
<<: *common
|
151
|
-
database: katapult_test_app_development
|
152
|
-
|
153
|
-
test: &test
|
154
|
-
<<: *common
|
155
|
-
database: katapult_test_app_test<%= ENV['TEST_ENV_NUMBER'] %>
|
156
|
-
"""
|
157
|
-
|
158
|
-
And the file "config/database.sample.yml" should contain exactly:
|
159
|
-
"""
|
160
|
-
common: &common
|
161
|
-
adapter: mysql2
|
162
|
-
encoding: utf8
|
163
|
-
username: root
|
164
|
-
password:
|
165
|
-
|
166
|
-
development:
|
167
|
-
<<: *common
|
168
|
-
database: katapult_test_app_development
|
169
|
-
|
170
|
-
test:
|
171
|
-
<<: *common
|
172
|
-
database: katapult_test_app_test<%= ENV['TEST_ENV_NUMBER'] %>
|
173
|
-
"""
|
174
|
-
|
175
|
-
And the file "config/cucumber.yml" should contain:
|
176
|
-
"""
|
177
|
-
default: <%= std_opts %> features
|
178
|
-
wip: --tags @wip:3 --wip features
|
179
|
-
parallel: <%= std_opts %> features <%= log_failures %>
|
180
|
-
rerun: -r features --format pretty --strict <%= rerun_failures %> <%= log_failures %>
|
181
|
-
"""
|
182
|
-
And the file "config/initializers/find_by_anything.rb" should contain:
|
183
|
-
"""
|
184
|
-
ActiveRecord::Base.class_eval do
|
185
|
-
|
186
|
-
def self.find_by_anything(identifier)
|
187
|
-
"""
|
188
|
-
And the file "config/initializers/exception_notification.rb" should contain:
|
189
|
-
"""
|
190
|
-
ExceptionNotification.configure do |config|
|
191
|
-
|
192
|
-
config.add_notifier :email, {
|
193
|
-
email_prefix: '[katapult_test_app] ',
|
194
|
-
exception_recipients: %w[fail@makandra.de],
|
195
|
-
"""
|
196
|
-
And the file "config/initializers/form_for_with_development_errors.rb" should contain:
|
197
|
-
"""
|
198
|
-
if Rails.env == 'development'
|
199
|
-
|
200
|
-
ActionView::Helpers::FormHelper.class_eval do
|
201
|
-
|
202
|
-
def form_for_with_development_errors(*args, &block)
|
203
|
-
"""
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
# Tests
|
208
|
-
And the file "features/support/env-custom.rb" should contain:
|
209
|
-
"""
|
210
|
-
require 'spreewald/all_steps'
|
211
|
-
"""
|
212
|
-
And the file "features/support/cucumber_factory.rb" should contain:
|
213
|
-
"""
|
214
|
-
Cucumber::Factory.add_steps(self)
|
215
|
-
"""
|
216
|
-
And the file "features/support/capybara_screenshot.rb" should contain:
|
217
|
-
"""
|
218
|
-
require 'capybara-screenshot/cucumber'
|
219
|
-
|
220
|
-
# Keep up to the number of screenshots specified in the hash
|
221
|
-
Capybara::Screenshot.prune_strategy = { keep: 10 }
|
222
|
-
"""
|
223
|
-
And the file "features/support/database_cleaner.rb" should contain:
|
224
|
-
"""
|
225
|
-
DatabaseCleaner.clean_with(:deletion) # clean once, now
|
226
|
-
DatabaseCleaner.strategy = :transaction
|
227
|
-
Cucumber::Rails::Database.javascript_strategy = :deletion
|
228
|
-
"""
|
229
|
-
And a file named "features/support/paths.rb" should exist
|
230
|
-
And a file named "features/support/selectors.rb" should exist
|
231
|
-
And the file "spec/rails_helper.rb" should match /^Dir.Rails.root.join.+spec.support/
|
232
|
-
And the file "spec/support/shoulda_matchers.rb" should contain:
|
233
|
-
"""
|
234
|
-
require 'shoulda/matchers'
|
235
|
-
|
236
|
-
Shoulda::Matchers.configure do |config|
|
237
|
-
config.integrate do |with|
|
238
|
-
with.test_framework :rspec
|
239
|
-
with.library :rails
|
240
|
-
end
|
241
|
-
end
|
242
|
-
"""
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
# styles
|
247
|
-
And the file "app/assets/stylesheets/application.sass" should contain:
|
248
|
-
"""
|
249
|
-
@import compass
|
250
|
-
@import bootstrap
|
251
|
-
|
252
|
-
@import application/blocks/all
|
253
|
-
|
254
|
-
"""
|
255
|
-
And the file "app/assets/stylesheets/application/blocks/_all.sass" should contain exactly:
|
256
|
-
"""
|
257
|
-
@import items
|
258
|
-
@import layout
|
259
|
-
@import navigation
|
260
|
-
@import tools
|
261
|
-
|
262
|
-
"""
|
263
|
-
And a file named "app/assets/stylesheets/application/blocks/_items.sass" should exist
|
264
|
-
And a file named "app/assets/stylesheets/application/blocks/_layout.sass" should exist
|
265
|
-
And a file named "app/assets/stylesheets/application/blocks/_navigation.sass" should exist
|
266
|
-
And a file named "app/assets/stylesheets/application/blocks/_tools.sass" should exist
|
267
|
-
|
268
|
-
# And the file "config/deploy.rb" should contain exactly:
|
269
|
-
# """
|
270
|
-
# stages
|
271
|
-
# """
|
data/lib/katapult/util.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# Utility methods.
|
2
|
-
|
3
|
-
# The Katapult::Util module is used inside the `katapult` script. It should not
|
4
|
-
# require any gems in order to prevent version conflicts.
|
5
|
-
|
6
|
-
module Katapult
|
7
|
-
module Util
|
8
|
-
extend self
|
9
|
-
|
10
|
-
def git_commit(message)
|
11
|
-
message.gsub! /'/, "" # remove single quotes
|
12
|
-
system "git add --all; git commit -m '#{ message }' --author='katapult <katapult@makandra.com>'"
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|