qt-deploy-win 0.0.2

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 25461233e70cde2fde7684dddf7f5fad9fc838a6
4
+ data.tar.gz: 6913d61cba0702cb1a7d3318af67a7d6a410ceda
5
+ SHA512:
6
+ metadata.gz: 8a0d75105c6ad568c24711c7b958a77d37763d723e551a651b190f1f483a92ec5a844a7e02b1a360c526c067f13ae8dd71c3b8b3e7bb9a49dba83659bc2c7e8c
7
+ data.tar.gz: 1d86d6ba434bee0e11d8c162ef371ea0888c901fddce5dd1b70dedf059d7053f78b0f1dd1e8d339babca0864cdc147925c2d3648e39e8fe0c7633cbc110b70c2
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in qtdeploywin.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 MOZGIII
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,37 @@
1
+ # QtDeployWin
2
+
3
+ *Win at deploying your Qt application for Windows.*
4
+
5
+ This is a tiny command-line utility that takes a Qt application executable file built for Windows and produces a directory with a complete set of dependencies required to run the executable on other machines.
6
+
7
+ It is effectively a thin wrapper around Qt's build in `windeployqt` that tries to guess and set some environment variables for you and does some other useful actions that you don't need to do manually.
8
+
9
+ ## Installation
10
+
11
+ Install the command line utility:
12
+
13
+ $ gem install qt-deploy-win
14
+
15
+ Or to use it in your project just add this to `Gemfile`
16
+
17
+ gem 'qt-deploy-win'
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ ## Usage
24
+
25
+ Pass you freshly built app executable path and an output dir (will be cleared!).
26
+
27
+ qt-deploy-win path/to/my-qt-app.exe output-dir/
28
+
29
+ **Warning!** Output dir is cleared every time you run the utility, so use carefully and do not lose your files!
30
+
31
+ ## Contributing
32
+
33
+ 1. Fork it
34
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
35
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
36
+ 4. Push to the branch (`git push origin my-new-feature`)
37
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require "qt-deploy-win/cli"
3
+ QtDeployWin::Cli.exec
@@ -0,0 +1,7 @@
1
+ require "qt-deploy-win/builder"
2
+ require "qt-deploy-win/cli"
3
+ require "qt-deploy-win/version"
4
+
5
+ # Module definition
6
+ module QtDeployWin
7
+ end
@@ -0,0 +1,102 @@
1
+ require "fileutils"
2
+ require "visual_studio"
3
+
4
+ module QtDeployWin
5
+ class Builder
6
+ def initialize(options)
7
+ @options = options
8
+ @errors = []
9
+ @visual_studio = VisualStudio.find("vs2013")
10
+ validate
11
+ end
12
+
13
+ def path(name)
14
+ case name
15
+ when :qt_dir, :dist_dir, :executable, :windeployqt_args
16
+ return @options[name]
17
+ when :windeployqt
18
+ qtdir = path(:qt_dir)
19
+ return nil unless qtdir
20
+ @windeployqt ||= which("windeployqt", "#{qtdir}/bin")
21
+ end
22
+ end
23
+
24
+ def errors
25
+ @errors
26
+ end
27
+
28
+ def valid?
29
+ @errors.empty?
30
+ end
31
+
32
+ def env
33
+ qtdir = path(:qt_dir)
34
+ {
35
+ "QTDIR" => qtdir,
36
+ "PATH" => "#{qtdir}/bin" + File::PATH_SEPARATOR + ENV["PATH"],
37
+ "VSINSTALLDIR" => @visual_studio.root,
38
+ "VCINSTALLDIR" => @visual_studio.toolsets.cpp
39
+ }
40
+ end
41
+
42
+ def build
43
+ raise "Task not valid, unable to exec" unless valid?
44
+
45
+ distdir = path(:dist_dir)
46
+ main_executable = path(:executable)
47
+
48
+ # Setup distdir
49
+ preapare_distdir(distdir)
50
+
51
+ # Copy main executable
52
+ dist_main_path = File.join(distdir, File.basename(main_executable))
53
+ FileUtils.cp main_executable, dist_main_path
54
+
55
+ # Package
56
+ args = path(:windeployqt_args) || []
57
+ system env, path(:windeployqt), dist_main_path, *args
58
+ end
59
+
60
+ protected
61
+
62
+ def preapare_distdir(distdir)
63
+ # Create distdir
64
+ FileUtils.mkdir_p distdir
65
+
66
+ # Clean distdir
67
+ FileUtils.rm_rf Dir["#{distdir}/*"]
68
+ end
69
+
70
+ def validate
71
+ qtdir = path(:qt_dir)
72
+ @errors << ":qt_dir is not set" unless qtdir
73
+ @errors << ":qt_dir not fould at \"#{qtdir}\"" unless qtdir && File.directory?(qtdir)
74
+
75
+ distdir = path(:dist_dir)
76
+ @errors << ":dist_dir is not set" unless distdir
77
+ @errors << ":dist_dir at \"#{qtdir}\" is already exists and not a directory" if distdir && File.exists?(distdir) && !File.directory?(distdir)
78
+
79
+ windeployqt = path(:windeployqt)
80
+ @errors << ":windeployqt is not set" unless windeployqt
81
+ @errors << ":windeployqt at \"#{windeployqt}\" is not fould" unless windeployqt && File.exists?(windeployqt)
82
+
83
+ main_executable = path(:executable)
84
+ @errors << ":executable is not set" unless main_executable
85
+ @errors << ":executable at \"#{main_executable}\" is not fould" unless main_executable && File.file?(main_executable)
86
+
87
+ @errors << "Visual Studio 2013 was not found" unless @visual_studio
88
+ end
89
+
90
+ def which(cmd, paths = ENV['PATH'])
91
+ pathext_env = ENV['PATHEXT']
92
+ exts = pathext_env ? pathext_env.split(';') : ['']
93
+ paths.split(File::PATH_SEPARATOR).each do |path|
94
+ exts.each do |ext|
95
+ exe = File.join(path, "#{cmd}#{ext}")
96
+ return exe if File.executable?(exe) && !File.directory?(exe)
97
+ end
98
+ end
99
+ nil
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,49 @@
1
+ require "qt-deploy-win"
2
+
3
+ module QtDeployWin
4
+ module Cli
5
+ def self.print_usage
6
+ puts "Usage: #{$0} some-qt-app.exe dist-dir"
7
+ end
8
+
9
+ def self.print_extended_usage
10
+ print_usage
11
+ puts
12
+ puts "Pass an executable as a first argument" +
13
+ " and it will be copied to the directoy passed" +
14
+ " as a second argument along with all dependencies."
15
+ puts
16
+ puts "You should also specify a correct path to the Qt" +
17
+ " installation directroy."
18
+ puts "Current ENV['QTDIR']: #{ENV['QTDIR']}"
19
+ puts "Example ENV['QTDIR']: C:/Qt/5.5/msvc2013"
20
+ end
21
+
22
+ def self.exec
23
+ target, dist_dir = ARGV.shift, ARGV.shift
24
+ unless target && dist_dir
25
+ print_extended_usage
26
+ exit 2
27
+ end
28
+
29
+ builder = ::QtDeployWin::Builder.new(
30
+ executable: target,
31
+ dist_dir: dist_dir,
32
+ qt_dir: ENV["QTDIR"],
33
+ windeployqt_args: ARGV.to_a
34
+ )
35
+
36
+ unless builder.valid?
37
+ print_usage
38
+ puts
39
+ puts "The following errors occured:"
40
+ builder.errors.each do |err|
41
+ puts " " + err
42
+ end
43
+ exit
44
+ end
45
+
46
+ builder.build
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,3 @@
1
+ module QtDeployWin
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'qt-deploy-win/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "qt-deploy-win"
8
+ spec.version = QtDeployWin::VERSION
9
+ spec.authors = ["MOZGIII"]
10
+ spec.email = ["mike-n@narod.ru"]
11
+ spec.description = %q{This gem provides a small command to gather all application files required for a Qt app deploy for Windows in one place ready for packaging.}
12
+ spec.summary = %q{Win at deplying Qt applications for Windows}
13
+ spec.homepage = "https://github.com/MOZGIII/qt-deploy-win"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+
24
+ spec.add_dependency "visual_studio", "0.0.0.3"
25
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: qt-deploy-win
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - MOZGIII
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-09-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: visual_studio
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.0.0.3
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.0.0.3
55
+ description: This gem provides a small command to gather all application files required
56
+ for a Qt app deploy for Windows in one place ready for packaging.
57
+ email:
58
+ - mike-n@narod.ru
59
+ executables:
60
+ - qt-deploy-win
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - .gitignore
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - bin/qt-deploy-win
70
+ - lib/qt-deploy-win.rb
71
+ - lib/qt-deploy-win/builder.rb
72
+ - lib/qt-deploy-win/cli.rb
73
+ - lib/qt-deploy-win/version.rb
74
+ - qt-deploy-win.gemspec
75
+ homepage: https://github.com/MOZGIII/qt-deploy-win
76
+ licenses:
77
+ - MIT
78
+ metadata: {}
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubyforge_project:
95
+ rubygems_version: 2.4.1
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: Win at deplying Qt applications for Windows
99
+ test_files: []
100
+ has_rdoc: