cybele 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d1b19c12b75c733c7e338ce8042144d430d27999
4
- data.tar.gz: 600ff38d969c96a0a750d656a4e2aa9d16c3764d
3
+ metadata.gz: 9451598bcffbad85bff16ec9a0faa43360eb8ff2
4
+ data.tar.gz: 50c0429104043dace2df95bd2350b6b3c2ed5ab5
5
5
  SHA512:
6
- metadata.gz: 4f1223c4817928fcf63c30436fda5c1e6944330e99781717fd3f4394ac8e9f83cccef26ad44734edb2ed9a48c4f1b28f17742cb2c6e403b743ecd34a9e250947
7
- data.tar.gz: cab50adb694d70bebfecb2f9f2f793086939c102d18fa101e24ca8bd28afc299651e17def75c11ab2b7904a250188818e8df7ffc374f77ab7f5f1a2f2e319df0
6
+ metadata.gz: 227c45bf424e5f34bd8085e359cca9811b9a4911c079cb1027f64b37a41d30daa5d5514ddf984dc001a075ef944b7f6351dbf05a53d9168b0050109ba6009f3f
7
+ data.tar.gz: 0cc04f7df2db1df4e124b4729cc272d137bdbf94b3eaf559100c3189ed6ed8e6111ff3fa0e9603af5fa243efbfab071a93f0c24d6c4d18f050caca8ce7654ffa
data/README.md CHANGED
@@ -70,7 +70,7 @@ http://github.com/kebab-project/cybele/issues
70
70
 
71
71
  ## Contributing
72
72
 
