milia 1.2.1 → 1.3.1.beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/confirmations_controller.rb +7 -7
  3. data/app/controllers/registrations_controller.rb +13 -19
  4. data/app/views/devise/registrations/new.html.haml +53 -0
  5. data/lib/generators/milia/install_generator.rb +44 -41
  6. data/lib/generators/milia/templates/devise_permitted_parameters.rb +18 -0
  7. data/lib/generators/milia/templates/initializer.rb +3 -9
  8. data/lib/milia.rb +3 -22
  9. data/lib/milia/base.rb +88 -109
  10. data/lib/milia/control.rb +25 -25
  11. data/lib/milia/invite_member.rb +6 -6
  12. data/lib/milia/version.rb +1 -1
  13. metadata +16 -184
  14. data/.document +0 -5
  15. data/.gitignore +0 -94
  16. data/.ruby-gemset +0 -1
  17. data/.ruby-version +0 -1
  18. data/.slugignore +0 -2
  19. data/.travis.yml +0 -4
  20. data/Gemfile +0 -4
  21. data/LICENSE.txt +0 -20
  22. data/README.md +0 -1207
  23. data/Rakefile +0 -1
  24. data/doc/gemfile_addition.txt +0 -28
  25. data/doc/manual_sample.sh +0 -816
  26. data/doc/ref_notes.txt +0 -155
  27. data/doc/sample.sh +0 -276
  28. data/markdown.rb +0 -38
  29. data/milia.gemspec +0 -29
  30. data/test/.ruby-gemset +0 -1
  31. data/test/.ruby-version +0 -1
  32. data/test/Gemfile +0 -81
  33. data/test/Gemfile.lock +0 -223
  34. data/test/README.md +0 -83
  35. data/test/Rakefile +0 -6
  36. data/test/app/assets/javascripts/application.js +0 -16
  37. data/test/app/assets/stylesheets/application.css +0 -13
  38. data/test/app/controllers/application_controller.rb +0 -13
  39. data/test/app/controllers/home_controller.rb +0 -10
  40. data/test/app/helpers/application_helper.rb +0 -2
  41. data/test/app/models/member.rb +0 -34
  42. data/test/app/models/post.rb +0 -14
  43. data/test/app/models/team.rb +0 -9
  44. data/test/app/models/team_asset.rb +0 -6
  45. data/test/app/models/tenant.rb +0 -54
  46. data/test/app/models/user.rb +0 -14
  47. data/test/app/models/zine.rb +0 -8
  48. data/test/app/views/home/index.html.erb +0 -2
  49. data/test/app/views/home/show.html.erb +0 -2
  50. data/test/app/views/layouts/application.html.erb +0 -14
  51. data/test/bin/bundle +0 -3
  52. data/test/bin/rails +0 -4
  53. data/test/bin/rake +0 -4
  54. data/test/config/application.rb +0 -36
  55. data/test/config/boot.rb +0 -4
  56. data/test/config/database.yml +0 -25
  57. data/test/config/environment.rb +0 -5
  58. data/test/config/environments/development.rb +0 -48
  59. data/test/config/environments/production.rb +0 -95
  60. data/test/config/environments/test.rb +0 -42
  61. data/test/config/initializers/backtrace_silencers.rb +0 -7
  62. data/test/config/initializers/devise.rb +0 -254
  63. data/test/config/initializers/filter_parameter_logging.rb +0 -4
  64. data/test/config/initializers/inflections.rb +0 -16
  65. data/test/config/initializers/milia.rb +0 -51
  66. data/test/config/initializers/mime_types.rb +0 -5
  67. data/test/config/initializers/secret_token.rb +0 -12
  68. data/test/config/initializers/session_store.rb +0 -3
  69. data/test/config/initializers/wrap_parameters.rb +0 -14
  70. data/test/config/locales/en.yml +0 -23
  71. data/test/config/routes.rb +0 -77
  72. data/test/db/migrate/20111012050200_add_sessions_table.rb +0 -12
  73. data/test/db/migrate/20111012050340_devise_create_users.rb +0 -48
  74. data/test/db/migrate/20111012050532_create_tenants.rb +0 -11
  75. data/test/db/migrate/20111012050600_create_tenants_users_join_table.rb +0 -8
  76. data/test/db/migrate/20111012050650_create_members.rb +0 -12
  77. data/test/db/migrate/20111012231923_create_posts.rb +0 -12
  78. data/test/db/migrate/20111013050657_create_zines.rb +0 -10
  79. data/test/db/migrate/20111013050753_create_teams.rb +0 -10
  80. data/test/db/migrate/20111013050837_create_team_assets.rb +0 -11
  81. data/test/db/schema.rb +0 -126
  82. data/test/db/seeds.rb +0 -7
  83. data/test/test/controllers/home_controller_test.rb +0 -132
  84. data/test/test/ctlr_test_helper.rb +0 -11
  85. data/test/test/fixtures/members.yml +0 -35
  86. data/test/test/fixtures/posts.yml +0 -96
  87. data/test/test/fixtures/team_assets.yml +0 -30
  88. data/test/test/fixtures/teams.yml +0 -17
  89. data/test/test/fixtures/tenants.yml +0 -12
  90. data/test/test/fixtures/tenants_users.yml +0 -15
  91. data/test/test/fixtures/users.yml +0 -33
  92. data/test/test/fixtures/zines.yml +0 -25
  93. data/test/test/models/member_test.rb +0 -75
  94. data/test/test/models/post_test.rb +0 -66
  95. data/test/test/models/team_test.rb +0 -49
  96. data/test/test/models/tenant_test.rb +0 -228
  97. data/test/test/models/user_test.rb +0 -182
  98. data/test/test/models/zine_test.rb +0 -40
  99. data/test/test/test_helper.rb +0 -31
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b17d04a8171ccbdc169aa06e5f1d28c5e850c3e2
4
- data.tar.gz: c5d93e06cbd053b83c4704ba0fabcd6b1c809c7e
3
+ metadata.gz: 9ed96e5afeb4152e44970a6664278b86cd09502a
4
+ data.tar.gz: 63c802985d9d2de9c28414ff75c953bac2367762
5
5
  SHA512:
