smalruby-editor 0.3.4-x86-mingw32 → 0.3.5-x86-mingw32

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.

Potentially problematic release.


This version of smalruby-editor might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 012e88a0bd70877787902816fbb4f79151047e89
4
- data.tar.gz: 9d9c64c9a0723d556f51a763788ceffad8fd93dd
3
+ metadata.gz: 80cec4a4b2957f4f6e16d8457bad8e73b15fd63b
4
+ data.tar.gz: be2fa77f141227ad5440eb0bfe57ba3c395a7fff
5
5
  SHA512:
6
- metadata.gz: 8a88c395f14acc2372ec5c9f79840fe1e444549c55df08a38a61c1f43418f5e1643ff55480f204ae756dc6d4fef510cc3e64fda4a3c89b1a64a02d91773662f0
7
- data.tar.gz: cafff6a42b7f1f2a96685881af48f160d4bc22e37139f88e3f3b5dd389b833df8be877c74b0d50d908917728297463a21fee44abfa8ab9da07ab814697ae3117
6
+ metadata.gz: 2482c0b0b895e35cd28b0f7f72a73bf70e07cea33b4afd1acbcafed31b2effface5f38c37cf4d08db9930924337ba0c9c37e883148902e27710438b686f3b2db
7
+ data.tar.gz: 0cadd6dfe0bce18bcb88db6448b2bd02995e8b83bdf67c13b60f77c86b01826bf75fb83c7d5d6222eee6b16a50bb5a235663672c8cec28b93b63e37749b1da14
data/bin/smalruby-editor CHANGED
@@ -2,6 +2,7 @@
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
4
  require 'pathname'
5
+ require 'socket'
5
6
 
6
7
  ENV['RAILS_ENV'] = 'standalone'
7
8
  ENV['SMALRUBY_EDITOR_HOME'] ||= Pathname('~/.smalruby-editor').expand_path.to_s
@@ -20,9 +21,35 @@ require 'rails/commands/server'
20
21
  module Rails
21
22
  class Server < ::Rack::Server
22
23
  def start
24
+ if (pid_path = Pathname(options[:pid])).exist?
25
+ pid = pid_path.read.to_i
26
+ if SmalrubyEditor.windows?
27
+ require 'csv'
28
+ s = `tasklist /FI "IMAGENAME eq ruby.exe" /FO csv`
29
+ s.force_encoding('CP932')
30
+ csv = CSV.parse(s)
31
+ csv.shift # ヘッダを除去
32
+ pids = csv.map { |row| row[1].to_i }
33
+ if pids.include?(pid)
34
+ Process.kill('KILL', pid)
35
+ end
36
+ pid_path.unlink
37
+ else
38
+ Timeout.timeout(5) do
39
+ begin
40
+ while Process.kill(0, pid) > 0
41
+ Process.kill('TERM', pid)
42
+ sleep(1)
43
+ end
44
+ rescue Errno::ESRCH
45
+ end
46
+ end
47
+ end
48
+ end
49
+
23
50
  url = "#{options[:SSLEnable] ? 'https' : 'http'}://#{options[:Host]}:#{options[:Port]}"
24
51
  puts "=> Booting #{ActiveSupport::Inflector.demodulize(server)}"
25
- puts "=> smalruby-editor #{SmalrubyEditor::VERSION} starting in #{Rails.env} on #{url}"
52
+ puts "=> smalruby-editor #{SmalrubyEditor::VERSION} starting in #{Rails.env} on #{url} (#{pid_path})"
26
53
  puts "=> Run `smalruby-editor -h` for more startup options"
27
54
  trap(:INT) { exit }
28
55
  puts "=> Ctrl-C to shutdown server" unless options[:daemonize]
@@ -35,17 +62,7 @@ module Rails
35
62
  console.level = Rails.logger.level
36
63
 
37
64
  Rails.logger.extend(ActiveSupport::Logger.broadcast(console))
38
-
39
- if ActiveRecord::Migrator.needs_migration?
40
- ActiveRecord::Migration.verbose = true
41
- begin
42
- ActiveRecord::Migrator.migrate(ActiveRecord::Migrator.migrations_paths)
43
- ensure
44
- ActiveRecord::Migration.verbose = false
45
- end
46
- end
47
65
  end
48
-
49
66
  super
50
67
  ensure
51
68
  # The '-h' option calls exit before @options is set.
@@ -60,7 +77,7 @@ module Rails
60
77
  environment: (ENV['RAILS_ENV'] || ENV['RACK_ENV'] || "development").dup,
61
78
  daemonize: false,
62
79
  debugger: false,
63
- pid: Pathname(ENV['SMALRUBY_EDITOR_HOME']).join("tmp/pids/server.pid").to_s,
80
+ pid: Pathname(ENV['SMALRUBY_EDITOR_HOME']).join("tmp/pids/server_#{Socket.gethostname}.pid").to_s,
64
81
  config: File.expand_path("config.ru")
65
82
  })
66
83
  end
@@ -78,27 +95,29 @@ module Rails
78
95
  options
79
96
  end
80
97
  alias_method_chain :parse_options, :start_callback
98
+
99
+ def wrapped_app_with_migration
100
+ if !@wrapped_app
101
+ wrapped_app_without_migration
102
+
103
+ if ActiveRecord::Migrator.needs_migration?
104
+ ActiveRecord::Migration.verbose = true
105
+ begin
106
+ ActiveRecord::Migrator.migrate(ActiveRecord::Migrator.migrations_paths)
107
+ ensure
108
+ ActiveRecord::Migration.verbose = false
109
+ end
110
+ end
111
+ end
112
+ @wrapped_app
113
+ end
114
+ alias_method_chain :wrapped_app, :migration
81
115
  end
82
116
  end
83
117
 
84
118
  Rails::Server.new.tap do |server|
85
119
  require APP_PATH
86
120
  Dir.chdir(Rails.application.root)
87
- if (pid_path = Pathname(server.default_options[:pid])).exist?
88
- if SmalrubyEditor.windows?
89
- pid = pid_path.read.to_i
90
- require 'csv'
91
- s = `tasklist /FI "IMAGENAME eq ruby.exe" /FO csv`
92
- s.force_encoding('CP932')
93
- csv = CSV.parse(s)
94
- csv.shift # ヘッダを除去
95
- pids = csv.map { |row| row[1].to_i }
96
- if pids.include?(pid)
97
- Process.kill('KILL', pid)
98
- end
99
- pid_path.unlink
100
- end
101
- end
102
121
  server.start
103
122
  end
104
123
  # rubocop:enable all
@@ -1,3 +1,3 @@
1
1
  module SmalrubyEditor
2
- VERSION = '0.3.4'
2
+ VERSION = '0.3.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smalruby-editor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - Kouji Takao
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-01 00:00:00.000000000 Z
11
+ date: 2015-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -493,7 +493,7 @@ files:
493
493
  - public/assets/jquery-ui/ui-icons_888888_256x240-ce584ffa171c3ea9a018cf0d7bec65c8.png
494
494
  - public/assets/jquery-ui/ui-icons_cd0a0a_256x240-747e96029e8dedcabc224e5f7d1f2ede.png
495
495
  - public/assets/loading-e77296be32d066d3e29d3bf9803fa417.gif
496
- - public/assets/manifest-ffc1bf227b15208b38f552b56f9f8c04.json
496
+ - public/assets/manifest-514520c20d8e98306b1bb2d0437f7575.json
497
497
  - public/assets/msg/en_us-a98cc83805d44f5f675fe6eac2c955ec.js
498
498
  - public/assets/msg/en_us-a98cc83805d44f5f675fe6eac2c955ec.js.gz
499
499
  - public/assets/msg/ja-243b0a55ef1086ef2180af94c422cb5e.js