smalruby 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.

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: c6cb8becdbc9075484b7d28401dbb3d19fb6fae8
4
- data.tar.gz: 6438411a47198e5e70a51f02b35ad2e4224e7933
3
+ metadata.gz: d48e818f95fa90aa319dec79707a835c7bd5f1c7
4
+ data.tar.gz: 9ea1edf174ee6d548e88ffd75c0783e5346da27b
5
5
  SHA512:
6
- metadata.gz: 13a1c625289915d8d6baae091c65bbc5fde556aa3836975a648d82b6e19b5bfc02c588f1cc6fa567cfe0d55b4d776330625e4bbc135ee5db309e9f4b41ef8214
7
- data.tar.gz: efac9fc7bdf586241e1c459cf2b319e59390f9ecceeb69155699e6b56d94eabc03498afa0ae7c04522f86aa461e7778a5dc9414f913491f904e3aadec8a61a6a
6
+ metadata.gz: 606311a7fdb4a2194678f13d7cdfc5b7e3c14fd252bfbf25bbfb0e504d8f30c8a40ec6f1aa4e2dca9d8314e4a0d5fbe60392b0a65fdc8fb8d35e108d26d168be
7
+ data.tar.gz: d6b20142206d1003117fc972d8575188b7c5a1f6e2b6d5daf8e3c9b9f59ef985e06a1867099975e4db73f965bd8c1ad52147a8b784e823e59b0ab37de235a2df
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: ruby
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