6
- metadata.gz: 76db8065475838404861cada72daaad22cd582c3233ff455ce411a3daf512de8bad59c71788684db5e6cb524758af7620d15013c7efe4df502b62811bc00b81a
7
- data.tar.gz: 1fa75ebac26ede1a0f394e3fac189e20753af27bcd44d6247377856d1ab1838c4a6f10be693d091ac7a3698fb95cd80cad791a544fc13f0652e434313e424889
6
+ metadata.gz: d11276fda2e906bd83a3a0753c13191929e137e1cd8fee143561ec05ac7b2069d91314b341dea79e75758c482683648c6718af33e68cb94a1049f187d11eb922
7
+ data.tar.gz: 0f496a172b226040e8f8be3f04b371122219d175b67563328abd4d374899637ca0ded64bc0ee05b5314f40ff07f32cfd46534f7b38aef3ba6315aac9f531a5e9
@@ -5,7 +5,7 @@ module Milia
5
5
 
6
6
  class ConfirmationsController < Devise::ConfirmationsController
7
7
 
8
- skip_before_action :authenticate_tenant!
8
+ skip_before_action :authenticate_tenant!
9
9
  before_action :set_confirmable, :only => [ :update, :show ]
10
10
 
11
11
 
@@ -24,7 +24,7 @@ module Milia
24
24
  set_flash_message(:notice, :confirmed) if is_flashing_format?
25
25
  # sign in automatically
26
26
  sign_in_tenanted_and_redirect(resource)
27
-
27
+
28
28
  else
29
29
  log_action( "invitee confirmation failed" )
30
30
  respond_with_navigational(resource.errors, :status => :unprocessable_entity){ render :new }
@@ -41,11 +41,11 @@ module Milia
41
41
  # entered on new sign-ups and invite-members
42
42
  def show
43
43
  if @confirmable.new_record? ||
44
- !::Milia.use_invite_member ||
44
+ !::Milia.use_invite_member ||
45
45
  @confirmable.skip_confirm_change_password
46
46
 
47
47
  log_action( "devise pass-thru" )
48
- super # this will redirect
48
+ super # this will redirect
49
49
  if @confirmable.skip_confirm_change_password
50
50
  sign_in_tenanted(resource)
51
51
  end
@@ -56,7 +56,7 @@ module Milia
56
56
  # else fall thru to show template which is form to set a password
57
57
  # upon SUBMIT, processing will continue from update
58
58
  end
59
-
59
+
60
60
  protected
61
61
 
62
62
  def set_confirmable()
@@ -80,7 +80,7 @@ module Milia
80
80
  "MILIA >>>>> [confirm user] #{action} - #{@confirmable.email}"
81
81
  ) unless logger.nil?
82
82
  end
83
-
83
+
84
84
  # MILIA: adaptation of Devise method for multitenanting
85
85
  # Sign in a user
86
86
  def sign_in_tenanted(resource)
@@ -89,7 +89,7 @@ module Milia
89
89
  set_current_tenant
90
90
  end
91
91
 
92
- # Sign in a user and tries to redirect
92
+ # Sign in a user and tries to redirect
93
93
  def sign_in_tenanted_and_redirect(resource)
94
94
  sign_in_tenanted(resource)
95
95
  redirect_to after_sign_in_path_for(resource)
@@ -1,6 +1,6 @@
1
1
  module Milia
2
2
 
3
- class RegistrationsController < Devise::RegistrationsController
3
+ class RegistrationsController < ::Devise::RegistrationsController
4
4
 
5
5
  skip_before_action :authenticate_tenant!, :only => [:new, :create, :cancel]
6
6
 
@@ -19,7 +19,7 @@ def create
19
19
  tenant_params = sign_up_params_tenant
20
20
  user_params = sign_up_params_user
21
21
  coupon_params = sign_up_params_coupon
22
-
22
+
23
23
  sign_out_session!
24
24
  # next two lines prep signup view parameters
25
25
  prep_signup_view( tenant_params, user_params, coupon_params )
@@ -27,10 +27,10 @@ def create
27
27
  # validate recaptcha first unless not enabled
28
28
  if !::Milia.use_recaptcha || verify_recaptcha
29
29
 
30
- Tenant.transaction do
30
+ Tenant.transaction do
31
31
  @tenant = Tenant.create_new_tenant( tenant_params, user_params, coupon_params)
32
32
  if @tenant.errors.empty? # tenant created
33
-
33
+
34
34
  initiate_tenant( @tenant ) # first time stuff for new tenant
35
35
 
36
36
  devise_create( user_params ) # devise resource(user) creation; sets resource
@@ -43,7 +43,7 @@ def create
43
43
 
44
44
  else # user creation failed; force tenant rollback
45
45
  log_action( "signup user create failed", resource )
46
- raise ActiveRecord::Rollback # force the tenant transaction to be rolled back
46
+ raise ActiveRecord::Rollback # force the tenant transaction to be rolled back
47
47
  end # if..then..else for valid user creation
48
48
 
49
49
  else
@@ -53,7 +53,7 @@ def create
53
53
  end # if .. then .. else no tenant errors
54
54
 
55
55
  end # wrap tenant/user creation in a transaction
56
-
56
+
57
57
  else
58
58
  flash[:error] = "Recaptcha codes didn't match; please try again"
59
59
  # all validation errors are passed when the sign_up form is re-rendered
@@ -70,12 +70,6 @@ end # def create
70
70
 
71
71
  protected
72
72
 
73
- # ------------------------------------------------------------------------------
74
- # ------------------------------------------------------------------------------
75
- def configure_permitted_parameters
76
- devise_parameter_sanitizer.for(:sign_up) + ::Milia.whitelist_user_params
77
- end
78
-
79
73
  # ------------------------------------------------------------------------------
80
74
  # ------------------------------------------------------------------------------
81
75
  def sign_up_params_tenant()
@@ -85,14 +79,14 @@ end # def create
85
79
  # ------------------------------------------------------------------------------
86
80
  # ------------------------------------------------------------------------------
87
81
  def sign_up_params_user()
88
- params.require(:user).permit( ::Milia.whitelist_user_params )
82
+ devise_parameter_sanitizer.sanitize(:sign_up)
89
83
  end
90
84
 
91
85
  # ------------------------------------------------------------------------------
92
86
  # sign_up_params_coupon -- permit coupon parameter if used; else params
93
87
  # ------------------------------------------------------------------------------
94
88
  def sign_up_params_coupon()
95
- ( ::Milia.use_coupon ?
89
+ ( ::Milia.use_coupon ?
96
90
  params.require(:coupon).permit( ::Milia.whitelist_coupon_params ) :
97
91
  params
98
92
  )
@@ -112,13 +106,13 @@ end # def create
112
106
  def devise_create( user_params )
113
107
 
114
108
  build_resource(user_params)
115
-
109
+
116
110
  # if we're using milia's invite_member helpers
117
111
  if ::Milia.use_invite_member
118
112
  # then flag for our confirmable that we won't need to set up a password
119
113
  resource.skip_confirm_change_password = true
120
114
  end
121
-
115
+
122
116
  if resource.save
123
117
  yield resource if block_given?
124
118
  log_action( "devise: signup user success", resource )
@@ -134,7 +128,7 @@ end # def create
134
128
  else
135
129
  clean_up_passwords resource
136
130
  log_action( "devise: signup user failure", resource )
137
- prep_signup_view( @tenant, resource, params[:coupon] )
131
+ prep_signup_view( @tenant, resource, params[:coupon] )
138
132
  respond_with resource
139
133
  end
140
134
  end
@@ -161,10 +155,10 @@ end # def create
161
155
  "MILIA >>>>> [register user/org] #{action} - #{err_msg}"
162
156
  ) unless logger.nil?
163
157
  end
164
-
158
+
165
159
  # ------------------------------------------------------------------------------
166
160
  # ------------------------------------------------------------------------------
167
-
161
+
168
162
  # ------------------------------------------------------------------------------
169
163
  # ------------------------------------------------------------------------------
170
164
 
@@ -0,0 +1,53 @@
1
+ %div.authform
2
+ %h1 Simple Milia App
3
+ .block#block-signup
4
+ %h2 New Organizational Sign up
5
+ .content
6
+ %span.description
7
+ %i
8
+ If you're a member of an existing group in our system,
9
+ click the activate link in the invitation email from your organization's admin.
10
+ You should not sign up for a new organizational account.
11
+ %br
12
+ .flash
13
+ - flash.each do |type, message|
14
+ %div{ :class => "message #{type}" }
15
+ %p= message
16
+ - flash.clear # clear contents so we won't see it again
17
+
18
+ = form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :class => "form" }) do |f|
19
+ = devise_error_messages!
20
+ .group
21
+ = f.label :email, :class => "label"
22
+ = f.text_field :email, :class => "text_field"
23
+ %span.description Ex. test@example.com
24
+ .group
25
+ = f.label :password, :class => "label"
26
+ = f.password_field :password, :class => "text_field"
27
+ %span.description must be at least 8 characters
28
+ .group
29
+ = f.label :password_confirmation, "Re-enter Password", :class => "label"
30
+ = f.password_field :password_confirmation, :class => "text_field"
31
+ %span.description to confirm your password
32
+
33
+ .group
34
+ = fields_for( :tenant ) do |w|
35
+ = w.label( :name, 'Organization', :class => "label" )
36
+ = w.text_field( :name, :class => "text_field")
37
+ %span.description unique name for your group or organization for the new account
38
+
39
+ - if ::Milia.use_coupon
40
+ - @coupon ||= {}
41
+ .group
42
+ = label_tag( 'coupon', 'Coupon code', :class => "label" )
43
+ = text_field_tag( "coupon[coupon]", @coupon['coupon'].to_s, :size => 8, :class => "text_field" )
44
+ %span.description optional promotional code, if any
45
+
46
+ - if ::Milia.use_recaptcha
47
+ = recaptcha_tags( :display => { :theme => 'clean', :tabindex => 0 } )
48
+
49
+ .group.navform.wat-cf
50
+ %button.button{ :type => "submit" }
51
+ Sign up
52
+ = render :partial => "devise/shared/links"
53
+
@@ -3,18 +3,19 @@ require 'rails/generators/base'
3
3
  module Milia
4
4
  module Generators
5
5
  # *************************************************************
6
-
6
+
7
7
  class InstallGenerator < Rails::Generators::Base
8
8
  desc "Full installation of milia with devise"
9
9
 
10
10
  source_root File.expand_path("../templates", __FILE__)
11
-
11
+
12
12
  class_option :use_airbrake, :type => :boolean, :default => false, :desc => 'Use this option to add airbrake exception handling capabilities'
13
- class_option :skip_recaptcha, :type => :boolean, :default => false, :desc => 'Use this option to skip adding recaptcha for sign ups'
13
+ class_option :skip_recaptcha, :type => :boolean, :default => true, :desc => 'Use this option to skip adding recaptcha for sign ups'
14
14
  class_option :skip_invite_member, :type => :boolean, :default => false, :desc => 'Use this option to skip adding invite_member capabilities'
15
15
  class_option :skip_env_email_setup, :type => :boolean, :default => false, :desc => 'Use this option to skip adding smtp email info to config/environments/*'
16
16
  class_option :org_email, :type => :string, :default => "my-email@my-domain.com", :desc => 'define the organizational email from address'
17
-
17
+ class_option :skip_devise_generators, :type => :boolean, :default => false, :desc => 'skip execution of devise generators (if this has already been done previously)'
18
+
18
19
  # -------------------------------------------------------------
19
20
  # -------------------------------------------------------------
20
21
  def check_requirements()
@@ -34,7 +35,7 @@ module Milia
34
35
  # replaced it with the "run_bundle" method below
35
36
  # -------------------------------------------------------------
36
37
  def setup_initial_stuff
37
-
38
+ copy_file 'devise_permitted_parameters.rb', 'config/initializers/devise_permitted_parameters.rb'
38
39
  template 'initializer.rb', 'config/initializers/milia.rb'
39
40
 
40
41
  unless options.skip_recaptcha
@@ -45,15 +46,17 @@ module Milia
45
46
  end
46
47
 
47
48
  gem 'activerecord-session_store', github: 'rails/activerecord-session_store'
48
-
49
+
49
50
  run_bundle
50
51
  end
51
52
 
52
53
  # -------------------------------------------------------------
53
54
  # -------------------------------------------------------------
54
55
  def setup_devise
55
- generate "devise:install"
56
- generate "devise", "user"
56
+ unless options.skip_devise_generators
57
+ generate "devise:install"
58
+ generate "devise", "user"
59
+ end
57
60
  gsub_file "app/models/user.rb", /,\s*$/, ", :confirmable,"
58
61
 
59
62
  migrate_user_file = find_or_fail("db/migrate/[0-9]*_devise_create_users.rb")
@@ -71,7 +74,11 @@ module Milia
71
74
  # -------------------------------------------------------------
72
75
  def setup_milia
73
76
 
74
- unless false # future skip block??
77
+ unless false # future skip block??
78
+ inject_into_file "app/controllers/application_controller.rb",
79
+ after: "protect_from_forgery with: :exception\n" do
80
+ snippet_app_ctlr_header
81
+ end
75
82
 
76
83
  route snippet_routes_root_path
77
84
 
@@ -80,30 +87,25 @@ module Milia
80
87
  generate "model", "tenant tenant:references name:string:index"
81
88
  generate "migration", "CreateTenantsUsersJoinTable tenants users"
82
89
 
83
- inject_into_file "app/controllers/application_controller.rb",
84
- after: "protect_from_forgery with: :exception\n" do
85
- snippet_app_ctlr_header
86
- end
87
-
88
- inject_into_class "app/controllers/home_controller.rb", HomeController do
90
+ inject_into_class "app/controllers/home_controller.rb", HomeController do
89
91
  snippet_home_ctlr_header
90
92
  end
91
93
 
92
94
  join_file = find_or_fail("db/migrate/[0-9]*_create_tenants_users_join_table.rb")
93
- uncomment_lines join_file, ":tenant_id, :user_id"
95
+ uncomment_lines join_file, ":tenant_id, :user_id"
94
96
 
95
- gsub_file "config/routes.rb", "devise_for :users" do
97
+ gsub_file "config/routes.rb", "devise_for :users" do
96
98
  snippet_routes_devise
97
99
  end
98
100
 
99
101
  inject_into_file "app/models/user.rb",
100
- after: ":recoverable, :rememberable, :trackable, :validatable\n" do
102
+ after: ":recoverable, :rememberable, :trackable, :validatable\n" do
101
103
  snippet_model_user_determines_account
102
104
  end
103
105
 
104
106
  gsub_file "app/models/tenant.rb", /belongs_to \:tenant/, ' '
105
107
 
106
- inject_into_class "app/models/tenant.rb", Tenant do
108
+ inject_into_class "app/models/tenant.rb", Tenant do
107
109
  snippet_model_tenant_determines_tenant
108
110
  end
109
111
 
@@ -117,29 +119,30 @@ module Milia
117
119
  generate "resource", "member tenant:references user:references first_name:string last_name:string"
118
120
 
119
121
  inject_into_file "app/models/tenant.rb",
120
- after: "acts_as_universal_and_determines_tenant\n" do
122
+ after: "acts_as_universal_and_determines_tenant\n" do
121
123
  snippet_add_assoc_to_tenant
122
124
  end
123
125
 
124
126
  uncomment_lines "app/models/tenant.rb", "create_org_admin"
125
127
 
126
128
  inject_into_file "app/models/user.rb",
127
- after: "acts_as_universal_and_determines_account\n" do
129
+ after: "acts_as_universal_and_determines_account\n" do
128
130
  snippet_add_member_assoc_to_user
129
131
  end
130
132
 
131
133
  gsub_file "app/models/member.rb", /belongs_to \:tenant/, ' '
132
134
 
133
135
  inject_into_file "app/models/member.rb",
134
- after: "belongs_to :user\n" do
136
+ after: "belongs_to :user\n" do
135
137
  snippet_fill_out_member
136
138
  end
137
139
 
138
- inject_into_class "app/controllers/members_controller.rb", MembersController do
140
+ inject_into_class "app/controllers/members_controller.rb", MembersController do
139
141
  snippet_fill_member_ctlr
140
142
  end
141
143
 
142
144
  directory File.expand_path('../../../../app/views/members', __FILE__), "app/views/members"
145
+ directory File.expand_path('../../../../app/views/devise/registrations', __FILE__), "app/views/devise/registrations"
143
146
 
144
147
 
145
148
  end # skip any member expansion
@@ -150,20 +153,20 @@ module Milia
150
153
  def setup_environments
151
154
 
152
155
  unless options.skip_env_email_setup
153
-
154
- environment nil, env: :development do
156
+
157
+ environment nil, env: :development do
155
158
  snippet_env_dev
156
159
  end # do dev environment
157
160
 
158
- environment nil, env: :production do
161
+ environment nil, env: :production do
159
162
  snippet_env_prod
160
163
  end # do production environment
161
164
 
162
- environment nil, env: :test do
165
+ environment nil, env: :test do
163
166
  snippet_env_test
164
167
  end # do test environment
165
168
 
166
- environment do
169
+ environment do
167
170
  snippet_config_application
168
171
  end # do config_application
169
172
 
@@ -191,16 +194,16 @@ private
191
194
  # -------------------------------------------------------------
192
195
  def find_or_fail( filename )
193
196
  user_file = Dir.glob(filename).first
194
- if user_file.blank?
197
+ if user_file.blank?
195
198
  say_status("error", "file: '#{filename}' not found", :red)
196
- raise Thor::Error, "************ terminating generator due to file error! *************"
199
+ raise Thor::Error, "************ terminating generator due to file error! *************"
197
200
  end
198
201
  return user_file
199
202
  end
200
-
203
+
201
204
  # -------------------------------------------------------------
202
205
  # -------------------------------------------------------------
203
-
206
+
204
207
  # *************************************************************
205
208
  # ****** SNIPPET SECTION ************************************
206
209
  # *************************************************************
@@ -501,8 +504,8 @@ protected
501
504
  gem_msg = `bundle list #{gem_name}`
502
505
  if /Could not find gem/i =~ gem_msg
503
506
  say_status(
504
- "error",
505
- "gemfile not found: #{gem_name} is required",
507
+ "error",
508
+ "gemfile not found: #{gem_name} is required",
506
509
  alert_color
507
510
  )
508
511
  need_fail = true
@@ -514,28 +517,28 @@ protected
514
517
  say("- add required gems to Gemfile; then run bundle install", alert_color)
515
518
  say("- then retry rails g milia:install", alert_color)
516
519
  say("-------------------------------------------------------------------------", alert_color)
517
- raise Thor::Error, "************ terminating generator due to missing requirements! *************"
520
+ raise Thor::Error, "************ terminating generator due to missing requirements! *************"
518
521
  end # need to fail
519
-
522
+
520
523
  end
521
-
524
+
522
525
  # -------------------------------------------------------------
523
526
  # -------------------------------------------------------------
524
527
  def file_find_or_fail( filename )
525
528
  user_file = Dir.glob(filename).first
526
- if user_file.blank?
529
+ if user_file.blank?
527
530
  alert_color = :red
528
531
  say("-------------------------------------------------------------------------", alert_color)
529
532
  say_status("error", "file: '#{filename}' not found", alert_color)
530
533
  say("- first run $ rails g milia:install", alert_color)
531
534
  say("- then retry $ rails g web_app_theme:milia", alert_color)
532
535
  say("-------------------------------------------------------------------------", alert_color)
533
-
534
- raise Thor::Error, "************ terminating generator due to file error! *************"
536
+
537
+ raise Thor::Error, "************ terminating generator due to file error! *************"
535
538
  end
536
539
  return user_file
537
540
  end
538
-
541
+
539
542
  # -------------------------------------------------------------
540
543
  # -------------------------------------------------------------
541
544