73
- Cybele uses [TomDoc](http://tomdoc.org/), [rDoc](http://rubydoc.info/gems/cybele) and [SemVer](http://semver.org/), and takes it seriously.
73
+ Cybele uses [rDoc](http://rubydoc.info/gems/cybele) and [SemVer](http://semver.org/), and takes it seriously.
74
74
 
75
75
  Once you've made your great commits:
76
76
 
@@ -1,39 +1,30 @@
1
- module Cybele #:nodoc:#
1
+ module Cybele
2
2
 
3
- # Public: This allows you to override entire operations, like the creation of the
4
- # cybele_Gemfile, README, or JavaScript files, without needing to know exactly
5
- # what those operations do so you can create another template action.
6
3
  class AppBuilder < Rails::AppBuilder
7
4
 
8
- # Internal: Overwrite super class readme
9
5
  def readme
10
6
  template 'README.md.erb', 'README.md', :force => true
11
7
  end
12
8
 
13
- # Internal: Remove README.rdoc file
14
9
  def remove_readme_rdoc
15
10
  remove_file 'README.rdoc'
16
11
  end
17
12
 
18
- # Internal: Replace gemfile
19
13
  def replace_gemfile
20
14
  remove_file 'Gemfile'
21
15
  copy_file 'cybele_Gemfile', 'Gemfile'
22
16
  end
23
17
 
24
- # Internal: Replace config/application.rb file
25
18
  def replace_application_rb_file
26
19
  remove_file 'config/application.rb'
27
20
  copy_file 'config/application.rb', 'config/application.rb'
28
21
  end
29
22
 
30
- # Internal: Replace erb files with html files
31
23
  def replace_erb_with_haml
32
24
  remove_file 'app/views/layouts/application.html.erb'
33
25
  template 'app/views/layouts/application.html.haml.erb', 'app/views/layouts/application.html.haml', :force => true
34
26
  end
35
27
 
36
- # Internal: Replace responders controller template
37
28
  def install_responder_gem
38
29
  copy_file 'lib/application_responder.rb', 'lib/application_responder.rb'
39
30
  remove_file 'app/controllers/application_controller.rb'
@@ -43,23 +34,19 @@ module Cybele #:nodoc:#
43
34
  copy_file 'config/locales/responders.tr.yml', 'config/locales/responders.tr.yml'
44
35
  end
45
36
 
46
- # Internal: Setup database config
47
37
  def replace_database_yml
48
38
  template 'config/database.yml.erb', 'config/database.yml', :force => true
49
39
  end
50
40
 
51
- # Internal: Create database
52
41
  def create_database
53
42
  bundle_command 'exec rake db:create'
54
43
  end
55
44
 
56
- # Internal: Setup gitignore files
57
45
  def setup_gitignore_files
58
46
  remove_file '.gitignore'
59
47
  copy_file 'cybele_gitignore', '.gitignore'
60
48
  end
61
49
 
62
- # Internal: Setup gitignore folders
63
50
  def setup_gitignore_folders
64
51
  %w(
65
52
  app/assets/images
@@ -75,8 +62,6 @@ module Cybele #:nodoc:#
75
62
  end
76
63
  end
77
64
 
78
- # Internal: Setup asset precompile
79
- # Look for information https://github.com/thomas-mcdonald/bootstrap-sass#rails-4
80
65
  def setup_asset_precompile
81
66
 
82
67
  config = <<-RUBY
@@ -89,19 +74,16 @@ module Cybele #:nodoc:#
89
74
  inject_into_file 'config/application.rb', config, :after => '# config.i18n.default_locale = :de'
90
75
  end
91
76
 
92
- # Interval: Convert application.js to application.js.coffee
93
77
  def convert_application_js_to_coffee
94
78
  remove_file 'app/assets/javascripts/application.js'
95
79
  copy_file 'app/assets/javascripts/application.js.coffee', 'app/assets/javascripts/application.js.coffee'
96
80
  end
97
81
 
98
- # Interval: Convert application.css to application.css.sass
99
82
  def convert_application_css_to_sass
100
83
  remove_file 'app/assets/stylesheets/application.css'
101
84
  copy_file 'app/assets/stylesheets/application.css.sass', 'app/assets/stylesheets/application.css.sass'
102
85
  end
103
86
 
104
- # Interval: Configure smtp
105
87
  def configure_smtp
106
88
 
107
89
  config = <<-RUBY
@@ -119,67 +101,79 @@ config.action_mailer.delivery_method = :smtp
119
101
  configure_environment 'production', config
120
102
  end
121
103
 
122
- # Interval: Configure action mailer
123
104
  def configure_action_mailer
124
105
  action_mailer_host 'development', "#{app_name}.dev"
125
106
  action_mailer_host 'test', "#{app_name}.com"
126
107
  action_mailer_host 'production', "#{app_name}.com"
127
-
128
108
  end
129
109
 
130
- # Interval: Setup letter opener
131
110
  def setup_letter_opener
132
111
  config = 'config.action_mailer.delivery_method = :letter_opener'
133
112
  configure_environment 'development', config
134
113
  end
135
114
 
136
- # Interval: Setup simple form
115
+ def generate_rspec
116
+ generate 'rspec:install'
117
+ end
118
+
119
+ def generate_capybara
120
+ inject_into_file 'spec/spec_helper.rb', :after => "require 'rspec/autorun'" do <<-CODE
121
+
122
+ require 'capybara/rspec'
123
+ CODE
124
+ end
125
+ inject_into_file 'spec/spec_helper.rb', :after => ' config.order = "random"' do <<-CODE
126
+
127
+
128
+ # Capybara DSL
129
+ config.include Capybara::DSL
130
+ CODE
131
+ end
132
+ end
133
+
134
+ def generate_factory_girl
135
+ inject_into_file 'spec/spec_helper.rb', :after => ' config.include Capybara::DSL' do <<-CODE
136
+
137
+
138
+ # Factory girl
139
+ config.include FactoryGirl::Syntax::Methods
140
+ CODE
141
+ end
142
+ end
143
+
137
144
  def generate_simple_form
138
145
  generate 'simple_form:install --bootstrap'
139
146
  copy_file 'config/locales/simple_form.tr.yml', 'config/locales/simple_form.tr.yml'
140
147
  copy_file 'config/locales/tr.yml', 'config/locales/tr.yml'
141
148
  end
142
149
 
143
- # Internal: Generate exception notification
144
- #
145
- # This command generates an initialize file (config/initializers/exception_notification.rb)
146
- # where you can customize your configurations.
147
- # https://github.com/smartinez87/exception_notification#rails
148
150
  def generate_exception_notification
149
151
  generate 'exception_notification:install'
150
152
  end
151
153
 
152
- # Internal: Leftovers
153
154
  def leftovers
154
155
  end
155
156
 
156
- # Internal: Setup Rails Config
157
157
  def generate_rails_config
158
158
  generate 'rails_config:install'
159
159
  end
160
160
 
161
- # Internal: Setup devise
162
161
  def generate_devise_settings
163
162
  generate 'devise:install'
164
163
  gsub_file 'config/initializers/filter_parameter_logging.rb', /:password/, ':password, :password_confirmation'
165
164
  gsub_file 'config/initializers/devise.rb', /please-change-me-at-config-initializers-devise@example.com/, 'CHANGEME@example.com'
166
-
167
165
  end
168
166
 
169
- # Internal: Generate devise model
170
167
  def generate_devise_model(model_name)
171
168
  generate "devise #{model_name} name:string"
172
169
  generate_devise_strong_parameters(model_name)
173
170
  remove_file 'config/locales/devise.en.yml'
174
171
  end
175
172
 
176
- # Internal: Generate devise views
177
173
  def generate_devise_views
178
- # generate "devise:views"
179
174
  directory 'app/views/devise', 'app/views/devise'
180
175
  end
181
176
 
182
- # Internal: Generate Welcome Page
183
177
  def generate_welcome_page
184
178
  copy_file 'app/controllers/welcome_controller.rb', 'app/controllers/welcome_controller.rb'
185
179
  template 'app/views/welcome/index.html.haml.erb', 'app/views/welcome/index.html.haml', force: true
@@ -206,12 +200,6 @@ config.action_mailer.delivery_method = :smtp
206
200
 
207
201
  private
208
202
 
209
- # Internal: Set action mailer hostname
210
- #
211
- # rail_env - rails env like development, text, production
212
- # host - domain.dev, domain.com or example.com
213
- #
214
- # Returns nothing
215
203
  def action_mailer_host(rails_env, host)
216
204
 
217
205
  config = <<-RUBY
@@ -222,25 +210,16 @@ config.action_mailer.delivery_method = :smtp
222
210
  configure_environment(rails_env, config)
223
211
  end
224
212
 
225
- # Internal: Set configure environment
226
- #
227
- # rail_env - rails env like development, text, production
228
- # config - config string which will add to rails_env file
229
- #
230
- # Return nothing
231
213
  def configure_environment(rails_env, config)
232
214
  inject_into_file("config/environments/#{rails_env}.rb", "\n\n #{config}", before: "\nend")
233
215
  end
234
216
 
235
- # Setup strong params for devise
236
217
  def generate_devise_strong_parameters(model_name)
237
218
  create_sanitizer_lib(model_name)
238
219
  create_sanitizer_initializer(model_name)
239
220
  devise_parameter_sanitizer(model_name)
240
221
  end
241
222
 
242
-
243
- # Internal: Create devise ParameterSanitizer library
244
223
  def create_sanitizer_lib(model_name)
245
224
  create_file "lib/#{model_name.parameterize}_sanitizer.rb", <<-CODE
246
225
  class #{model_name.classify}::ParameterSanitizer < Devise::ParameterSanitizer
@@ -252,7 +231,6 @@ end
252
231
  CODE
253
232
  end
254
233
 
255
- # Internal: Create devise ParameterSanitizer library initializer
256
234
  def create_sanitizer_initializer(model_name)
257
235
  path = "#"
258
236
  path << "{Rails.application.root}"
@@ -262,7 +240,6 @@ require "#{path}"
262
240
  CODE
263
241
  end
264
242
 
265
- # Internal: Add devise_parameter_sanitizer method to app/controller/applications_controller.rb
266
243
  def devise_parameter_sanitizer(model_name)
267
244
  inject_into_file 'app/controllers/application_controller.rb', :after => 'protect_from_forgery with: :exception' do <<-CODE
268
245
 
@@ -279,7 +256,6 @@ require "#{path}"
279
256
  end
280
257
  end
281
258
 
282
- #Internal: Create namespace with dashboard resource in routes.rb
283
259
  def create_namespace_routing(namespace)
284
260
  inject_into_file 'config/routes.rb', after: "root to: 'welcome#index'" do <<-CODE
285
261
 
@@ -290,13 +266,11 @@ require "#{path}"
290
266
  end
291
267
  end
292
268
 
293
- # Internal: Generate migration for add time_zone to User model
294
269
  def add_time_zone_to_user
295
270
  say 'Add time_zone to User model'
296
271
  generate 'migration AddTimeZoneToUser time_zone:string -s'
297
272
  end
298
273
 
299
- # Internal: Add set_user_time_zone method to app/controller/applications_controller.rb
300
274
  def add_set_user_time_zone_method_to_application_controller
301
275
  say 'Add set_user_time_zone method to application controller'
302
276
  inject_into_file 'app/controllers/application_controller.rb', :after => 'protected' do <<-CODE
@@ -315,4 +289,4 @@ require "#{path}"
315
289
  end
316
290
  end
317
291
  end
318
- end
292
+ end
@@ -1,28 +1,21 @@
1
1
  require 'rails/generators'
2
2
  require 'rails/generators/rails/app/app_generator'
3
3
 
4
- module Cybele #:nodoc:#
5
-
6
- # Public: This allows you to override entire operations, like the creation of the
7
- # Gemfile_new, README, or JavaScript files, without needing to know exactly
8
- # what those operations do so you can create another template action.
4
+ module Cybele
5
+
9
6
  class AppGenerator < Rails::Generators::AppGenerator
10
7
 
11
- # Internal: Default use postgresql
12
8
  class_option :database, :type => :string, :aliases => '-d', :default => 'postgresql',
13
9
  :desc => "Preconfigure for selected database (options: #{DATABASES.join('/')})"
14
10
 
15
- # Internal: Default skip Test::Unit
16
11
  class_option :skip_test_unit, :type => :boolean, :aliases => '-T', :default => true,
17
12
  :desc => 'Skip Test::Unit files'
18
13
 
19
- # Internal: Finish template
20
14
  def finish_template
21
15
  invoke :customization
22
16
  super
23
17
  end
24
18
 
25
- # Internal: Customization template
26
19
  def customization
27
20
  invoke :customize_gemfile
28
21
  invoke :setup_database
@@ -32,6 +25,9 @@ module Cybele #:nodoc:#
32
25
  invoke :gitignore_files_and_folders
33
26
  invoke :setup_bootstrap_sass_coffee
34
27
  invoke :configure_mail_setting
28
+ invoke :setup_rspec
29
+ invoke :setup_capybara
30
+ invoke :setup_factory_girl
35
31
  invoke :setup_simple_form
36
32
  invoke :setup_exception_notification
37
33
  invoke :setup_welcome_page
@@ -39,33 +35,28 @@ module Cybele #:nodoc:#
39
35
  invoke :setup_time_zone
40
36
  end
41
37
 
42
- # Internal: Customize gemfile
43
38
  def customize_gemfile
44
39
  build :replace_gemfile
45
40
  bundle_command 'install --binstubs=bin/stubs'
46
41
  end
47
42
 
48
- # Internal: Remove files don't need
49
43
  def remove_files_we_dont_need
50
44
  say 'Remove files we don\'t need'
51
45
  build :remove_readme_rdoc
52
46
  end
53
47
 
54
- # Internal: Replace files
55
48
  def replace_files
56
49
  say 'Replace files'
57
50
  build :replace_erb_with_haml
58
51
  build :replace_database_yml
59
52
  end
60
53
 
61
- # Internal: Install gems
62
54
  def install_gems
63
55
  say 'Install gems'
64
56
  say 'Install responder gem'
65
57
  build :install_responder_gem
66
58
  end
67
59
 
68
- # Internal: Setup database
69
60
  def setup_database
70
61
  say 'Setting up database'
71
62
 
@@ -76,13 +67,11 @@ module Cybele #:nodoc:#
76
67
  build :create_database
77
68
  end
78
69
 
79
- # Internal: Ignore files and folder
80
70
  def gitignore_files_and_folders
81
71
  build :setup_gitignore_files
82
72
  build :setup_gitignore_folders
83
73
  end
84
74
 
85
- # Internal: Setup up bootstrap, sass, coffee
86
75
  def setup_bootstrap_sass_coffee
87
76
  say 'Setup bootstrap'
88
77
  build :setup_asset_precompile
@@ -91,7 +80,6 @@ module Cybele #:nodoc:#
91
80
  build :convert_application_css_to_sass
92
81
  end
93
82
 
94
- # Internal: Setup mail setting
95
83
  def configure_mail_setting
96
84
  say 'Setup mail settings'
97
85
  build :configure_action_mailer
@@ -99,26 +87,37 @@ module Cybele #:nodoc:#
99
87
  build :setup_letter_opener
100
88
  end
101
89
 
102
- # Internal: Setup simple_form
90
+ def setup_rspec
91
+ say 'Generate rspec'
92
+ build :generate_rspec
93
+ end
94
+
95
+ def setup_capybara
96
+ say 'Generate capybara'
97
+ build :generate_capybara
98
+ end
99
+
100
+ def setup_factory_girl
101
+ say 'Generate factory girl'
102
+ build :generate_factory_girl
103
+ end
104
+
103
105
  def setup_simple_form
104
106
  say 'Generate simple form files'
105
107
  build :generate_simple_form
106
108
  end
107
109
 
108
- # Internal: Setup exception notification
109
110
  def setup_exception_notification
110
111
  say 'Generate exception notification'
111
112
  say 'Do not forget to configure config/initializers/exception_notification.rb file'
112
113
  build :generate_exception_notification
113
114
  end
114
115
 
115
- # Internal: Setup Rails Config
116
116
  def setup_rails_config
117
117
  say 'Generate rails config'
118
118
  build :generate_rails_config
119
119
  end
120
120
 
121
- # Internal: Setup Devise
122
121
  def setup_devise
123
122
  say 'Generate devise'
124
123
  build :generate_devise_settings
@@ -127,32 +126,26 @@ module Cybele #:nodoc:#
127
126
  build :generate_devise_views
128
127
  end
129
128
 
130
- # Internal: Setup Welcome Page
131
129
  def setup_welcome_page
132
130
  say 'Generate Welcome Page'
133
131
  build :generate_welcome_page
134
132
  end
135
133
 
136
-
137
134
  def setup_hq_namespace
138
135
  say 'Generate hq namespace'
139
136
  build :generate_hq_namespace
140
137
  end
141
138
 
142
- # Internal: Setup timezone per user
143
139
  def setup_time_zone
144
140
  say 'Setup time zone'
145
141
  build :set_time_zone
146
142
  end
147
143
 
148
-
149
- # Internal: Let's not: We'll bundle manually at the right spot.
150
144
  def run_bundle
151
145
  end
152
146
 
153
147
  protected
154
148
 
155
- # Internal: We need get_builder class
156
149
  def get_builder_class
157
150
  Cybele::AppBuilder
158
151
  end
@@ -1,4 +1,4 @@
1
- module Cybele #:nodoc:
2
- # Public: Cybele version
3
- VERSION = '0.8.0'
1
+ module Cybele
2
+ VERSION = '0.9.0'
4
3
  end
4
+
@@ -21,6 +21,7 @@ gem 'will_paginate', '~> 3.0.4'
21
21
  gem 'will_paginate-bootstrap', '~> 0.2.3'
22
22
  gem 'will-paginate-i18n', '~> 0.1.13'
23
23
  gem 'paperclip', '~> 3.5.1'
24
+ gem 'kangal', '~> 0.1.2'
24
25
 
25
26
  group :doc do
26
27
  gem 'sdoc', require: false
@@ -31,4 +32,8 @@ group :development, :test do
31
32
  gem 'binding_of_caller'
32
33
  gem 'letter_opener'
33
34
  gem 'katip'
35
+ gem 'rspec-rails', '~> 2.14.0'
36
+ gem 'capybara', '~> 2.1.0'
37
+ gem 'shoulda-matchers', '~> 2.2.0'
38
+ gem 'factory_girl_rails', '~> 4.0'
34
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cybele
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - lab2023
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-02 00:00:00.000000000 Z
11
+ date: 2013-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler