smalruby 0.0.13-x86-mingw32 → 0.0.14-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 might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1000156099f8bcf1bf2b1729bcb5b151b922f738
4
- data.tar.gz: acadb5ea4a761b44a280d966ee0332b8bd3d902e
3
+ metadata.gz: 662d38eef7ff8574fe13fb00d76e20d833a9c58c
4
+ data.tar.gz: 5454a19803cb7d3d8dece7c60cd7875ff31a36f6
5
5
  SHA512:
6
- metadata.gz: 965143c6fadafed0f0965dff950736629a391a78af012c2b98a85e75b81c24b7a0374711d381000259baf7fb9bceab24e6c9966edcd6f1fe55a2ed9c5ecd6021
7
- data.tar.gz: f397c4132c9e557326d7ca552064b493e29a13b48bc62e97091446439174396c59f1c5c7a4c4fde5a3e5f4bc28df9353938150fb951149b0a8f98e3f1c5a0906
6
+ metadata.gz: e0b2a61ed1a60e51d53f0caf21296b9bce9d50101d25d33de83e33a3f4d961ce21876abb53fa7205dc2dfd5bad8ca726ffad83e02eb5f3c5d564ea8f80c39fd7
7
+ data.tar.gz: f6ec10eefbbd9d62f89470ca1bc9d3422318c1fee79d6849ee1416c54b7fb548ce189c6b99dee18a9c96d497dca30f5c0710e5d9b8e954424ba57bd5fa3943c8
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- require 'bundler/gem_tasks'
1
+ require 'bundler/gem_helper'
2
2
  require 'yard'
3
3
  require "rspec/core/rake_task"
4
4
 
@@ -39,4 +39,44 @@ task :rubocop do
39
39
  sh "rubocop #{files.split(/\s+/m).join(' ')}"
40
40
  end
41
41
 
42
+ namespace :gem do
43
+ Bundler::GemHelper.install_tasks
44
+ end
45
+
46
+ task :build do
47
+ ENV['GEM_PLATFORM'] = 'linux'
48
+ Rake::Task['gem:build'].invoke
49
+
50
+ ENV['GEM_PLATFORM'] = 'x86-mingw32'
51
+ Rake::Task['gem:build'].reenable
52
+ Rake::Task['gem:build'].invoke
53
+ end
54
+
55
+ task :release do
56
+ ENV['GEM_PLATFORM'] = 'linux'
57
+ Rake::Task['gem:release'].invoke
58
+
59
+ ENV['GEM_PLATFORM'] = 'x86-mingw32'
60
+ Rake::Task['gem:release'].reenable
61
+ Rake::Task['gem:build'].reenable
62
+ Rake::Task['gem:release'].invoke
63
+
64
+ require 'smalruby/version'
65
+ next_version = Smalruby::VERSION.split('.').tap { |versions|
66
+ versions[-1] = (versions[-1].to_i + 1).to_s
67
+ }.join('.')
68
+ File.open('lib/smalruby/version.rb', 'r+') do |f|
69
+ lines = []
70
+ while line = f.gets
71
+ line = "#{$1} '#{next_version}'\n" if /(\s*VERSION = )/.match(line)
72
+ lines << line
73
+ end
74
+ f.rewind
75
+ f.write(lines.join)
76
+ end
77
+ sh 'git add lib/smalruby/version.rb'
78
+ sh "git commit -m #{next_version}"
79
+ sh 'git push'
80
+ end
81
+
42
82
  task :default => [:rubocop, :spec]
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  module Smalruby
4
- VERSION = '0.0.13'
4
+ VERSION = '0.0.14'
5
5
  end
data/lib/smalruby.rb CHANGED
@@ -70,6 +70,36 @@ module Smalruby
70
70
  Sound.new('')
71
71
  rescue
72
72
  end
73
+
74
+ activate_window
75
+ end
76
+
77
+ def activate_window
78
+ if Util.windows?
79
+ require 'Win32API'
80
+
81
+ # http://f.orzando.net/pukiwiki-plus/index.php?Programming%2FTips
82
+ # を参考にした
83
+ hwnd_active =
84
+ Win32API.new('user32', 'GetForegroundWindow', nil, 'i').call
85
+ this_thread_id =
86
+ Win32API.new('Kernel32', 'GetCurrentThreadId', nil, 'i').call
87
+ active_thread_id =
88
+ Win32API.new('user32', 'GetWindowThreadProcessId', %w(i p), 'i')
89
+ .call(hwnd_active, 0)
90
+ attach_thread_input =
91
+ Win32API.new('user32', 'AttachThreadInput', %w(i i i), 'v')
92
+ attach_thread_input.call(this_thread_id, active_thread_id, 1)
93
+ Win32API.new('user32', 'SetForegroundWindow', %w(i), 'i')
94
+ .call(Window.hWnd)
95
+ attach_thread_input.call(this_thread_id, active_thread_id, 0)
96
+
97
+ hwnd_topmost = -1
98
+ swp_nosize = 0x0001
99
+ swp_nomove = 0x0002
100
+ Win32API.new('user32', 'SetWindowPos', %w(i i i i i i i), 'i')
101
+ .call(Window.hWnd, hwnd_topmost, 0, 0, 0, 0, swp_nosize | swp_nomove)
102
+ end
73
103
  end
74
104
 
75
105
  def start_window_application
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smalruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
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: 2014-02-16 00:00:00.000000000 Z
11
+ date: 2014-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler