brace 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/brace/app_builder.rb +42 -13
- data/lib/brace/generators/app_generator.rb +16 -25
- data/lib/brace/version.rb +1 -1
- data/templates/Gemfile.erb +2 -1
- data/templates/application.js.erb +54 -0
- data/templates/base_controller.rb +4 -0
- data/templates/bower.json.erb +20 -0
- data/templates/brace_layout.html.slim.erb +8 -11
- data/templates/sample.bowerrc +3 -0
- data/templates/slim.rb +1 -0
- data/templates/templates.js.erb +15 -0
- metadata +7 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caf08df2db40ea4fc9294374491917b56354a0af
|
4
|
+
data.tar.gz: 9f767180873e57d9b8ea2e3b66382704bb8e46e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04c40e5a773eb4a740436551edad7e5f33782f1bd5abc3386d5cf8eb1f6e50d400bda20940cc2aeb1c4bad69f05b3fa546f4a409992122943ed5bf04bd067210
|
7
|
+
data.tar.gz: ef491180d2d810eee694338d3412d2a2a3026701758d4cc004d42650f5bd935a8fbf3a332150216be8dd0e5fc4464274afbcbabd0a62d8c8e71557e200e69285
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Brace
|
2
2
|
|
3
|
-
Brace is a base Rails
|
3
|
+
Brace is a base Rails application.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -12,7 +12,7 @@ Then run:
|
|
12
12
|
|
13
13
|
brace projectname
|
14
14
|
|
15
|
-
This will create a Rails
|
15
|
+
This will create a Rails app in `projectname`.
|
16
16
|
|
17
17
|
## Gemfile
|
18
18
|
|
data/lib/brace/app_builder.rb
CHANGED
@@ -76,17 +76,12 @@ module Brace
|
|
76
76
|
|
77
77
|
def configure_action_mailer_development
|
78
78
|
config = <<-CONFIG
|
79
|
-
|
80
|
-
config.action_mailer.default_url_options = { host: 'localhost', port: #{port} }
|
79
|
+
config.action_mailer.delivery_method = :file
|
81
80
|
CONFIG
|
82
81
|
|
83
82
|
environment(config, env: 'development')
|
84
83
|
end
|
85
84
|
|
86
|
-
def configure_responders
|
87
|
-
application('config.app_generators.scaffold_controller :responders_controller')
|
88
|
-
end
|
89
|
-
|
90
85
|
def set_up_factory_girl_for_rspec
|
91
86
|
copy_file 'factory_girl_rspec.rb', 'spec/support/factory_girl.rb'
|
92
87
|
end
|
@@ -153,10 +148,6 @@ module Brace
|
|
153
148
|
remove_file "config/initializers/wrap_parameters.rb"
|
154
149
|
end
|
155
150
|
|
156
|
-
def create_partials_directory
|
157
|
-
empty_directory 'app/views/application'
|
158
|
-
end
|
159
|
-
|
160
151
|
def create_application_layout
|
161
152
|
template 'brace_layout.html.slim.erb',
|
162
153
|
'app/views/layouts/application.html.slim',
|
@@ -266,9 +257,34 @@ module Brace
|
|
266
257
|
'app/assets/stylesheets/application.css.scss'
|
267
258
|
end
|
268
259
|
|
269
|
-
def
|
270
|
-
|
271
|
-
|
260
|
+
def setup_templates
|
261
|
+
copy_file 'slim.rb', 'config/initializers/slim.rb'
|
262
|
+
copy_file 'templates.js.erb', 'app/assets/javascripts/angular/templates.js.erb'
|
263
|
+
end
|
264
|
+
|
265
|
+
def setup_javascripts
|
266
|
+
remove_file 'assets/javascripts/application.js'
|
267
|
+
template 'application.js.erb', 'assets/javascripts/application.js'
|
268
|
+
end
|
269
|
+
|
270
|
+
def setup_angular_routing
|
271
|
+
routes = <<-ROUTES
|
272
|
+
get "*path", to: "application#index"
|
273
|
+
root 'application#index'
|
274
|
+
ROUTES
|
275
|
+
|
276
|
+
action = <<-ACTION
|
277
|
+
def index
|
278
|
+
render text: "", layout: "application"
|
279
|
+
end
|
280
|
+
ACTION
|
281
|
+
|
282
|
+
inject_into_file('config/routes.rb', routes, before: 'end')
|
283
|
+
inject_into_file('app/controllers/application_controller.rb', action, before: 'end')
|
284
|
+
end
|
285
|
+
|
286
|
+
def install_devise_token_auth
|
287
|
+
generate 'devise_token_auth:install Account auth'
|
272
288
|
end
|
273
289
|
|
274
290
|
def install_bitters
|
@@ -277,6 +293,15 @@ module Brace
|
|
277
293
|
|
278
294
|
def install_responders
|
279
295
|
generate 'responders:install'
|
296
|
+
application('config.app_generators.scaffold_controller :responders_controller')
|
297
|
+
end
|
298
|
+
|
299
|
+
def install_bower
|
300
|
+
template 'bower.json.erb', 'bower.json'
|
301
|
+
copy_file 'sample.bowerrc', '.bowerrc'
|
302
|
+
application("config.assets.paths << Rails.root.join('vendor', 'assets', 'components')
|
303
|
+
")
|
304
|
+
run 'bower install'
|
280
305
|
end
|
281
306
|
|
282
307
|
def gitignore_files
|
@@ -396,6 +421,10 @@ you can deploy to staging and production with:
|
|
396
421
|
end
|
397
422
|
end
|
398
423
|
|
424
|
+
def add_base_controller
|
425
|
+
copy_file 'base_controller.rb', 'app/controllers/api/base_controller.rb'
|
426
|
+
end
|
427
|
+
|
399
428
|
def remove_routes_comment_lines
|
400
429
|
replace_in_file 'config/routes.rb',
|
401
430
|
/Rails\.application\.routes\.draw do.*end/m,
|
@@ -35,15 +35,13 @@ module Brace
|
|
35
35
|
invoke :setup_test_environment
|
36
36
|
invoke :setup_production_environment
|
37
37
|
invoke :setup_secret_token
|
38
|
-
invoke :create_brace_views
|
39
38
|
invoke :configure_app
|
39
|
+
invoke :remove_routes_comment_lines
|
40
40
|
invoke :setup_stylesheets
|
41
|
-
invoke :
|
42
|
-
invoke :
|
43
|
-
invoke :install_responders
|
41
|
+
invoke :setup_angular
|
42
|
+
invoke :setup_api
|
44
43
|
invoke :copy_miscellaneous_files
|
45
44
|
invoke :customize_error_pages
|
46
|
-
invoke :remove_routes_comment_lines
|
47
45
|
invoke :setup_stripe
|
48
46
|
invoke :setup_git
|
49
47
|
invoke :setup_redis
|
@@ -56,6 +54,14 @@ module Brace
|
|
56
54
|
invoke :outro
|
57
55
|
end
|
58
56
|
|
57
|
+
def setup_angular
|
58
|
+
build :install_bower
|
59
|
+
build :setup_templates
|
60
|
+
build :setup_javascripts
|
61
|
+
build :setup_angular_routing
|
62
|
+
build :create_application_layout
|
63
|
+
end
|
64
|
+
|
59
65
|
def customize_gemfile
|
60
66
|
build :replace_gemfile
|
61
67
|
build :set_ruby_to_version_being_used
|
@@ -116,13 +122,6 @@ module Brace
|
|
116
122
|
build :setup_secret_token
|
117
123
|
end
|
118
124
|
|
119
|
-
def create_brace_views
|
120
|
-
say 'Creating api template views'
|
121
|
-
build :create_partials_directory
|
122
|
-
build :create_shared_javascripts
|
123
|
-
build :create_application_layout
|
124
|
-
end
|
125
|
-
|
126
125
|
def configure_app
|
127
126
|
say 'Configuring app'
|
128
127
|
build :configure_action_mailer
|
@@ -130,7 +129,6 @@ module Brace
|
|
130
129
|
build :configure_rack_timeout
|
131
130
|
build :configure_eager_load_paths
|
132
131
|
build :configure_action_mailer_previews
|
133
|
-
build :configure_responders
|
134
132
|
build :disable_xml_params
|
135
133
|
build :fix_i18n_deprecation_warning
|
136
134
|
build :setup_default_rake_task
|
@@ -140,20 +138,13 @@ module Brace
|
|
140
138
|
def setup_stylesheets
|
141
139
|
say 'Set up stylesheets'
|
142
140
|
build :setup_stylesheets
|
143
|
-
end
|
144
|
-
|
145
|
-
def install_devise
|
146
|
-
say 'Install Devise'
|
147
|
-
build :install_devise
|
148
|
-
end
|
149
|
-
|
150
|
-
def install_bitters
|
151
|
-
say 'Install Bitters'
|
152
141
|
build :install_bitters
|
153
142
|
end
|
154
143
|
|
155
|
-
def
|
156
|
-
say '
|
144
|
+
def setup_api
|
145
|
+
say 'Set up json api'
|
146
|
+
build :add_base_controller
|
147
|
+
build :install_devise_token_auth
|
157
148
|
build :install_responders
|
158
149
|
end
|
159
150
|
|
@@ -231,7 +222,7 @@ module Brace
|
|
231
222
|
end
|
232
223
|
|
233
224
|
def outro
|
234
|
-
say '
|
225
|
+
say 'Brace your self! You just generated a Rails app!'
|
235
226
|
say "Remember to run 'rails generate rollbar' with your token."
|
236
227
|
end
|
237
228
|
|
data/lib/brace/version.rb
CHANGED
data/templates/Gemfile.erb
CHANGED
@@ -16,7 +16,6 @@ gem 'uglifier'
|
|
16
16
|
gem 'therubyracer'
|
17
17
|
|
18
18
|
# Frontend JS
|
19
|
-
gem 'react-rails'
|
20
19
|
gem 'jquery-rails'
|
21
20
|
|
22
21
|
# Frontend HTML/CSS
|
@@ -53,7 +52,9 @@ gem 'email_validator'
|
|
53
52
|
gem 'stripe'
|
54
53
|
|
55
54
|
# Authentication
|
55
|
+
gem 'omniauth'
|
56
56
|
gem 'devise'
|
57
|
+
gem 'devise_token_auth'
|
57
58
|
|
58
59
|
group :development, :test do
|
59
60
|
gem 'rspec-rails', '~> 3.1.0'
|
@@ -0,0 +1,54 @@
|
|
1
|
+
/*
|
2
|
+
= require jquery
|
3
|
+
|
4
|
+
= require angular
|
5
|
+
|
6
|
+
= require lodash
|
7
|
+
= require restangular
|
8
|
+
= require angular-ui-router
|
9
|
+
= require angular-cookie
|
10
|
+
= require ng-token-auth
|
11
|
+
= require angular-bacon
|
12
|
+
= require_self
|
13
|
+
= require_tree ./angular/templates
|
14
|
+
= require_tree .
|
15
|
+
*/
|
16
|
+
|
17
|
+
var App = angular.module('<%= app_name %>', [
|
18
|
+
'ui.router',
|
19
|
+
'templates',
|
20
|
+
'restangular',
|
21
|
+
'ipCookie',
|
22
|
+
'ng-token-auth',
|
23
|
+
'angular-bacon'
|
24
|
+
]);
|
25
|
+
|
26
|
+
App.config(['$stateProvider', '$urlRouterProvider', '$locationProvider', 'RestangularProvider', '$authProvider',
|
27
|
+
function($stateProvider, $urlRouterProvider, $locationProvider, RestangularProvider, $authProvider) {
|
28
|
+
RestangularProvider.setBaseUrl("/api");
|
29
|
+
RestangularProvider.setDefaultRequestParams({format: "json"});
|
30
|
+
|
31
|
+
$authProvider.configure({
|
32
|
+
apiUrl: 'http://<%= app_name %>.com/api'
|
33
|
+
});
|
34
|
+
|
35
|
+
$locationProvider.html5Mode(true);
|
36
|
+
$urlRouterProvider.otherwise("/widgets");
|
37
|
+
|
38
|
+
$stateProvider
|
39
|
+
.state('widgets', {
|
40
|
+
url: "/widgets",
|
41
|
+
abstract: true,
|
42
|
+
template: "<div ui-view></div>"
|
43
|
+
})
|
44
|
+
.state('widgets.list', {
|
45
|
+
url: "",
|
46
|
+
templateUrl: "widgets/index.html",
|
47
|
+
controller: "WidgetsListController"
|
48
|
+
}).
|
49
|
+
state('widgets.show', {
|
50
|
+
url: "/widgets/:id",
|
51
|
+
templateUrl: "widgets/show.html",
|
52
|
+
controller: "WidgetsShowController"
|
53
|
+
});
|
54
|
+
}]);
|
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"name": "<%= app_name %>",
|
3
|
+
"private": true,
|
4
|
+
"ignore": [
|
5
|
+
"**/.*",
|
6
|
+
"node_modules",
|
7
|
+
"bower_components",
|
8
|
+
"test",
|
9
|
+
"tests"
|
10
|
+
],
|
11
|
+
"dependencies": {
|
12
|
+
"lodash": "~2.4.1",
|
13
|
+
"angular": "~1.3.13",
|
14
|
+
"angular-ui-router": "~0.2.13",
|
15
|
+
"restangular": "~1.4.0",
|
16
|
+
"ng-token-auth": "~0.0.24",
|
17
|
+
"angular-cookie": "~4.0.6",
|
18
|
+
"angular-bacon": "~2.0.0"
|
19
|
+
}
|
20
|
+
}
|
@@ -1,15 +1,12 @@
|
|
1
|
-
doctype
|
2
|
-
html
|
1
|
+
doctype 5
|
2
|
+
html( ng-app="#{title}" )
|
3
3
|
head
|
4
4
|
meta name="ROBOTS" content="NOODP"
|
5
5
|
meta name="viewport" content="width=device-width, initial-scale=1.0"
|
6
|
-
/ Configure default and controller-, and view-specific titles in
|
7
|
-
/ config/locales/en.yml. For more see:
|
8
|
-
/ https://github.com/calebthompson/title#usage
|
9
6
|
title = title
|
10
|
-
= stylesheet_link_tag
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
7
|
+
= stylesheet_link_tag 'application', media: 'all'
|
8
|
+
body
|
9
|
+
.container
|
10
|
+
div ui-view=true
|
11
|
+
|
12
|
+
= javascript_include_tag 'application'
|
data/templates/slim.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Slim::Engine.set_options merge_attrs: { '(' => ')', '[' => ']' }
|
@@ -0,0 +1,15 @@
|
|
1
|
+
angular.module('templates', []).
|
2
|
+
|
3
|
+
run(['$templateCache', function($templateCache) {
|
4
|
+
<%
|
5
|
+
environment.context_class.instance_eval { include ActionView::Helpers::JavaScriptHelper }
|
6
|
+
app_root = File.expand_path('../../angular', __FILE__)
|
7
|
+
templates = File.join(app_root, %w{templates ** *.slim})
|
8
|
+
Dir.glob(templates).each do |f|
|
9
|
+
depend_on(f)
|
10
|
+
key = f.gsub(%r(^#{app_root}/templates/),'').gsub(/.slim$/, "")
|
11
|
+
content = environment.find_asset(f).body
|
12
|
+
%>
|
13
|
+
$templateCache.put("<%= key %>", "<%= escape_javascript(content) %>");
|
14
|
+
<% end %>
|
15
|
+
}]);
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harry Whelchel
|
@@ -132,8 +132,11 @@ files:
|
|
132
132
|
- templates/_javascript.html.erb
|
133
133
|
- templates/action_mailer.rb
|
134
134
|
- templates/application.css.scss
|
135
|
+
- templates/application.js.erb
|
136
|
+
- templates/base_controller.rb
|
135
137
|
- templates/bin_deploy
|
136
138
|
- templates/bin_setup.erb
|
139
|
+
- templates/bower.json.erb
|
137
140
|
- templates/brace_gitignore
|
138
141
|
- templates/brace_layout.html.slim.erb
|
139
142
|
- templates/bundler_audit.rake
|
@@ -152,13 +155,16 @@ files:
|
|
152
155
|
- templates/rack_timeout.rb
|
153
156
|
- templates/rails_helper.rb
|
154
157
|
- templates/redis.rb
|
158
|
+
- templates/sample.bowerrc
|
155
159
|
- templates/sample.env
|
156
160
|
- templates/secrets.yml
|
157
161
|
- templates/sidekiq.rb
|
158
162
|
- templates/sidekiq_rspec.rb
|
163
|
+
- templates/slim.rb
|
159
164
|
- templates/smtp.rb
|
160
165
|
- templates/spec_helper.rb
|
161
166
|
- templates/stripe.rb
|
167
|
+
- templates/templates.js.erb
|
162
168
|
- templates/vcr_helper.rb
|
163
169
|
homepage: https://github.com/hwhelchel/brace
|
164
170
|
licenses:
|