onotole 1.1.21 → 1.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f94643204e7f258863146131d37189559478b7d
4
- data.tar.gz: 3fd249dbd56ae6804139e806d6d7722442b15466
3
+ metadata.gz: 8cae16451d3b970f84a1e2b0265234be738d6abf
4
+ data.tar.gz: c7b5c8e4add3cd7f6d25d84b6679842278f8c82d
5
5
  SHA512:
6
- metadata.gz: 81fc447f2e8f0fb2071499a7e8109ec093134adfb15e86f3bd9239ddc51fad7f52a87b07057708fcbc8542208feabedfe82462e0126cbaac20087ebdf7681753
7
- data.tar.gz: fc74b38b32a89097265b9f0ea9996ca7ea6afc05a82eccab09b472c3312f2dc8a1b59e53d99b4612a1a44449036eb057ec34d8ef84031c81b5307f05a4ff6383
6
+ metadata.gz: 00f7fefe24c0720aef97453a5774eff9d847ce3fc3c7e58c5e22d392db0355239a7e6490ee40db4478aa613da24a07a9d5f64473b24a60cd2256b7be97e4d118
7
+ data.tar.gz: 54006eabbe106a8cd5f51179ae07ca381c8618ca53decfb80524d2112c2a750d4f1b9be691d4bd991a4ce75a394744a5da8a8f4bf310f075df2ccf2d3e470048
data/README.md CHANGED
@@ -100,6 +100,14 @@ Bootstrap kaminari plugin
100
100
  * [tinymce-rails](https://github.com/spohlenz/tinymce-rails) Integration of
101
101
  TinyMCE with the Rails asset pipeline
102
102
 
103
+ #### Memory DB
104
+ * [redis](https://github.com/redis/redis-rb) A Ruby client library for Redis.
105
+ * [redis-rails](https://github.com/redis-store/redis-rails) Provides a full set
106
+ of stores (Cache, Session, HTTP Cache) for Ruby on Rails
107
+ * [redis-namespace](https://github.com/resque/redis-namespace) Provides an
108
+ interface to a namespaced subset of your redis keyspace (e.g., keys with a
109
+ common beginning).
110
+
103
111
 
104
112
  #### Developer tools
105
113
 
@@ -296,7 +304,15 @@ app on 1 server. Onotole prefix all `env` variables with `#{app_name}` and now
296
304
  you will not have any problems with export variables in production. In
297
305
  production environment you can make `.env.production` file and put all consants
298
306
  there. Also with this thick you can easy use ENV export tool or just put ENV
299
- variables in `.bashrc` without name space conflicts.
307
+ variables in `.bashrc` without name space conflicts.
308
+
309
+ ##NOSQL Memory based db
310
+
311
+ Now supported only Redis db, and Onotole do not install or config Redis itself,
312
+ it just setup support gems. For getting access to Redis you can use `$redis`
313
+ variable, and `$ns_redis` for namespaced access wich is provided by
314
+ `redis-namespace` gem. Feel free in changing settings in
315
+ `config/initializers/redis.rb`
300
316
 
301
317
  ## Other goodies
302
318
 
data/bin/t ADDED
@@ -0,0 +1,2 @@
1
+ #!/bin/sh
2
+ rm -fr tmp && bin/onotole tmp -c
@@ -3,6 +3,9 @@ module Onotole
3
3
  module AfterInstallPatch
4
4
  def post_init
5
5
  install_queue = [
6
+ :redis,
7
+ :redis_rails,
8
+ :redis_namespace,
6
9
  :ckeditor,
7
10
  :fotoramajs,
8
11
  :underscore_rails,
@@ -312,5 +315,38 @@ DATA
312
315
  replace_in_file 'config/initializers/active_admin.rb',
313
316
  'ActiveAdmin.setup do |config|', config
314
317
  end
318
+
319
+ def after_install_redis
320
+ config = %q(
321
+ config.cache_store = :redis_store, "#{ENV['REDIS_PATH']}/cache", { expires_in: 90.minutes }
322
+ )
323
+ File.open('config/initializers/redis.rb', 'w') { |f| f.write "$redis = Redis.new\n" }
324
+ %w(development production).each do |env|
325
+ inject_into_file "config/environments/#{env}.rb", config,
326
+ after: "Rails.application.configure do\n"
327
+ end
328
+ append_file '.env', 'REDIS_PATH=redis://localhost:6379/0'
329
+ append_file '.env.production', 'REDIS_PATH=redis://localhost:6379/0'
330
+
331
+ rubocop_todo_conf = <<-DATA
332
+ Style/GlobalVars:
333
+ Exclude:
334
+ - 'config/initializers/redis.rb'
335
+ DATA
336
+ File.open('.rubocop_todo.yml', 'a') { |f| f.write rubocop_todo_conf }
337
+ end
338
+
339
+ def after_install_redis_namespace
340
+ return unless user_choose? :redis
341
+ append_file 'config/initializers/redis.rb',
342
+ br("$ns_redis = Redis::Namespace.new(:#{app_name}, redis: $redis)")
343
+ end
344
+
345
+ def after_install_redis_rails
346
+ return unless user_choose? :redis
347
+ append_file 'config/initializers/redis.rb', br(app_name.classify.to_s)
348
+ append_file 'config/initializers/redis.rb',
349
+ %q(::Application.config.session_store :redis_store, servers: "#{ENV['REDIS_PATH']}/session")
350
+ end
315
351
  end
316
352
  end
@@ -42,11 +42,10 @@ module Onotole
42
42
 
43
43
  gem 'guard'
44
44
  gem 'guard-livereload', '~> 2.4', require: false
45
- gem 'guard-puma'
46
- gem 'guard-migrate'
45
+ gem 'guard-puma', require: false
46
+ gem 'guard-migrate', require: false
47
47
  gem 'guard-rspec', require: false
48
48
  gem 'guard-bundler', require: false
49
- gem 'rb-inotify', github: 'kvokka/rb-inotify'
50
49
  TEXT
51
50
  inject_into_file('Gemfile', t, after: 'group :development do')
52
51
  end
@@ -317,5 +316,17 @@ module Onotole
317
316
  def add_stackprof_gem
318
317
  inject_into_file('Gemfile', "\ngem 'stackprof'", after: 'group :development do')
319
318
  end
319
+
320
+ def add_redis_gem
321
+ inject_into_file('Gemfile', "\ngem 'redis', '~>3.2'", after: '# user_choice')
322
+ end
323
+
324
+ def add_redis_rails_gem
325
+ inject_into_file('Gemfile', "\ngem 'redis-rails'", after: '# user_choice')
326
+ end
327
+
328
+ def add_redis_namespace_gem
329
+ inject_into_file('Gemfile', "\ngem 'redis-namespace'", after: '# user_choice')
330
+ end
320
331
  end
321
332
  end
@@ -129,6 +129,18 @@ module Onotole
129
129
  add_to_user_choise :underscore_rails if user_choose?(:gmaps4rails)
130
130
  end
131
131
 
132
+ def choose_cache_storage
133
+ variants = { none: 'Default',
134
+ redis: 'Redis db ruby library',
135
+ redis_rails: 'Provides a full set of stores (Cache, Session, HTTP Cache)',
136
+ redis_namespace: 'Provides an interface to a namespaced subset of your redis keyspace'
137
+ }
138
+ multiple_choice('Select cache storage and plug-ins.', variants).each do |gem|
139
+ add_to_user_choise gem
140
+ end
141
+ add_to_user_choise :redis if user_choose?(:redis_rails) || user_choose?(:redis_namespace)
142
+ end
143
+
132
144
  # template for yes/no question
133
145
  #
134
146
  # def supeawesome_gem
@@ -9,6 +9,7 @@ module Onotole
9
9
  choose_pagimation
10
10
  choose_wysiwyg
11
11
  choose_develoder_tools
12
+ choose_cache_storage
12
13
  # Placeholder for other gem additions
13
14
  # menu description in add_gems_in_menu.rb
14
15
 
@@ -111,7 +111,7 @@ end
111
111
  def copy_dotfiles
112
112
  directory 'dotfiles', '.', force: true
113
113
  template 'dotenv.erb', '.env'
114
- run 'touch .env.production'
114
+ template 'dotenv_production.erb', '.env.production'
115
115
  end
116
116
 
117
117
  def setup_spring
@@ -146,5 +146,9 @@ module Onotole
146
146
  def touch(file_name)
147
147
  `touch #{file_name}`
148
148
  end
149
+
150
+ def br(str = nil)
151
+ str ? "\n" + str : "\n"
152
+ end
149
153
  end
150
154
  end
@@ -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.1.21'
5
+ VERSION = '1.2.1'
6
6
  end
@@ -0,0 +1,13 @@
1
+ # https://github.com/ddollar/forego
2
+ <%= "#{app_name.upcase}_ASSET_HOST=fix_env_production_file.org" %>
3
+ <%= "#{app_name.upcase}_APPLICATION_HOST=fix_env_production_file.org" %>
4
+ <%= "#{app_name.upcase}_PORT=80" %>
5
+ <%= "#{app_name.upcase}_SECRET_KEY_BASE=production_secret" %>
6
+ <%= "#{app_name.upcase}_SMTP_ADDRESS=smtp.example.com" %>
7
+ <%= "#{app_name.upcase}_SMTP_DOMAIN=example.com" %>
8
+ <%= "#{app_name.upcase}_SMTP_PORT=587" %>
9
+ <%= "#{app_name.upcase}_SMTP_PASSWORD=password" %>
10
+ <%= "#{app_name.upcase}_SMTP_USERNAME=username" %>
11
+ RACK_ENV=production
12
+ EXECJS_RUNTIME=Node
13
+ RAILS_SERVE_STATIC_FILES=true
@@ -17,3 +17,4 @@
17
17
  /.idea/
18
18
  /vendor/cache/
19
19
  /.env.production
20
+ dump.rdp
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.1.21
4
+ version: 1.2.1
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-16 00:00:00.000000000 Z
12
+ date: 2016-04-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -82,6 +82,7 @@ files:
82
82
  - bin/rake
83
83
  - bin/rspec
84
84
  - bin/setup
85
+ - bin/t
85
86
  - goodies/custom_404_and_others_in_1_minute.md
86
87
  - goodies/mailcatcher_loading_patch.md
87
88
  - goodies/tests_speed_up_hack.md
@@ -146,6 +147,7 @@ files:
146
147
  - templates/devise_rspec.rb
147
148
  - templates/disable_xml_params.rb
148
149
  - templates/dotenv.erb
150
+ - templates/dotenv_production.erb
149
151
  - templates/dotfiles/.ctags
150
152
  - templates/dotfiles/.pryrc
151
153
  - templates/dotfiles/.rspec