esp-commons 0.2.2 → 0.2.3

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.
@@ -1,56 +1,14 @@
1
- require 'airbrake'
2
- require 'configliere'
1
+ require 'openteam-commons'
3
2
 
4
3
  module EspCommons
5
4
  class Engine < ::Rails::Engine
6
5
  isolate_namespace EspCommons
7
6
 
8
7
  config.before_configuration do
9
- Settings.read(Rails.root.join('config', 'settings.yml')) if Rails.root.join('config', 'settings.yml').exist?
10
- Settings.defaults Settings.extract!(Rails.env)[Rails.env] || {}
11
- Settings.extract!(:test, :development, :production)
12
- Settings.define 'app.secret', :env_var => 'APP_SECRET'
13
- Settings.define 'app.url', :env_var => 'APP_URL'
14
8
  Settings.define 'appeals.url', :env_var => 'APPEALS_URL'
15
9
  Settings.define 'blue-pages.url', :env_var => 'BLUE_PAGES_URL'
16
10
  Settings.define 'cms.url', :env_var => 'CMS_URL'
17
- Settings.define 'errors.key', :env_var => 'ERRORS_KEY'
18
- Settings.define 'errors.url', :env_var => 'ERRORS_URL'
19
11
  Settings.define 'news.url', :env_var => 'NEWS_URL'
20
- Settings.define 'solr.url', :env_var => 'SOLR_URL'
21
- Settings.define 'sso.key', :env_var => 'SSO_KEY'
22
- Settings.define 'sso.secret', :env_var => 'SSO_SECRET'
23
- Settings.define 'sso.url', :env_var => 'SSO_URL'
24
- Settings.define 'storage.url', :env_var => 'STORAGE_URL'
25
- end
26
-
27
- config.before_configuration do
28
- if ENV['UNICORN']
29
- log_path = Settings['unicorn.logs_dir'] || "/var/log/esp/#{Rails.root.basename}"
30
- Rails.application.config.logger = ActiveSupport::BufferedLogger.new("#{log_path}/application.log")
31
- end
32
- end
33
-
34
- config.before_initialize do
35
- if Settings['errors.key'].present?
36
- Airbrake.configure do |config|
37
- config.api_key = Settings['errors.key']
38
- URI.parse(Settings['errors.url']).tap do | url |
39
- config.host = url.host
40
- config.port = url.port
41
- config.secure = url.scheme.inquiry.https?
42
- end
43
- end
44
- end
45
- end
46
-
47
- config.after_initialize do
48
- Rails.logger.level = ActiveSupport::BufferedLogger::Severity::WARN if Rails.env.production?
49
- end
50
-
51
- config.after_initialize do
52
- Rails.application.config.secret_token = Settings['app.secret']
53
- I18n.locale = I18n.default_locale
54
12
  end
55
13
 
56
14
  config.to_prepare do
@@ -58,7 +16,6 @@ module EspCommons
58
16
  helper_method :image_tag_for, :thumbnail_tag
59
17
 
60
18
  protected
61
-
62
19
  def image_tag_for(image)
63
20
  view_context.image_tag(image.url, :width => image.width, :height => image.height, :alt => image.description) if image
64
21
  end
@@ -1,3 +1,3 @@
1
1
  module EspCommons
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -2,17 +2,6 @@ module EspCommons
2
2
  module Generators
3
3
  class InstallGenerator < Rails::Generators::Base
4
4
  source_root File.expand_path('..', __FILE__)
5
-
6
- def create_binaries
7
- copy_file 'script/start_site'
8
- copy_file 'script/update_site'
9
- chmod 'script/start_site', 0755
10
- chmod 'script/update_site', 0755
11
- end
12
-
13
- def create_configs
14
- copy_file 'config/unicorn.rb'
15
- end
16
5
  end
17
6
  end
18
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esp-commons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-20 00:00:00.000000000 Z
12
+ date: 2012-03-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: airbrake
16
- requirement: &8237620 !ruby/object:Gem::Requirement
15
+ name: openteam-commons
16
+ requirement: &19480540 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,21 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *8237620
25
- - !ruby/object:Gem::Dependency
26
- name: configliere
27
- requirement: &8237080 !ruby/object:Gem::Requirement
28
- none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: '0'
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: *8237080
24
+ version_requirements: *19480540
36
25
  - !ruby/object:Gem::Dependency
