imba-rails 0.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: e22b1e4d836f74890e437343f39351ba1dd44f32
4
+ data.tar.gz: d8bb09284e613b8d75314d3b56fe75e280a955b0
5
+ SHA512:
6
+ metadata.gz: 3b14f007f6c8964fddd7b9983daa1a25ade4bae6915acefb38c3f193aef8335a1727638f8f60f4c2be23f63ea51e53d17b2621a3f8b842aaa93cb65eb841e730
7
+ data.tar.gz: af02a95a33165208e740cf2d40e767d8990183c9c0cf95b4304c8c9bf946c706c838cd55b342cdefac6b201d63d92dc0787060ffb8ebdd6120576bffab3f8c3c
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ /example_app/tmp
12
+ /example_app/log
13
+ /example_app/Gemfile.lock
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2
4
+ - 2.1
5
+ - 2.0
6
+ - jruby
7
+ before_install:
8
+ - gem install bundler -v 1.10.5
9
+ - cd example_app
10
+ script: ./test.sh
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in imba-rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Magnus Holm
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,66 @@
1
+ # Imba::Rails
2
+
3
+ Rails integration for the [Imba](https://github.com/somebee/imba) language.
4
+
5
+ ## Usage
6
+
7
+ Write `.imba` files:
8
+
9
+ ```imba
10
+ # in app/assets/javascripts/todo.imba
11
+ tag #app
12
+ def awaken
13
+ render
14
+ self
15
+
16
+ def render
17
+ <self>
18
+ <h1> "Hello Imba!"
19
+
20
+ def app
21
+ #app
22
+ ```
23
+
24
+ Include them together with the Imba runtime in application.js:
25
+
26
+ ```javascript
27
+ //= require imba
28
+ //= require todo
29
+ ```
30
+
31
+ Make it all happen in the view:
32
+
33
+ ```erb
34
+ <%= javascript_include_tag 'application' %>
35
+ ...
36
+ <div id="app"></div>
37
+ <script>app()</script>
38
+ ```
39
+
40
+ ## Installation
41
+
42
+ Add this line to your application's Gemfile:
43
+
44
+ ```ruby
45
+ gem 'imba-rails'
46
+
47
+ # You should also depend on a specific version of Imba:
48
+ gem 'imab-source', '~> 0.12.1'
49
+ ```
50
+
51
+ And then execute:
52
+
53
+ $ bundle
54
+
55
+ Or install it yourself as:
56
+
57
+ $ gem install imba-rails
58
+
59
+ ## Contributing
60
+
61
+ Bug reports and pull requests are welcome on GitHub at https://github.com/judofyr/imba-rails.
62
+
63
+ ## License
64
+
65
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
66
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -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 'imba/rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "imba-rails"
8
+ spec.version = Imba::Rails::VERSION
9
+ spec.authors = ["Magnus Holm"]
10
+ spec.email = ["judofyr@gmail.com"]
11
+
12
+ spec.summary = %q{Rails integration for Imba}
13
+ spec.homepage = "https://github.com/judofyr/imba-rails"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|example_app)/}) }
17
+ spec.require_paths = ["lib"]
18
+
19
+ spec.add_dependency "railties", ">= 4.2.0"
20
+ spec.add_dependency "imba-template"
21
+ spec.add_dependency "imba-source"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.10"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ end
data/lib/imba/rails.rb ADDED
@@ -0,0 +1,38 @@
1
+ require "imba/rails/version"
2
+
3
+ require "rails/engine"
4
+
5
+ require "imba/source"
6
+ require "imba/template"
7
+
8
+ module Imba
9
+ module Rails
10
+ class Transformer
11
+ def initialize(options = {})
12
+ @options = options
13
+ end
14
+
15
+ def call(input)
16
+ Imba::Template.new(input[:name], @options) { input[:data] }.render
17
+ end
18
+ end
19
+
20
+ class ImbaOptions
21
+ attr_accessor :compiler_options
22
+ end
23
+
24
+ class Engine < ::Rails::Engine
25
+ # TODO: not make this global?
26
+ config.imba = ImbaOptions.new
27
+
28
+ initializer 'imba.asset_paths', :after => 'sprockets.environment', :group => :all do |app|
29
+ app.assets.append_path Imba::Source::BROWSER_PATH.to_s
30
+ end
31
+
32
+ initializer 'imba.compiler' do |app|
33
+ app.assets.register_mime_type 'text/imba', extensions: ['.imba'], charset: :unicode
34
+ app.assets.register_transformer 'text/imba', 'application/javascript', Transformer.new(app.config.imba.compiler_options)
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,5 @@
1
+ module Imba
2
+ module Rails
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: imba-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Magnus Holm
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-09-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 4.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 4.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: imba-template
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
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: imba-source
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.10'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.10'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ description:
84
+ email:
85
+ - judofyr@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".travis.yml"
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - bin/setup
97
+ - imba-rails.gemspec
98
+ - lib/imba/rails.rb
99
+ - lib/imba/rails/version.rb
100
+ homepage: https://github.com/judofyr/imba-rails
101
+ licenses:
102
+ - MIT
103
+ metadata: {}
104
+ post_install_message:
105
+ rdoc_options: []
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ requirements: []
119
+ rubyforge_project:
120
+ rubygems_version: 2.2.2
121
+ signing_key:
122
+ specification_version: 4
123
+ summary: Rails integration for Imba
124
+ test_files: []
125
+ has_rdoc: