motion-qlcommonmark 1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b6cb1507aabef9d6d52eb4ba4d736064be892c41
4
+ data.tar.gz: 1878854f01bf56ce54182e4458ae2b7c28845970
5
+ SHA512:
6
+ metadata.gz: ac2d4bd786a0183fac63ccfc6b3abf1d79d9e2c96ac8ec550ee989e81ea53173ec637df1c89fca2930cc50f318560077578e08d7e18dcc86dbdd1de160e5d0ca
7
+ data.tar.gz: a293e56fcbd694b239c168a86d78619a80eb11d7ad03bf27d05cef64003e69f7b7cb070fc717230b44b218064819af2566d5cc236dd3e6393bb1922bc705e53b
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # motion-qlcommonmark
2
+
3
+ RubyMotion wrapper for the QuickLook generator [QLCommonMark](https://github.com/digitalmoksha/QLCommonMark)
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'motion-qlcommonmark'
10
+
11
+ And then execute:
12
+
13
+ $ bundle install
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install motion-qlcommonmark
18
+
19
+ ## Usage
20
+
21
+ When you do a build, the QuickLook generator is automatically installed, embedded into your app, and code signed with current signing certificate.
22
+
23
+ If you don't wish for the generator to be signed, you can add this to your `Rakefile`
24
+
25
+ ```
26
+ Motion::Project::App.setup do |app|
27
+ app.qlcommonmark do |config|
28
+ config.signing_enabled = false
29
+ end
30
+ end
31
+ ```
32
+
33
+ ## Contributing
34
+
35
+ 1. Fork it
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create new Pull Request
@@ -0,0 +1,7 @@
1
+ unless defined?(Motion::Project::Config)
2
+ raise "This file must be required within a RubyMotion project Rakefile."
3
+ end
4
+
5
+ require 'project/qlcommonmark'
6
+ require 'project/project'
7
+ require 'project/rake_tasks'
@@ -0,0 +1,39 @@
1
+ module Motion::Project
2
+
3
+ class Config
4
+ variable :qlcommommark
5
+
6
+ #------------------------------------------------------------------------------
7
+ def qlcommonmark(&block)
8
+ @qlcommommark ||= Motion::Project::QLCommonMark.new(self)
9
+ if block
10
+ @qlcommommark.instance_eval &block
11
+ end
12
+ @qlcommommark
13
+ end
14
+ end
15
+
16
+ class Builder
17
+
18
+ # before app is signed, we need to install the generator into the app and sign
19
+ # if needed
20
+ #------------------------------------------------------------------------------
21
+ def codesign_with_qlcommommark(config, platform)
22
+ if File.directory?(config.qlcommonmark.vendored_generator_dir)
23
+ App.info 'QuickLook', "Copying generator to #{config.qlcommonmark.embedded_dir}"
24
+ FileUtils.mkdir_p(config.qlcommonmark.embedded_dir)
25
+ `cp -R "#{App.config.qlcommonmark.vendored_generator_file}" "#{config.qlcommonmark.embedded_dir}"`
26
+
27
+ if config.qlcommonmark.signing_enabled
28
+ App.info 'Codesign', config.qlcommonmark.embedded_file
29
+ `/usr/bin/codesign --force --sign '#{config.codesign_certificate}' "#{config.qlcommonmark.embedded_file}"`
30
+ end
31
+ end
32
+ codesign_without_qlcommommark(config, platform)
33
+ end
34
+
35
+ alias_method "codesign_without_qlcommommark", "codesign"
36
+ alias_method "codesign", "codesign_with_qlcommommark"
37
+ end
38
+
39
+ end
@@ -0,0 +1,81 @@
1
+ module Motion::Project
2
+ class QLCommonMark
3
+
4
+ attr_accessor :signing_enabled
5
+
6
+ FILE_NAME = 'QLCommonMark.qlgenerator'
7
+ ZIP_FILE = 'QLCommonMark.qlgenerator.zip'
8
+
9
+ #------------------------------------------------------------------------------
10
+ def initialize(config)
11
+ @config = config
12
+ @signing_enabled = true
13
+ check_and_install
14
+ end
15
+
16
+ #------------------------------------------------------------------------------
17
+ def vendored_generator_dir
18
+ "#{@config.project_dir}/vendor/QLCommonMark"
19
+ end
20
+
21
+ #------------------------------------------------------------------------------
22
+ def vendored_generator_file
23
+ "#{vendored_generator_dir}/#{FILE_NAME}"
24
+ end
25
+
26
+ #------------------------------------------------------------------------------
27
+ def vendored_zip_file
28
+ "#{vendored_generator_dir}/#{ZIP_FILE}"
29
+ end
30
+
31
+ #------------------------------------------------------------------------------
32
+ def distrib_zip_file
33
+ File.join(File.dirname(__FILE__), "../../vendor/#{ZIP_FILE}")
34
+ end
35
+
36
+ #------------------------------------------------------------------------------
37
+ def embedded_file
38
+ File.join(embedded_dir, FILE_NAME)
39
+ end
40
+
41
+ #------------------------------------------------------------------------------
42
+ def embedded_dir
43
+ File.join(App.config.app_bundle('MacOSX'), "Library/QuickLook")
44
+ end
45
+
46
+ #------------------------------------------------------------------------------
47
+ def installed?
48
+ File.directory?(vendored_generator_dir) && File.file?(vendored_generator_file)
49
+ end
50
+
51
+ # copy the zip from our gem into the vendor of project, and unzip it
52
+ #------------------------------------------------------------------------------
53
+ def install
54
+ FileUtils.rm_rf(vendored_generator_dir) if File.directory?(vendored_generator_dir) # force clean install
55
+ FileUtils.mkdir_p(vendored_generator_dir)
56
+ `cp #{distrib_zip_file} #{vendored_zip_file}`
57
+ `unzip #{vendored_zip_file} -d #{vendored_generator_dir}`
58
+ `rm #{vendored_zip_file}`
59
+ App.info 'QuickLook', 'Installed'
60
+ end
61
+
62
+ #------------------------------------------------------------------------------
63
+ def check_and_install
64
+ install unless installed?
65
+ end
66
+
67
+ #------------------------------------------------------------------------------
68
+ def verify_installation
69
+ if installed?
70
+ App.info "QuickLook", "Generator installed in #{vendored_generator_dir}"
71
+ else
72
+ App.fail "QuickLook generator not correctly copied to #{vendored_generator_dir}
73
+ Run `rake qlcommonmark:install` manually or, if the problem persists,
74
+ please explain your setup and problem as an issue on GitHub at:
75
+ https://github.com/digitalmoksha/motion-qlcommonmark/issues
76
+ "
77
+ end
78
+ end
79
+ end
80
+ end
81
+
@@ -0,0 +1,9 @@
1
+ # Rake tasks
2
+ namespace :qlcommonmark do
3
+
4
+ task :install do
5
+ qlcommonmark = App.config.qlcommonmark
6
+ qlcommonmark.install
7
+ end
8
+
9
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: motion-qlcommonmark
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ platform: ruby
6
+ authors:
7
+ - Brett Walker
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-04-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: RubyMotion wrapper for the QLCommonMark QuickLook generator
28
+ email:
29
+ - brett@digitalmoksha.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - README.md
35
+ - lib/motion-qlcommonmark.rb
36
+ - lib/project/project.rb
37
+ - lib/project/qlcommonmark.rb
38
+ - lib/project/rake_tasks.rb
39
+ homepage: https://github.com/digitalmoksha/motion-qlcommonmark
40
+ licenses:
41
+ - MIT
42
+ metadata: {}
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubyforge_project:
59
+ rubygems_version: 2.6.8
60
+ signing_key:
61
+ specification_version: 4
62
+ summary: RubyMotion wrapper for the QLCommonMark QuickLook generator
63
+ test_files: []