middleman-typescript 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 27428c33e45143c8ea66e3c5278190524814815e
4
+ data.tar.gz: 6ce4eb42672b0b8ac293f8c12ad34908386741fc
5
+ SHA512:
6
+ metadata.gz: a8c59c0dbacebc4b124395f94d7b879a632e6e8242eaf895a1427ccfc2947217432e75f74a49ed4c883b62d3cf25b35a1c8fa856950db7e0b572d0236d9b0668
7
+ data.tar.gz: fc376fac243a1c10829da1e5e0ef2b7f7ca655e80f26c7673dad50cc1be0e10b310983eeb34610f7540b42d90dc40174f22ab68bb29214683af5c1db1fb354c2
data/.gitignore ADDED
@@ -0,0 +1,34 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /lib/bundler/man/
26
+
27
+ # for a library or gem, you might want to ignore these files since the code is
28
+ # intended to run in multiple environments; otherwise, check them in:
29
+ # Gemfile.lock
30
+ # .ruby-version
31
+ # .ruby-gemset
32
+
33
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in middleman-typescript.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,69 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ middleman-typescript (0.0.1)
5
+ middleman-core (~> 3.2)
6
+ typescript-node (~> 1.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (4.1.5)
12
+ i18n (~> 0.6, >= 0.6.9)
13
+ json (~> 1.7, >= 1.7.7)
14
+ minitest (~> 5.1)
15
+ thread_safe (~> 0.1)
16
+ tzinfo (~> 1.1)
17
+ celluloid (0.15.2)
18
+ timers (~> 1.1.0)
19
+ erubis (2.7.0)
20
+ ffi (1.9.3)
21
+ hooks (0.4.0)
22
+ uber (~> 0.0.4)
23
+ i18n (0.6.11)
24
+ json (1.8.1)
25
+ listen (2.7.9)
26
+ celluloid (>= 0.15.2)
27
+ rb-fsevent (>= 0.9.3)
28
+ rb-inotify (>= 0.9)
29
+ middleman-core (3.3.5)
30
+ activesupport (~> 4.1.0)
31
+ bundler (~> 1.1)
32
+ erubis
33
+ hooks (~> 0.3)
34
+ i18n (~> 0.6.9)
35
+ listen (>= 2.7.9, < 3.0)
36
+ padrino-helpers (~> 0.12.3)
37
+ rack (>= 1.4.5, < 2.0)
38
+ rack-test (~> 0.6.2)
39
+ thor (>= 0.15.2, < 2.0)
40
+ tilt (~> 1.4.1, < 2.0)
41
+ minitest (5.4.0)
42
+ padrino-helpers (0.12.3)
43
+ i18n (~> 0.6, >= 0.6.7)
44
+ padrino-support (= 0.12.3)
45
+ tilt (~> 1.4.1)
46
+ padrino-support (0.12.3)
47
+ activesupport (>= 3.1)
48
+ rack (1.5.2)
49
+ rack-test (0.6.2)
50
+ rack (>= 1.0)
51
+ rb-fsevent (0.9.4)
52
+ rb-inotify (0.9.5)
53
+ ffi (>= 0.5.0)
54
+ thor (0.19.1)
55
+ thread_safe (0.3.4)
56
+ tilt (1.4.1)
57
+ timers (1.1.0)
58
+ typescript-node (1.1.0)
59
+ typescript-src (~> 1.0.1)
60
+ typescript-src (1.0.1.2)
61
+ tzinfo (1.2.2)
62
+ thread_safe (~> 0.1)
63
+ uber (0.0.8)
64
+
65
+ PLATFORMS
66
+ ruby
67
+
68
+ DEPENDENCIES
69
+ middleman-typescript!
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 okayamarb
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Middleman::Typescript
2
+
3
+ middleman-typescript is an extension for the Middleman.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'middleman-typescript'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install middleman-typescript
18
+
19
+ ## Configuration
20
+
21
+ ignore "source/typescripts/*" # *.ts ignore LiveReload
22
+ activate :typescript, typescript_dir: 'ts' # default: 'typescripts'
23
+
24
+ Create typescripts directory under source directory.
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/middleman-typescript/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1 @@
1
+ require "middleman-typescript"
@@ -0,0 +1,41 @@
1
+ require 'typescript-node'
2
+
3
+ module Middleman
4
+ class TypescriptExtension < Extension
5
+ option :typescript_dir, 'typescripts', 'Set TypeScript dir.'
6
+ def initialize(app, options_hash={}, &block)
7
+ super
8
+ app.set :typescript_dir, options.typescript_dir
9
+
10
+ return unless app.environment == :development
11
+
12
+ app.ready do
13
+ files.changed do |file|
14
+ next if File.extname(file) != '.ts'
15
+
16
+ file_path = "#{Dir.pwd}/#{file}"
17
+ result = TypeScript::Node.compile_file(file_path, '--target', 'ES5')
18
+ if result.success?
19
+ file_name = File.basename(file_path).gsub(/\.ts/, '.js')
20
+ export_dir = source_dir + File.dirname(file_path).sub(source_dir, '').sub(app.typescript_dir, app.js_dir)
21
+ Dir.mkdir export_dir unless Dir.exist? export_dir
22
+ export_path = "#{export_dir}/#{file_name}"
23
+
24
+ File.open export_path, "w" do |f|
25
+ f.write result.js
26
+ end
27
+ end
28
+ end
29
+
30
+ files.deleted do |file|
31
+ next if File.extname(file) != '.ts'
32
+ file_path = "#{Dir.pwd}/#{file}"
33
+ file_name = File.basename(file_path).gsub(/\.ts/, '.js')
34
+ unlink_dir = source_dir + File.dirname(file_path).sub(source_dir, '').sub(app.typescript_dir, app.js_dir)
35
+ unlink_path = "#{unlink_dir}/#{file_name}"
36
+ File.unlink unlink_path
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,5 @@
1
+ module Middleman
2
+ module Typescript
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ require "middleman-core"
2
+
3
+ ::Middleman::Extensions.register(:typescript) do
4
+ require "middleman-typescript/extension"
5
+ ::Middleman::TypescriptExtension
6
+ end
@@ -0,0 +1,21 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'middleman-typescript/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "middleman-typescript"
8
+ spec.version = Middleman::Typescript::VERSION
9
+ spec.authors = ["Toyoaki Oko"]
10
+ spec.email = ["chariderpato@gmail.com"]
11
+ spec.summary = %q{TypeScript support for middleman}
12
+ spec.description = %q{TypeScript support for middleman}
13
+ spec.homepage = "https://github.com/okayamarb/middleman-typescript"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+ spec.add_dependency("middleman-core", ["~> 3.2"])
20
+ spec.add_dependency("typescript-node", ["~> 1.1"])
21
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: middleman-typescript
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Toyoaki Oko
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: middleman-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: typescript-node
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.1'
41
+ description: TypeScript support for middleman
42
+ email:
43
+ - chariderpato@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - Gemfile.lock
51
+ - LICENSE
52
+ - README.md
53
+ - Rakefile
54
+ - lib/middleman-extension.rb
55
+ - lib/middleman-typescript.rb
56
+ - lib/middleman-typescript/extension.rb
57
+ - lib/middleman-typescript/version.rb
58
+ - middleman-typescript.gemspec
59
+ homepage: https://github.com/okayamarb/middleman-typescript
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.2.2
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: TypeScript support for middleman
83
+ test_files: []
84
+ has_rdoc: