onotole 1.2.4 → 1.2.5

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: f245dcc20720c5de6905ade961bc61fed8fa124b
4
- data.tar.gz: 22316766f8de584587ec4ccd1e24dffd730c686e
3
+ metadata.gz: 3a0cbcdcef331d085e2132b288a2a9ffee3e7996
4
+ data.tar.gz: 96fa5ded2399224a6fa140d5b2fae298a099b272
5
5
  SHA512:
6
- metadata.gz: 850b098c97867b5985fe37a8b68188e8ae3baffe2038feb1646e6886d988f5f3a5248abe2d0ee27adc4b6cdc58ff4acb5c2bfba14991b3887dc743adae7b4fcd
7
- data.tar.gz: 74688e6b0f2271ec0368d6d4b63f81b6c031f1987bf65e88300efc0479909b2f870036bf6234247d721d1479397197f134315cc780bb99ed594d78f2b4bc2391
6
+ metadata.gz: 9a4235b756aac664097ac3667923c9f7cb87fe91928ec73cd73be28c7288b1499f754eae8f157dc9069262f72933d0b6cc261b76b300fa3290d6d0a78844ee05
7
+ data.tar.gz: d47c179cfd2f4b121f73852027022b5c136a760849a7e7eb75e4f45bf32c4d7044e66ef4b2d9e20f36a405ba7563bf69e9455d75d32a0635783e40d84449a27e
data/README.md CHANGED
@@ -108,6 +108,11 @@ Bootstrap kaminari plugin
108
108
  interface to a namespaced subset of your redis keyspace (e.g., keys with a
109
109
  common beginning).
110
110
 
111
+ #### File storage
112
+ * [carrierwave](https://github.com/carrierwaveuploader/carrierwave/tree/0.11-stable)
113
+ Classier solution for file uploads for Rails, Sinatra and other Ruby web
114
+ frameworks https://github.com/carrierwaveuploader/carrierwave
115
+
111
116
 
112
117
  #### Developer tools
113
118
 
@@ -348,6 +353,8 @@ improvement
348
353
  * Rake task for killing PostgreSQL conventions `db:kill_postgres_connections`
349
354
  * Rake task `redis:flushall`
350
355
  * Made seeds organization for easy splitting data from scratch
356
+ * `Carrierwave` may be integrated with `mini_magick` and `ckeditor`, depend on
357
+ user choice
351
358
 
352
359
  ## Heroku
353
360
 
@@ -6,6 +6,7 @@ module Onotole
6
6
  :redis,
7
7
  :redis_rails,
8
8
  :redis_namespace,
9
+ :carrierwave,
9
10
  :ckeditor,
10
11
  :fotoramajs,
11
12
  :underscore_rails,
@@ -289,9 +290,13 @@ end
289
290
  end
290
291
 
291
292
  def after_install_ckeditor
292
- append_file(AppBuilder.js_file, "\n#= require ckeditor/init")
293
+ inject_into_file(AppBuilder.js_file, "\n//= require ckeditor/init",
294
+ after: '//= require jquery_ujs')
293
295
  append_file('config/initializers/assets.rb',
294
296
  "\nRails.application.config.assets.precompile += %w( ckeditor/* )")
297
+
298
+ rails_generator 'ckeditor:install --orm=active_record '\
299
+ '--backend=carrierwave' if user_choose? :carrierwave
295
300
  end
296
301
 
297
302
  def after_install_image_optim
@@ -344,5 +349,14 @@ DATA
344
349
  append_file 'config/initializers/redis.rb',
345
350
  %q(::Application.config.session_store :redis_store, servers: "#{ENV['REDIS_PATH']}/session")
346
351
  end
352
+
353
+ def after_install_carrierwave
354
+ copy_file 'carrierwave.rb', 'config/initializers/carrierwave.rb'
355
+ return unless AppBuilder.file_storage_name
356
+ rails_generator "uploader #{AppBuilder.file_storage_name}"
357
+ uploader_path = "app/uploaders/#{AppBuilder.file_storage_name}_uploader.rb"
358
+ config = "\n include CarrierWave::MiniMagick\n"
359
+ inject_into_class uploader_path, "#{AppBuilder.file_storage_name.classify}Uploader", config
360
+ end
347
361
  end
348
362
  end
@@ -328,5 +328,12 @@ module Onotole
328
328
  def add_redis_namespace_gem
329
329
  inject_into_file('Gemfile', "\ngem 'redis-namespace'", after: '# user_choice')
330
330
  end
331
+
332
+ def add_carrierwave_gem
333
+ inject_into_file('Gemfile', "\ngem 'carrierwave', '~> 0.10.0'", after: '# user_choice')
334
+ inject_into_file('Gemfile',
335
+ "\ngem 'mini_magick', '~> 4.5.0'",
336
+ after: '# user_choice') if AppBuilder.file_storage_name
337
+ end
331
338
  end
332
339
  end
@@ -18,7 +18,7 @@ module Onotole
18
18
  end
19
19
 
20
20
  def choose_authenticate_engine
21
- variants = { none: 'None', devise: 'devise', devise_with_model: 'devise vs pre-installed model' }
21
+ variants = { none: 'None', devise: 'devise 4', devise_with_model: 'devise 4 vs pre-installed model' }
22
22
  gem = choice 'Select authenticate engine: ', variants
23
23
  if gem == :devise_with_model
24
24
  AppBuilder.devise_model = ask_stylish 'Enter devise model name:'
@@ -141,6 +141,18 @@ module Onotole
141
141
  add_to_user_choise :redis if user_choose?(:redis_rails) || user_choose?(:redis_namespace)
142
142
  end
143
143
 
144
+ def choose_file_storage
145
+ variants = { none: 'None',
146
+ carrierwave: 'carrierwave v0.10',
147
+ carrierwave_with_uploader: 'carrierwave+mini_magick v0.10 pre-installed uploader' }
148
+ gem = choice 'Select file storage engine: ', variants
149
+ if gem == :carrierwave_with_uploader
150
+ AppBuilder.file_storage_name = ask_stylish('Enter uploader name:').downcase
151
+ gem = :carrierwave
152
+ end
153
+ add_to_user_choise(gem) if gem
154
+ end
155
+
144
156
  # template for yes/no question
145
157
  #
146
158
  # def supeawesome_gem
@@ -43,6 +43,7 @@ module Onotole
43
43
 
44
44
  def ckeditor_check
45
45
  return unless user_choose? :ckeditor
46
+ return if user_choose? :carrierwave && AppBuilder.file_storage_name
46
47
  say_color YELLOW, 'Visit ckeditor homepage and install back-end for it.'
47
48
  end
48
49
 
@@ -10,6 +10,7 @@ module Onotole
10
10
  choose_wysiwyg
11
11
  choose_develoder_tools
12
12
  choose_cache_storage
13
+ choose_file_storage
13
14
  # Placeholder for other gem additions
14
15
  # menu description in add_gems_in_menu.rb
15
16
 
@@ -29,12 +29,14 @@ module Onotole
29
29
  @js_file = 'app/assets/javascripts/application.js'
30
30
  @active_admin_theme_selected = false
31
31
  @quiet = true
32
+ @file_storage_name = nil
32
33
 
33
34
  class << self
34
35
  attr_accessor :use_asset_pipelline,
35
36
  :devise_model,
36
37
  :user_choice, :app_file_scss,
37
- :app_file_css, :js_file, :quiet, :active_admin_theme_selected
38
+ :app_file_css, :js_file, :quiet,
39
+ :active_admin_theme_selected, :file_storage_name
38
40
  end
39
41
 
40
42
  def_delegators :heroku_adapter,
@@ -2,5 +2,5 @@
2
2
  module Onotole
3
3
  RAILS_VERSION = '~> 4.2.0'
4
4
  RUBY_VERSION = IO.read("#{File.dirname(__FILE__)}/../../.ruby-version").strip
5
- VERSION = '1.2.4'
5
+ VERSION = '1.2.5'
6
6
  end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+ require 'carrierwave'
3
+ require 'carrierwave/orm/activerecord'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onotole
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - kvokka
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-04-22 00:00:00.000000000 Z
12
+ date: 2016-04-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -138,6 +138,7 @@ files:
138
138
  - templates/browserslist
139
139
  - templates/bundler_audit.rake
140
140
  - templates/capybara_webkit.rb
141
+ - templates/carrierwave.rb
141
142
  - templates/circle.yml.erb
142
143
  - templates/config_locales_en.yml.erb
143
144
  - templates/config_locales_ru.yml.erb