esp-commons 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/config/unicorn.rb ADDED
@@ -0,0 +1,34 @@
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,3 +1,3 @@
1
1
  module EspCommons
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -4,11 +4,14 @@ module EspCommons
4
4
  source_root File.expand_path('..', __FILE__)
5
5
 
6
6
  def create_binaries
7
- template 'bin/start_site'
7
+ copy_file 'script/start_site'
8
+ copy_file 'script/update_site'
9
+ chmod 'script/start_site', 0755
10
+ chmod 'script/update_site', 0755
8
11
  end
9
12
 
10
13
  def create_configs
11
- template 'config/unicorn.rb'
14
+ copy_file 'config/unicorn.rb'
12
15
  end
13
16
  end
14
17
  end
@@ -0,0 +1,6 @@
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
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env bash
2
+
3
+ PROJECT=$(basename $(dirname $(dirname $(realpath $0))))
4
+
5
+ git checkout
6
+ git pull
7
+ bundle --path .bundle --binstubs --clean
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
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.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-03-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: airbrake
16
- requirement: &8290800 !ruby/object:Gem::Requirement
16
+ requirement: &8925620 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *8290800
24
+ version_requirements: *8925620
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: configliere
27
- requirement: &8290040 !ruby/object:Gem::Requirement
27
+ requirement: &8924880 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *8290040
35
+ version_requirements: *8924880
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rails
38
- requirement: &8288860 !ruby/object:Gem::Requirement
38
+ requirement: &8939740 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *8288860
46
+ version_requirements: *8939740
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: api_smith
49
- requirement: &8303180 !ruby/object:Gem::Requirement
49
+ requirement: &8937880 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *8303180
57
+ version_requirements: *8937880
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: unicorn
60
- requirement: &8301560 !ruby/object:Gem::Requirement
60
+ requirement: &8936140 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *8301560
68
+ version_requirements: *8936140
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sqlite3
71
- requirement: &8300080 !ruby/object:Gem::Requirement
71
+ requirement: &8934780 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *8300080
79
+ version_requirements: *8934780
80
80
  description: Description of EspCommons.
81
81
  email:
82
82
  - mail@openteam.ru
@@ -86,10 +86,12 @@ extra_rdoc_files: []
86
86
  files:
87
87
  - app/models/esp_commons/image.rb
88
88
  - config/initializers/sunspot.rb
89
+ - config/unicorn.rb
89
90
  - config/locales/datetime.ru.yml
90
91
  - config/locales/commons.ru.yml
91
92
  - lib/generators/esp_commons/install/install_generator.rb
92
- - lib/generators/esp_commons/install/bin/start_site
93
+ - lib/generators/esp_commons/install/script/update_site
94
+ - lib/generators/esp_commons/install/script/start_site
93
95
  - lib/generators/esp_commons/install/config/schedule.rb
94
96
  - lib/generators/esp_commons/install/config/unicorn.rb
95
97
  - lib/esp-commons/engine.rb
@@ -112,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
114
  version: '0'
113
115
  segments:
114
116
  - 0
115
- hash: -2181019276315037716
117
+ hash: 801026800095515242
116
118
  required_rubygems_version: !ruby/object:Gem::Requirement
117
119
  none: false
118
120
  requirements:
@@ -121,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
123
  version: '0'
122
124
  segments:
123
125
  - 0
124
- hash: -2181019276315037716
126
+ hash: 801026800095515242
125
127
  requirements: []
126
128
  rubyforge_project:
127
129
  rubygems_version: 1.8.15
@@ -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 `dirname $0`/../config/unicorn.rb -E production -D