stench 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.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ gem "ffi"
9
+ group :development do
10
+ gem "bacon", ">= 0"
11
+ gem "rdoc", "~> 3.12"
12
+ gem "bundler", "~> 1.0"
13
+ gem "jeweler", "~> 2.0.1"
14
+ gem "simplecov", ">= 0"
15
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2014 Patrick Hanevold
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.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = stench
2
+
3
+ Windows bindings for opine
data/Rakefile ADDED
@@ -0,0 +1,51 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
17
+ gem.name = "stench"
18
+ gem.homepage = "http://github.com/patrickhno/stench"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Windows bindings for opine}
21
+ gem.description = %Q{Windows bindings for opine}
22
+ gem.email = "patrick.hanevold@gmail.com"
23
+ gem.authors = ["Patrick Hanevold"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:spec) do |spec|
30
+ spec.libs << 'lib' << 'spec'
31
+ spec.pattern = 'spec/**/*_spec.rb'
32
+ spec.verbose = true
33
+ end
34
+
35
+ desc "Code coverage detail"
36
+ task :simplecov do
37
+ ENV['COVERAGE'] = "true"
38
+ Rake::Task['spec'].execute
39
+ end
40
+
41
+ task :default => :spec
42
+
43
+ require 'rdoc/task'
44
+ Rake::RDocTask.new do |rdoc|
45
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
46
+
47
+ rdoc.rdoc_dir = 'rdoc'
48
+ rdoc.title = "stench #{version}"
49
+ rdoc.rdoc_files.include('README*')
50
+ rdoc.rdoc_files.include('lib/**/*.rb')
51
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/lib/stench.rb ADDED
@@ -0,0 +1,139 @@
1
+
2
+ require 'ffi'
3
+
4
+ module Stench
5
+ module WinBase
6
+ extend FFI::Library
7
+ ffi_lib('user32', 'gdi32', 'kernel32')
8
+ ffi_convention(:stdcall)
9
+
10
+ def self._func(*args)
11
+ attach_function *args
12
+ case args.size
13
+ when 3
14
+ module_function args[0]
15
+ when 4
16
+ module_function args[0]
17
+ alias_method(args[1], args[0])
18
+ module_function args[1]
19
+ end
20
+ end
21
+
22
+ ULONG_PTR = FFI::TypeDefs[:ulong]
23
+ LONG_PTR = FFI::TypeDefs[:long]
24
+
25
+ ULONG = FFI::TypeDefs[:ulong]
26
+ LONG = FFI::TypeDefs[:long]
27
+ LPVOID = FFI::TypeDefs[:pointer]
28
+ INT = FFI::TypeDefs[:int]
29
+ BYTE = FFI::TypeDefs[:uint16]
30
+ DWORD = FFI::TypeDefs[:ulong]
31
+ BOOL = FFI::TypeDefs[:int]
32
+ UINT = FFI::TypeDefs[:uint]
33
+ POINTER = FFI::TypeDefs[:pointer]
34
+ VOID = FFI::TypeDefs[:void]
35
+
36
+ HWND = HICON = HCURSOR = HBRUSH = HINSTANCE = HGDIOBJ =
37
+ HMENU = HMODULE = HANDLE = ULONG_PTR
38
+ LPARAM = LONG_PTR
39
+ WPARAM = ULONG_PTR
40
+ LPCTSTR = LPMSG = LPVOID
41
+ LRESULT = LONG_PTR
42
+ ATOM = BYTE
43
+
44
+ WNDPROC = callback(:WindowProc, [HWND, UINT, WPARAM, LPARAM], LRESULT)
45
+
46
+ class WNDCLASSEX < FFI::Struct
47
+ layout :cbSize, UINT,
48
+ :style, UINT,
49
+ :lpfnWndProc, WNDPROC,
50
+ :cbClsExtra, INT,
51
+ :cbWndExtra, INT,
52
+ :hInstance, HANDLE,
53
+ :hIcon, HICON,
54
+ :hCursor, HCURSOR,
55
+ :hbrBackground, HBRUSH,
56
+ :lpszMenuName, LPCTSTR,
57
+ :lpszClassName, LPCTSTR,
58
+ :hIconSm, HICON
59
+
60
+ def initialize(*args)
61
+ super
62
+ self[:cbSize] = self.size
63
+ @atom = 0
64
+ end
65
+
66
+ def register_class_ex
67
+ (@atom = WinBase::RegisterClassEx(self)) != 0 ? @atom : raise("RegisterClassEx Error")
68
+ end
69
+
70
+ def atom
71
+ @atom != 0 ? @atom : register_class_ex
72
+ end
73
+ end # WNDCLASSEX
74
+
75
+ class POINT < FFI::Struct
76
+ layout :x, LONG,
77
+ :y, LONG
78
+ end
79
+
80
+ class MSG < FFI::Struct
81
+ layout :hwnd, HWND,
82
+ :message, UINT,
83
+ :wParam, WPARAM,
84
+ :lParam, LPARAM,
85
+ :time, DWORD,
86
+ :pt, POINT
87
+ end
88
+
89
+ _func(:GetModuleHandle,
90
+ :GetModuleHandleA, [LPCTSTR], HMODULE)
91
+ _func(:LoadImage,
92
+ :LoadImageA, [HINSTANCE, LPCTSTR, UINT, INT, INT, UINT], HANDLE)
93
+ _func(:GetStockObject, [INT], HGDIOBJ)
94
+ _func(:RegisterClassEx,
95
+ :RegisterClassExA, [LPVOID], ATOM)
96
+ _func(:CreateWindowEx,
97
+ :CreateWindowExA, [DWORD, LPCTSTR, LPCTSTR, DWORD,
98
+ INT, INT, INT, INT, HWND, HMENU, HINSTANCE, LPVOID], HWND)
99
+ _func(:ShowWindow, [HWND, INT], BOOL)
100
+ _func(:UpdateWindow, [HWND], BOOL)
101
+ _func(:GetMessage,
102
+ :GetMessageA, [LPMSG, HWND, UINT, UINT], BOOL)
103
+ _func(:TranslateMessage, [LPVOID], BOOL)
104
+ _func(:DispatchMessage,
105
+ :DispatchMessageA, [LPVOID], BOOL)
106
+ _func(:PostQuitMessage, [INT], VOID)
107
+ _func(:DefWindowProc,
108
+ :DefWindowProcA, [HWND, UINT, WPARAM, LPARAM], LRESULT)
109
+ _func(:IsWindow, [HWND], BOOL)
110
+ _func(:DestroyWindow, [HWND], BOOL)
111
+ _func(:SetClassLong,
112
+ :SetClassLongA, [HWND, INT, LONG], DWORD)
113
+ _func(:InvalidateRect, [HWND, LPVOID, BOOL], BOOL)
114
+
115
+ _func(:MessageBoxW, [HWND, LPCTSTR, LPCTSTR, UINT], INT)
116
+
117
+ GWL_HINSTANCE = -6
118
+ NULL = 0
119
+ IDI_APPLICATION = 32512
120
+ IMAGE_ICON = 1
121
+ LR_SHARED = 32768
122
+ IDC_ARROW = 32512
123
+ IMAGE_CURSOR = 2
124
+ WHITE_BRUSH = 0
125
+ BLACK_BRUSH = 4
126
+ WS_EX_LEFT = 0
127
+ WS_OVERLAPPEDWINDOW = 13565952
128
+ WS_VISIBLE = 268435456
129
+ CW_USEDEFAULT = -2147483648
130
+ WM_DESTROY = 2
131
+ WM_LBUTTONDOWN = 513
132
+ WM_RBUTTONUP = 517
133
+ GCL_HBRBACKGROUND = -10
134
+ TRUE = 1
135
+ MB_OK = 0
136
+ end
137
+
138
+ HINST = WinBase.GetModuleHandle(nil)
139
+ end
@@ -0,0 +1,32 @@
1
+ require 'simplecov'
2
+
3
+ module SimpleCov::Configuration
4
+ def clean_filters
5
+ @filters = []
6
+ end
7
+ end
8
+
9
+ SimpleCov.configure do
10
+ clean_filters
11
+ load_adapter 'test_frameworks'
12
+ end
13
+
14
+ ENV["COVERAGE"] && SimpleCov.start do
15
+ add_filter "/.rvm/"
16
+ end
17
+ require 'rubygems'
18
+ require 'bundler'
19
+ begin
20
+ Bundler.setup(:default, :development)
21
+ rescue Bundler::BundlerError => e
22
+ $stderr.puts e.message
23
+ $stderr.puts "Run `bundle install` to install missing gems"
24
+ exit e.status_code
25
+ end
26
+ require 'bacon'
27
+
28
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
29
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
30
+ require 'stench'
31
+
32
+ Bacon.summary_on_exit
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Stench" do
4
+ it "fails" do
5
+ should.flunk "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
data/stench.gemspec ADDED
@@ -0,0 +1,64 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "stench"
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Patrick Hanevold"]
12
+ s.date = "2014-04-14"
13
+ s.description = "Windows bindings for opine"
14
+ s.email = "patrick.hanevold@gmail.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "LICENSE.txt",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "lib/stench.rb",
27
+ "spec/spec_helper.rb",
28
+ "spec/stench_spec.rb",
29
+ "stench.gemspec"
30
+ ]
31
+ s.homepage = "http://github.com/patrickhno/stench"
32
+ s.licenses = ["MIT"]
33
+ s.require_paths = ["lib"]
34
+ s.rubygems_version = "1.8.23"
35
+ s.summary = "Windows bindings for opine"
36
+
37
+ if s.respond_to? :specification_version then
38
+ s.specification_version = 3
39
+
40
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
41
+ s.add_runtime_dependency(%q<ffi>, [">= 0"])
42
+ s.add_development_dependency(%q<bacon>, [">= 0"])
43
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
44
+ s.add_development_dependency(%q<bundler>, ["~> 1.0"])
45
+ s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
46
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
47
+ else
48
+ s.add_dependency(%q<ffi>, [">= 0"])
49
+ s.add_dependency(%q<bacon>, [">= 0"])
50
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
51
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
52
+ s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
53
+ s.add_dependency(%q<simplecov>, [">= 0"])
54
+ end
55
+ else
56
+ s.add_dependency(%q<ffi>, [">= 0"])
57
+ s.add_dependency(%q<bacon>, [">= 0"])
58
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
59
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
60
+ s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
61
+ s.add_dependency(%q<simplecov>, [">= 0"])
62
+ end
63
+ end
64
+
metadata ADDED
@@ -0,0 +1,156 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: stench
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Patrick Hanevold
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-04-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: ffi
16
+ requirement: !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: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: bacon
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rdoc
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '3.12'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '3.12'
62
+ - !ruby/object:Gem::Dependency
63
+ name: bundler
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '1.0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '1.0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: jeweler
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: 2.0.1
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 2.0.1
94
+ - !ruby/object:Gem::Dependency
95
+ name: simplecov
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ description: Windows bindings for opine
111
+ email: patrick.hanevold@gmail.com
112
+ executables: []
113
+ extensions: []
114
+ extra_rdoc_files:
115
+ - LICENSE.txt
116
+ - README.rdoc
117
+ files:
118
+ - .document
119
+ - Gemfile
120
+ - LICENSE.txt
121
+ - README.rdoc
122
+ - Rakefile
123
+ - VERSION
124
+ - lib/stench.rb
125
+ - spec/spec_helper.rb
126
+ - spec/stench_spec.rb
127
+ - stench.gemspec
128
+ homepage: http://github.com/patrickhno/stench
129
+ licenses:
130
+ - MIT
131
+ post_install_message:
132
+ rdoc_options: []
133
+ require_paths:
134
+ - lib
135
+ required_ruby_version: !ruby/object:Gem::Requirement
136
+ none: false
137
+ requirements:
138
+ - - ! '>='
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ segments:
142
+ - 0
143
+ hash: -4355822145871775875
144
+ required_rubygems_version: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ requirements: []
151
+ rubyforge_project:
152
+ rubygems_version: 1.8.23
153
+ signing_key:
154
+ specification_version: 3
155
+ summary: Windows bindings for opine
156
+ test_files: []