37
26
  name: rails
38
- requirement: &8236440 !ruby/object:Gem::Requirement
27
+ requirement: &19505060 !ruby/object:Gem::Requirement
39
28
  none: false
40
29
  requirements:
41
30
  - - ! '>='
@@ -43,21 +32,10 @@ dependencies:
43
32
  version: '0'
44
33
  type: :runtime
45
34
  prerelease: false
46
- version_requirements: *8236440
35
+ version_requirements: *19505060
47
36
  - !ruby/object:Gem::Dependency
48
37
  name: active_attr
49
- requirement: &8236000 !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- type: :runtime
56
- prerelease: false
57
- version_requirements: *8236000
58
- - !ruby/object:Gem::Dependency
59
- name: unicorn
60
- requirement: &8235560 !ruby/object:Gem::Requirement
38
+ requirement: &19500040 !ruby/object:Gem::Requirement
61
39
  none: false
62
40
  requirements:
63
41
  - - ! '>='
@@ -65,10 +43,10 @@ dependencies:
65
43
  version: '0'
66
44
  type: :runtime
67
45
  prerelease: false
68
- version_requirements: *8235560
46
+ version_requirements: *19500040
69
47
  - !ruby/object:Gem::Dependency
70
48
  name: sqlite3
71
- requirement: &8234960 !ruby/object:Gem::Requirement
49
+ requirement: &19499160 !ruby/object:Gem::Requirement
72
50
  none: false
73
51
  requirements:
74
52
  - - ! '>='
@@ -76,7 +54,7 @@ dependencies:
76
54
  version: '0'
77
55
  type: :development
78
56
  prerelease: false
79
- version_requirements: *8234960
57
+ version_requirements: *19499160
80
58
  description: Description of EspCommons.
81
59
  email:
82
60
  - mail@openteam.ru
@@ -85,18 +63,12 @@ extensions: []
85
63
  extra_rdoc_files: []
86
64
  files:
87
65
  - app/models/esp_commons/image.rb
88
- - config/initializers/sunspot.rb
89
66
  - config/locales/commons.ru.yml
90
- - config/locales/datetime.ru.yml
91
- - config/unicorn.rb
92
67
  - lib/esp-commons/engine.rb
93
68
  - lib/esp-commons/version.rb
94
69
  - lib/esp-commons.rb
95
70
  - lib/generators/esp_commons/install/config/schedule.rb
96
- - lib/generators/esp_commons/install/config/unicorn.rb
97
71
  - lib/generators/esp_commons/install/install_generator.rb
98
- - lib/generators/esp_commons/install/script/start_site
99
- - lib/generators/esp_commons/install/script/update_site
100
72
  - MIT-LICENSE
101
73
  - Rakefile
102
74
  - README.rdoc
@@ -114,7 +86,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
86
  version: '0'
115
87
  segments:
116
88
  - 0
117
- hash: 693037452893961619
89
+ hash: 306898731652434501
118
90
  required_rubygems_version: !ruby/object:Gem::Requirement
119
91
  none: false
120
92
  requirements:
@@ -123,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
95
  version: '0'
124
96
  segments:
125
97
  - 0
126
- hash: 693037452893961619
98
+ hash: 306898731652434501
127
99
  requirements: []
128
100
  rubyforge_project:
129
101
  rubygems_version: 1.8.16
@@ -1,5 +0,0 @@
1
- begin
2
- require 'sunspot'
3
- Sunspot.config.solr.url = Settings['solr.url']
4
- rescue LoadError
5
- end
@@ -1,18 +0,0 @@
1
- ru:
2
- date:
3
- formats:
4
- default: "%d.%m.%Y"
5
- short: "%d %b"
6
- long: "%d %B %Y"
7
-
8
- time:
9
- # Форматы времени
10
- formats:
11
- default: "%d.%m.%Y %H:%M"
12
- short: "%d %b, %H:%M"
13
- long: "%d %B %Y, %H:%M"
14
-
15
- # am/pm решено перевести как "утра/вечера" :)
16
- am: "утра"
17
- pm: "вечера"
18
-
data/config/unicorn.rb DELETED
@@ -1,34 +0,0 @@
1
- current_dir = File.expand_path('../..', __FILE__)
2
-
3
- project = current_dir.split('/').last
4
-
5
- settings = YAML.load_file "#{current_dir}/config/settings.yml"
6
-
7
- settings['unicorn'] ||= {}
8
- settings['unicorn']['workers'] ||= 2
9
- settings['unicorn']['preload'] = true if settings['unicorn']['preload'] != false
10
- settings['unicorn']['timeout'] ||= 300
11
-
12
- settings['unicorn']['logs_dir'] ||= "/var/log/esp/#{project}"
13
- settings['unicorn']['pids_dir'] ||= '/var/run/esp'
14
- settings['unicorn']['socks_dir'] ||= '/tmp'
15
- unless settings['unicorn']['socks_dir'].start_with? "/"
16
- settings['unicorn']['socks_dir'] = "#{current_dir}/#{settings['unicorn']['socks_dir']}"
17
- end
18
-
19
- worker_processes settings['unicorn']['workers']
20
- preload_app settings['unicorn']['preload']
21
- timeout settings['unicorn']['timeout']
22
- listen settings['unicorn']['listen'] if settings['unicorn']['listen']
23
- listen "#{settings['unicorn']['socks_dir']}/esp-#{project}.sock", :backlog => 64
24
- pid "#{settings['unicorn']['pids_dir']}/#{project}.pid"
25
- stderr_path "#{settings['unicorn']['logs_dir']}/stderr.log"
26
- stdout_path "#{settings['unicorn']['logs_dir']}/stdout.log"
27
-
28
- before_fork do |server, worker|
29
- defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect!
30
- end
31
-
32
- after_fork do |server, worker|
33
- defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection
34
- end
@@ -1,34 +0,0 @@
1
- current_dir = File.expand_path('../..', __FILE__)
2
-
3
- project = current_dir.split('/').last
4
-
5
- settings = YAML.load_file "#{current_dir}/config/settings.yml"
6
-
7
- settings['unicorn'] ||= {}
8
- settings['unicorn']['workers'] ||= 2
9
- settings['unicorn']['preload'] = true if settings['unicorn']['preload'] != false
10
- settings['unicorn']['timeout'] ||= 300
11
-
12
- settings['unicorn']['logs_dir'] ||= "/var/log/esp/#{project}"
13
- settings['unicorn']['pids_dir'] ||= '/var/run/esp'
14
- settings['unicorn']['socks_dir'] ||= '/tmp'
15
- unless settings['unicorn']['socks_dir'].start_with? "/"
16
- settings['unicorn']['socks_dir'] = "#{current_dir}/#{settings['unicorn']['socks_dir']}"
17
- end
18
-
19
- worker_processes settings['unicorn']['workers']
20
- preload_app settings['unicorn']['preload']
21
- timeout settings['unicorn']['timeout']
22
- listen settings['unicorn']['listen'] if settings['unicorn']['listen']
23
- listen "#{settings['unicorn']['socks_dir']}/esp-#{project}.sock", :backlog => 64
24
- pid "#{settings['unicorn']['pids_dir']}/#{project}.pid"
25
- stderr_path "#{settings['unicorn']['logs_dir']}/stderr.log"
26
- stdout_path "#{settings['unicorn']['logs_dir']}/stdout.log"
27
-
28
- before_fork do |server, worker|
29
- defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect!
30
- end
31
-
32
- after_fork do |server, worker|
33
- defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection
34
- end
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- source ~/.rvm/scripts/rvm
4
- export LANG=ru_RU.UTF-8
5
-
6
- UNICORN=true bundle exec unicorn -c $(realpath $(dirname $0)/../config/unicorn.rb) -E production -D
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- PROJECT=$(basename $(dirname $(dirname $(realpath $0))))
4
-
5
- git checkout Gemfile.lock
6
- git pull
7
- bundle --path .bundle --binstubs --clean --without test:development
8
- bin/rake db:migrate
9
- if [ -f /usr/local/etc/rc.d/esp-${PROJECT} ]; then
10
- /usr/local/etc/rc.d/esp-${PROJECT} restart
11
- fi
12
- bin/rake assets:precompile
13
- if [ -f /usr/local/etc/rc.d/esp-${PROJECT} ]; then
14
- /usr/local/etc/rc.d/esp-${PROJECT} restart
15
- fi