winscreen 0.1.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6ea5a0f8969858d761e21581a727d8d7b4faf1d1c9fc2cb47acccb396d42c1c4
4
+ data.tar.gz: cd894a95dd1117a6924c7166ab00df21be593f5e4ae260bddeca60222bede992
5
+ SHA512:
6
+ metadata.gz: f14374b53b8ae0a7074d9f63708d923d07b82a83d6d63a66873124ff6162c4178b2b1ec63ca10ba007269ebf59963e79d1bc17682855bb288c58e1b4972e9e0b
7
+ data.tar.gz: 21101b1f61a2b3786437dc680804ce14352bff269e123abe15c05970f3cce497619887e882cbe3f5219092ebbb59d3a3d7304cc03da743ce0bb5e0002482fe85
data/bin/console ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "winscreen"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ require "irb"
11
+ IRB.start(__FILE__)
data/bin/setup ADDED
File without changes
@@ -0,0 +1,3 @@
1
+ module Winscreen
2
+ VERSION = "0.1.0"
3
+ end
data/lib/winscreen.rb ADDED
@@ -0,0 +1,30 @@
1
+ module Winscreen
2
+ def self.screenshot(file)
3
+ windows?
4
+ file = normalize_paths(file)
5
+
6
+ powershell_script = <<~PS
7
+ Add-Type -AssemblyName System.Windows.Forms
8
+ Add-Type -AssemblyName System.Drawing
9
+ $bitmap = New-Object System.Drawing.Bitmap([System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Width, [System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Height)
10
+ $graphics = [System.Drawing.Graphics]::FromImage($bitmap)
11
+ $graphics.CopyFromScreen(0, 0, 0, 0, $bitmap.Size)
12
+ $bitmap.Save('#{file}')
13
+ PS
14
+
15
+ system("powershell -ExecutionPolicy Bypass -Command \"#{powershell_script}\"")
16
+ end
17
+
18
+ def self.normalize_paths(value)
19
+ value.gsub('\\', '/') if value.is_a?(String)
20
+ end
21
+
22
+ def self.windows?
23
+ if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
24
+ true
25
+ else
26
+ puts "It works only on Windows!"
27
+ exit!
28
+ end
29
+ end
30
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: winscreen
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Arda Tetik
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 2025-04-13 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: A library that allows you to take screenshots on Windows systems
13
+ email:
14
+ - ardatetik1881@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - bin/console
20
+ - bin/setup
21
+ - lib/winscreen.rb
22
+ - lib/winscreen/version.rb
23
+ homepage: https://github.com/ardatetikbey/winscreen
24
+ licenses:
25
+ - MIT
26
+ metadata:
27
+ homepage_uri: https://github.com/ardatetikbey/winscreen
28
+ source_code_uri: https://github.com/ardatetikbey/winscreen
29
+ rdoc_options: []
30
+ require_paths:
31
+ - lib
32
+ required_ruby_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 3.1.0
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ requirements: []
43
+ rubygems_version: 3.6.2
44
+ specification_version: 4
45
+ summary: Screenshot tool for Windows systems
46
+ test_files: []