extend_script 0.1.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0b5f2bdc5814e956ae9b727e89eaff47add7cc22
4
+ data.tar.gz: b57dda5d4b89b1e01ec3c123f6a8244001537274
5
+ SHA512:
6
+ metadata.gz: 1571ad2cc531c099a03add38bbe97c9e85e5ae415ce6cfd6ad670e6210f5727e59dce1e0551e6260142c5a9062fc14e2c004c3e7bf777505e95cd90e6dbe9003
7
+ data.tar.gz: b4e5b0a685735e4f64baacb72a56efb71ee0522e8899c66eea80beb90a860afd124210cd199330f781b1d52aa2f6ffbde58e9acdc390138e0f7c6a57662c1b6e
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.0
5
+ before_install: gem install bundler -v 1.13.7
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in extend_script.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 milligramme
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # ExtendScript
2
+
3
+ Adobe ExtendScript Utility
4
+
5
+ - [x] merge multiple jsxs into a single jsx file or STDOUT.
6
+
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'extend_script'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install extend_script
23
+
24
+ ## Usage
25
+
26
+ $ extendscript merge --input main.jsx [--output merged.jsx]
27
+ $ extendscript merge -i main.jsx [-o merged.jsx]
28
+
29
+ ## Development
30
+
31
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
32
+
33
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
34
+
35
+ ## Contributing
36
+
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/extend_script.
38
+
39
+
40
+ ## License
41
+
42
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
43
+
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "extend_script"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/extendscript ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "extend_script"
5
+
6
+ ExtendScript::Client.start(ARGV)
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'extend_script/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "extend_script"
8
+ spec.version = ExtendScript::VERSION
9
+ spec.authors = ["milligramme"]
10
+ spec.email = ["milligramme.cc@gmail.com"]
11
+
12
+ spec.summary = %q{adobe jsx utility.}
13
+ spec.homepage = "https://github.com/milligramme/extend_script"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.13"
24
+ spec.add_development_dependency "rake", "~> 12.0"
25
+ spec.add_development_dependency "minitest", "~> 5.0"
26
+ spec.add_runtime_dependency "thor", "~> 0.19"
27
+ end
@@ -0,0 +1,54 @@
1
+ require 'thor'
2
+ require 'fileutils'
3
+ module ExtendScript
4
+ class Client < Thor
5
+ default_command nil
6
+
7
+ desc "merge usage", "extendscript merge -i infile [-o outfile]"
8
+ method_option "input", aliases: "i", required: true
9
+ method_option "output", aliases: "o", required: false
10
+ def merge
11
+ infile = options['input']
12
+ outfile = options['output']
13
+ export(infile, outfile)
14
+ end
15
+
16
+ private
17
+ def export(infile, outfile)
18
+ ret = merge_recursive(infile)
19
+ if outfile
20
+ out_path = File.expand_path(outfile)
21
+ FileUtils.mkdir_p(File.dirname out_path) unless File.exist?(File.dirname out_path)
22
+ File.open(out_path, "wb") do |file|
23
+ file << ret.join
24
+ end
25
+ else
26
+ puts ret.join
27
+ end
28
+ end
29
+
30
+ def merge_recursive(infile, results=[], dup={})
31
+ File.open(infile, "r") do |file|
32
+ file.readlines.each do |line|
33
+ # search #include or //@include
34
+ reg = /(^#|^\/\/@)include\s+[\'\"](.+)[\'\"]/
35
+ if line =~ reg
36
+ m2 = line.match(reg)[2]
37
+ child_path = File.expand_path(m2, File.dirname(infile))
38
+ if dup[child_path].nil?
39
+ dup[child_path] = true
40
+ # source comment
41
+ # results << "//-->source: #{child_path}\n"
42
+ merge_recursive(child_path, results, dup)
43
+ end
44
+ else
45
+ results << line
46
+ end
47
+ end
48
+ end
49
+ results
50
+ end
51
+
52
+ end
53
+ end
54
+
@@ -0,0 +1,3 @@
1
+ module ExtendScript
2
+ VERSION = "0.1.1"
3
+ end
@@ -0,0 +1,6 @@
1
+ require "extend_script/version"
2
+ require "extend_script/client"
3
+
4
+ module ExtendScript
5
+ # Your code goes here...
6
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: extend_script
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - milligramme
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-03-28 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.13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '12.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '12.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: thor
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.19'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.19'
69
+ description:
70
+ email:
71
+ - milligramme.cc@gmail.com
72
+ executables:
73
+ - extendscript
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".travis.yml"
79
+ - Gemfile
80
+ - LICENSE.txt
81
+ - README.md
82
+ - Rakefile
83
+ - bin/console
84
+ - bin/setup
85
+ - exe/extendscript
86
+ - extend_script.gemspec
87
+ - lib/extend_script.rb
88
+ - lib/extend_script/client.rb
89
+ - lib/extend_script/version.rb
90
+ homepage: https://github.com/milligramme/extend_script
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 2.6.8
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: adobe jsx utility.
114
+ test_files: []