openteam-commons 0.0.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.
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ = OpenteamCommons
2
+
3
+ This project rocks and uses MIT-LICENSE.
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'OpenteamCommons'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,6 @@
1
+ begin
2
+ require 'sunspot'
3
+
4
+ Sunspot.config.solr.url = Settings['solr.url']
5
+ rescue LoadError
6
+ end
@@ -0,0 +1,18 @@
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
+
@@ -0,0 +1,21 @@
1
+ app:
2
+ secret: SECRET
3
+
4
+ errors:
5
+ key: KEY
6
+ url: http://errors.openteam.ru
7
+
8
+ #solr:
9
+ # url: http://localhost:8982/solr
10
+
11
+ #sso:
12
+ # key: KEY
13
+ # secret: SECRET
14
+ # url: http://esp-sso.openteam.ru
15
+
16
+ #storage
17
+ #url: http://esp-storage.openteam.ru
18
+
19
+ unicorn:
20
+ workers: 2
21
+ timeout: 300
@@ -0,0 +1,28 @@
1
+ current_dir = File.expand_path('../..', __FILE__)
2
+
3
+ group, project = current_dir.split('/')[-2..-1]
4
+
5
+ settings = YAML.load_file "#{current_dir}/config/settings.yml"
6
+
7
+ settings['unicorn'] ||= {}
8
+
9
+ worker_processes (settings['unicorn']['workers'] || 2).to_i
10
+ timeout (settings['unicorn']['timeout'] || 300).to_i
11
+ preload_app true
12
+
13
+ if ENV['PORT'] # Heroku evironment
14
+ listen ENV['PORT'].to_i, :tcp_nopush => false
15
+ else
16
+ listen "/tmp/#{group}-#{project}.sock", :backlog => 64
17
+ pid "/var/run/#{group}/#{project}.pid"
18
+ stdout_path "/var/log/#{group}/#{project}/stdout.log"
19
+ stderr_path "/var/log/#{group}/#{project}/stderr.log"
20
+ end
21
+
22
+ before_fork do |server, worker|
23
+ defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect!
24
+ end
25
+
26
+ after_fork do |server, worker|
27
+ defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection
28
+ end
@@ -0,0 +1,21 @@
1
+ module OpenteamCommons
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
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
+
10
+ chmod 'script/start_site', 0755
11
+ chmod 'script/update_site', 0755
12
+ end
13
+
14
+ def create_configs
15
+ copy_file 'config/unicorn.rb'
16
+ copy_file 'config/settings.yml.example'
17
+ end
18
+ end
19
+ end
20
+ end
21
+
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env bash
2
+
3
+ if [ -f ~/.rvm/scripts/rvm ]; then
4
+ source ~/.rvm/scripts/rvm
5
+ fi
6
+
7
+ export LANG=ru_RU.UTF-8
8
+
9
+ bundle exec unicorn -c $(realpath $(dirname $0)/../config/unicorn.rb) -E production -D
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env bash
2
+
3
+ CURRENT_PATH=$(dirname $(dirname $(realpath $0)))
4
+
5
+ PROJECT_GROUP=$(basename $(dirname $CURRENT_PATH))
6
+ PROJECT_NAME=$(basename $(dirname $(dirname $(realpath $0))))
7
+
8
+ echo "group: ${PROJECT_GROUP} name: ${PROJECT_NAME}"
9
+
10
+ if [ $(/usr/bin/uname) == "FreeBSD" ]; then
11
+ git checkout Gemfile.lock
12
+ fi
13
+
14
+ git pull
15
+
16
+ bundle --path .bundle --binstubs --clean --without test:development
17
+
18
+ bin/rake db:migrate
19
+
20
+ if [ $(/usr/bin/uname) == "FreeBSD" ]; then
21
+ RC_PATH=/usr/local/rc.d/
22
+ else
23
+ RC_PATH=/etc/init.d/
24
+ fi
25
+
26
+ RC_SCRIPT=${RC_PATH}/${PROJECT_GROUP}-${PROJECT_NAME}
27
+
28
+ if [ -f ${RC_SCRIPT} ]; then
29
+ ${RC_SCRIPT} restart
30
+
31
+ bin/rake assets:precompile
32
+
33
+ ${RC_SCRIPT} restart
34
+ else
35
+ bin/rake assets:precompile
36
+ fi
37
+
@@ -0,0 +1,4 @@
1
+ require "openteam-commons/engine"
2
+
3
+ module OpenteamCommons
4
+ end
@@ -0,0 +1,56 @@
1
+ require 'airbrake'
2
+ require 'configliere'
3
+
4
+ module OpenteamCommons
5
+ class Engine < ::Rails::Engine
6
+ isolate_namespace OpenteamCommons
7
+
8
+ config.before_configuration do
9
+ Settings.read(Rails.root.join('config', 'settings.yml')) if Rails.root.join('config', 'settings.yml').exist?
10
+
11
+ Settings.defaults Settings.extract!(Rails.env)[Rails.env] || {}
12
+ Settings.extract!(:test, :development, :production)
13
+
14
+ Settings.define 'app.secret', :env_var => 'APP_SECRET'
15
+ Settings.define 'app.url', :env_var => 'APP_URL'
16
+
17
+ Settings.define 'errors.key', :env_var => 'ERRORS_KEY'
18
+ Settings.define 'errors.url', :env_var => 'ERRORS_URL'
19
+
20
+ Settings.define 'solr.url', :env_var => 'SOLR_URL'
21
+
22
+ Settings.define 'sso.key', :env_var => 'SSO_KEY'
23
+ Settings.define 'sso.secret', :env_var => 'SSO_SECRET'
24
+ Settings.define 'sso.url', :env_var => 'SSO_URL'
25
+
26
+ Settings.define 'storage.url', :env_var => 'STORAGE_URL'
27
+
28
+ Settings.define 'unicorn.workers', :env_var => 'STORAGE_URL'
29
+ Settings.define 'unicorn.timeout', :env_var => 'STORAGE_URL'
30
+ end
31
+
32
+ config.before_initialize do
33
+ if Settings['errors.key'].present?
34
+ Airbrake.configure do |config|
35
+ config.api_key = Settings['errors.key']
36
+
37
+ URI.parse(Settings['errors.url']).tap do | url |
38
+ config.host = url.host
39
+ config.port = url.port
40
+ config.secure = url.scheme.inquiry.https?
41
+ end
42
+ end
43
+ end
44
+ end
45
+
46
+ config.after_initialize do
47
+ Rails.logger.level = ActiveSupport::BufferedLogger::Severity::WARN if Rails.env.production?
48
+ end
49
+
50
+ config.after_initialize do
51
+ Rails.application.config.secret_token = Settings['app.secret']
52
+
53
+ I18n.locale = I18n.default_locale
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,3 @@
1
+ module OpenteamCommons
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: openteam-commons
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - OpenTeam
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: airbrake
16
+ requirement: &15012000 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *15012000
25
+ - !ruby/object:Gem::Dependency
26
+ name: configliere
27
+ requirement: &15027660 !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: *15027660
36
+ - !ruby/object:Gem::Dependency
37
+ name: rails
38
+ requirement: &15026940 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *15026940
47
+ - !ruby/object:Gem::Dependency
48
+ name: unicorn
49
+ requirement: &15026240 !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: *15026240
58
+ description: Description of OpenteamCommons.
59
+ email:
60
+ - mail@openteam.ru
61
+ executables: []
62
+ extensions: []
63
+ extra_rdoc_files: []
64
+ files:
65
+ - config/initializers/sunspot.rb
66
+ - config/locales/datetime.ru.yml
67
+ - lib/generators/openteam_commons/install/config/settings.yml.example
68
+ - lib/generators/openteam_commons/install/config/unicorn.rb
69
+ - lib/generators/openteam_commons/install/install_generator.rb
70
+ - lib/generators/openteam_commons/install/script/start_site
71
+ - lib/generators/openteam_commons/install/script/update_site
72
+ - lib/openteam-commons/engine.rb
73
+ - lib/openteam-commons/version.rb
74
+ - lib/openteam-commons.rb
75
+ - MIT-LICENSE
76
+ - Rakefile
77
+ - README.rdoc
78
+ homepage: https://github.com/openteam/openteam-commons
79
+ licenses: []
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ segments:
91
+ - 0
92
+ hash: -3981383230575690271
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ segments:
100
+ - 0
101
+ hash: -3981383230575690271
102
+ requirements: []
103
+ rubyforge_project:
104
+ rubygems_version: 1.8.16
105
+ signing_key:
106
+ specification_version: 3
107
+ summary: Summary of OpenteamCommons.
108
+ test_files: []