angular_sprinkles 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90b1e9da3ce41cee16fb912761b9c76eb4ad755a
4
- data.tar.gz: 2978d0f8f2adfe6f305d33a5fd2521e5c6181428
3
+ metadata.gz: afa607a421d5bb4d861d12083db5bf733c29bb99
4
+ data.tar.gz: 5df2cfd0b70b089d2f23daa99c66fb6bc24a5ad6
5
5
  SHA512:
6
- metadata.gz: 0e4b2584d80f0358a33514b4d23068dc4888294938a52bde5758e944a13a87d3dd26918d833248bce5b9c7192cdcd3c5ffd108c69f6457768c357b77406b467d
7
- data.tar.gz: 48c97a304a860422aeb1821ab65328e61a19e34bd135dd2a916a1368f64b4ba6dab0ce424700d6bef68173b9c1525e5bcb3d86ad641665e9018be71f9fffef8c
6
+ metadata.gz: 7fb8698b2055fcbf280235fc0c9990f715b0ea6310ac282913509ff7d25b99817e1c8b1d722317d8834690685054746c19fb5bb0494cb01d29a09b911dd7b3db
7
+ data.tar.gz: 0b050e57812e98588b4d67ca3d4d2c98b99f96dbdda0d063b461210d3c71d4dee09838200fb154f07f8f7fd6e41acfe7e4b3963498e07f295705d3d4583746c1
data/Gemfile CHANGED
@@ -9,6 +9,6 @@ group :development do
9
9
  gem "capybara"
10
10
  gem "selenium-webdriver"
11
11
  gem "launchy"
12
- gem "simplecov"
13
12
  gem "jeweler"
13
+ gem "coveralls", require: false
14
14
  end
data/Gemfile.lock CHANGED
@@ -39,6 +39,12 @@ GEM
39
39
  xpath (~> 2.0)
40
40
  childprocess (0.5.3)
41
41
  ffi (~> 1.0, >= 1.0.11)
42
+ coveralls (0.7.1)
43
+ multi_json (~> 1.3)
44
+ rest-client
45
+ simplecov (>= 0.7)
46
+ term-ansicolor
47
+ thor
42
48
  descendants_tracker (0.0.4)
43
49
  thread_safe (~> 0.3, >= 0.3.1)
44
50
  diff-lcs (1.2.5)
@@ -82,6 +88,7 @@ GEM
82
88
  multi_json (1.10.1)
83
89
  multi_xml (0.5.5)
84
90
  multipart-post (2.0.0)
91
+ netrc (0.7.7)
85
92
  nokogiri (1.6.3.1)
86
93
  mini_portile (= 0.6.0)
87
94
  oauth2 (1.0.0)
@@ -112,6 +119,9 @@ GEM
112
119
  rake (10.3.2)
113
120
  rdoc (4.1.1)
114
121
  json (~> 1.4)
122
+ rest-client (1.7.2)
123
+ mime-types (>= 1.16, < 3.0)
124
+ netrc (~> 0.7)
115
125
  rspec-core (3.0.4)
116
126
  rspec-support (~> 3.0.0)
117
127
  rspec-expectations (3.0.4)
@@ -149,9 +159,12 @@ GEM
149
159
  activesupport (>= 3.0)
150
160
  sprockets (~> 2.8)
151
161
  sqlite3 (1.3.9)
162
+ term-ansicolor (1.3.0)
163
+ tins (~> 1.0)
152
164
  thor (0.19.1)
153
165
  thread_safe (0.3.4)
154
166
  tilt (1.4.1)
167
+ tins (1.3.2)
155
168
  treetop (1.4.15)
156
169
  polyglot
157
170
  polyglot (>= 0.3.1)
@@ -167,10 +180,10 @@ PLATFORMS
167
180
  DEPENDENCIES
168
181
  angularjs-rails
169
182
  capybara
183
+ coveralls
170
184
  jeweler
171
185
  launchy
172
186
  rails
173
187
  rspec-rails
174
188
  selenium-webdriver
175
- simplecov
176
189
  sqlite3
data/README.md CHANGED
@@ -1,145 +1,85 @@
1
1
  # Angular Sprinkles
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/angular_sprinkles.svg)](http://badge.fury.io/rb/angular_sprinkles)
4
- ![Circle CI](https://circleci.com/gh/BrewhouseTeam/angular_sprinkles.png?style=badge)
4
+ [![Circle CI](https://circleci.com/gh/BrewhouseTeam/angular_sprinkles.png?style=badge)](https://circleci.com/gh/BrewhouseTeam/angular_sprinkles)
5
+ [![Coverage Status](https://coveralls.io/repos/BrewhouseTeam/angular_sprinkles/badge.png?branch=master)](https://coveralls.io/r/BrewhouseTeam/angular_sprinkles?branch=master)
5
6
 
6
- __WARNING: This gem is unstable and rapidly changing at the moment. README.md may not reflect the actual API.__
7
+ Angular Sprinkles is a gem for writing Rails-flavored AngularJS.
7
8
 
8
- Sprinkles is a Ruby on Rails gem for developers who want to use Angular's two most powerful features - two-way data binding and
9
- custom directives - without all of the regular setup required for a typical Angular-based application.
9
+ - __No frontend setup required:__ By just requiring it in your project, Sprinkles dynamically generates an Angular application around your Rails templates. It's never been easier to start developing with Angular and Rails.
10
+ - __Rails as it was intended to be written:__ Angular's two-way data binding, directives, and function calls are all done in the view via helper methods, giving you just a sprinkle of JavaScript.
11
+ - __Forget about the SPA:__ If you're not using Rails an API, trying to build an SPA on top of it is a huge pain. Sprinkles allows you to continue to write Rails applications as you always have without all of the nasty jQuery spaghetti.
10
12
 
11
- Sprinkles injects just enough JavaScript onto your page to make you dangerous. It is intended to be used by developers who just
12
- want a sprinkle of Angular instead of a full-blown application.
13
+ ## Examples
13
14
 
14
- ## Setup
15
-
16
- Add Angular and Sprinkles to your `Gemfile`
17
-
18
- ```ruby
19
- # Gemfile
20
-
21
- gem 'angularjs-rails'
22
- gem 'angular_sprinkles'
23
- ```
24
-
25
- Add a yield method for your sprinkles at the bottom of your body tag
26
-
27
- ```erb
28
- <%=# app/views/layouts/application.html.erb %>
29
- <body>
30
-
31
- <%= yield %>
32
-
33
- <%= yield :sprinkles %>
34
- </body>
35
- ```
36
-
37
- Include Angular and Sprinkles into your `application.js`
38
-
39
- ```js
40
- // app/assets/javascripts/application.js
41
-
42
- //= require angular
43
- //= require angular_sprinkles
44
- //= require_tree .
45
- ```
46
-
47
- That's it! You are now read to begin using Sprinkles in your application. There is no need to create an application module or
48
- controller. Sprinkles dynamically generates this for you.
49
-
50
- ## Data binding
51
-
52
- Two-way data binding with Sprinkles is easy. We can use the `bindable` view helper to decorate our record with the bind method
15
+ Two-way binding works right out of the box with Sprinkles. Just wrap your objects with the `bindable` helper.
53
16
 
54
17
  ```ruby
55
18
  class UserController < ApplicationController
56
19
  def show
20
+ # bindable gives your objects the bind method
57
21
  @user = bindable(User.find(params[:id]))
58
22
  end
59
23
  end
60
24
  ```
61
25
 
62
- Our user is now also able to use `bind`
63
-
64
26
  ```erb
65
- <%=# some view %>
66
-
67
- Bind the entire object: <span ng-bind="<%= @user.bind %>"></span>
68
-
69
- Full Name: <span ng-bind="<%= @user.bind(:first_name) %> + ' ' + <%= @user.bind(:last_name) %>"></span>
70
- First Name: <input type="text" ng-model="<%= @user.bind(:first_name) %>" />
71
- Last Name: <input type="text" ng-model="<%= @user.bind(:last_name) %>" />
27
+ {{ <%= @user.bind(:name) %> }}
28
+ <input type="text" ng-model="<%= @user.bind(:name) %>" />
72
29
  ```
73
30
 
74
- We've got two-way data binding of persisted data without writing a single line of javascript!
75
-
76
- ## Custom Directives
77
-
78
- Sprinkles also comes packaged with a helper for instantiating custom directives.
79
-
80
- In order to write custom directives, you must add them to the sprinkles module which is attached to the global `sprinkles` variable.
81
- Let's create an element that blinks some text.
31
+ Use custom directives with the `directive` helper.
82
32
 
83
- ```js
84
- // some js file
85
-
86
- sprinkles.directive('blink', function ($interval) {
87
- return {
88
- restrict: 'A',
89
- scope: {
90
- interval: '=',
91
- text: '='
92
- },
93
- template: '<span>{{text}}</span>',
94
- link: function (scope, el) {
95
- var opacity = 1;
96
-
97
- scope.text = scope.text || 'Hello World!';
98
- scope.interval = scope.interval || 1000;
99
-
100
- $interval(function () {
101
- el.css({ opacity: opacity });
102
- opacity = -opacity + 1;
103
- }, scope.interval);
104
- }
105
- }
33
+ ```erb
34
+ <script>
35
+ sprinkles.directive('blink', function () {
36
+ // re-implement the blink tag
106
37
  });
38
+ </script>
39
+
40
+ <%= directive(:blink) do %>
41
+ Hello, world
42
+ <% end %>
107
43
  ```
108
44
 
45
+ Call services directly from the view with the `service` helper.
46
+
109
47
  ```erb
110
- <%=# some view %>
48
+ <script>
49
+ sprinkles.service('alertMe', function () {
50
+ return function (input) {
51
+ alert('Hello, ' + input);
52
+ };
53
+ });
54
+ </script>
111
55
 
112
- <%= directive(:blink, { interval: 250, text: 'Blink Me!' }) %>
56
+ <button ng-click="<%= service(:alert_me, "world") %>">Click me!</button>
113
57
  ```
114
58
 
115
- "Blink Me!" will now flash on the screen. We can also combine this directive with the `bind` helper so that we can change the text on the fly
59
+ ## Setup
116
60
 
117
- ```erb
118
- <%=# some view %>
61
+ Add `angular_sprinkles` to your `Gemfile`.
119
62
 
120
- <%= directive(:blink, { interval: 250, text: bind(:blink_text) }) %>
121
- <input type="text" ng-model="<%= bind(:blink_text) %>" />
63
+ ```ruby
64
+ gem 'angular_sprinkles'
122
65
  ```
123
66
 
124
- ## Calling custom functions in the view
67
+ Add `yield :sprinkles` to the bottom of your body tag.
125
68
 
126
- Angular frequently makes use of calling functions in the view for directives such as `ng-click`. You can bind custom functions to the view by first writing a service and then calling `service`
69
+ ```erb
70
+ <body>
127
71
 
128
- ```js
129
- // some js file
72
+ <%= yield %>
130
73
 
131
- sprinkles.service('alert_it', function (someInjectedDependency) {
132
- return function (input) {
133
- var modifiedInput = someInjectedDependency(input);
134
- alert(modifiedInput);
135
- };
136
- });
74
+ <%= yield :sprinkles %>
75
+ </body>
137
76
  ```
138
77
 
139
- ```erb
140
- <%=# some view %>
78
+ Include and `angular_sprinkles` into your `application.js`.
141
79
 
142
- <button ng-click="<%= service(:alert_it, @user.bind(:first_name)) %>">Click Me!</button>;
80
+ ```js
81
+ //= require angular_sprinkles
82
+ //= require_tree .
143
83
  ```
144
84
 
145
85
  ## Copyright
data/Rakefile CHANGED
@@ -13,13 +13,6 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
13
13
  spec.pattern = FileList["spec/**/*_spec.rb"]
14
14
  end
15
15
 
16
- require "simplecov"
17
- desc "Code coverage"
18
- task :simplecov do
19
- ENV["COVERAGE"] = "true"
20
- Rake::Task["spec"].execute
21
- end
22
-
23
16
  require "jeweler"
24
17
  Jeweler::Tasks.new do |gem|
25
18
  gem.name = "angular_sprinkles"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.7
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: angular_sprinkles 0.0.6 ruby lib
5
+ # stub: angular_sprinkles 0.0.7 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "angular_sprinkles"
9
- s.version = "0.0.6"
9
+ s.version = "0.0.7"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
@@ -129,8 +129,8 @@ Gem::Specification.new do |s|
129
129
  s.add_development_dependency(%q<capybara>, [">= 0"])
130
130
  s.add_development_dependency(%q<selenium-webdriver>, [">= 0"])
131
131
  s.add_development_dependency(%q<launchy>, [">= 0"])
132
- s.add_development_dependency(%q<simplecov>, [">= 0"])
133
132
  s.add_development_dependency(%q<jeweler>, [">= 0"])
133
+ s.add_development_dependency(%q<coveralls>, [">= 0"])
134
134
  else
135
135
  s.add_dependency(%q<rails>, [">= 0"])
136
136
  s.add_dependency(%q<angularjs-rails>, [">= 0"])
@@ -139,8 +139,8 @@ Gem::Specification.new do |s|
139
139
  s.add_dependency(%q<capybara>, [">= 0"])
140
140
  s.add_dependency(%q<selenium-webdriver>, [">= 0"])
141
141
  s.add_dependency(%q<launchy>, [">= 0"])
142
- s.add_dependency(%q<simplecov>, [">= 0"])
143
142
  s.add_dependency(%q<jeweler>, [">= 0"])
143
+ s.add_dependency(%q<coveralls>, [">= 0"])
144
144
  end
145
145
  else
146
146
  s.add_dependency(%q<rails>, [">= 0"])
@@ -150,8 +150,8 @@ Gem::Specification.new do |s|
150
150
  s.add_dependency(%q<capybara>, [">= 0"])
151
151
  s.add_dependency(%q<selenium-webdriver>, [">= 0"])
152
152
  s.add_dependency(%q<launchy>, [">= 0"])
153
- s.add_dependency(%q<simplecov>, [">= 0"])
154
153
  s.add_dependency(%q<jeweler>, [">= 0"])
154
+ s.add_dependency(%q<coveralls>, [">= 0"])
155
155
  end
156
156
  end
157
157
 
@@ -1,7 +1,7 @@
1
1
  module AngularSprinkles
2
2
  module Directive
3
3
  class Html
4
- def initialize(args)
4
+ def initialize(args = {})
5
5
  @args = args.symbolize_keys
6
6
  end
7
7
 
@@ -1,7 +1,7 @@
1
1
  module AngularSprinkles
2
2
  module Directive
3
3
  class Input
4
- def initialize(args)
4
+ def initialize(args = {})
5
5
  @args = args.symbolize_keys
6
6
  end
7
7
 
@@ -10,7 +10,6 @@
10
10
  // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
- //= require angular
14
13
  //= require angular_sprinkles
15
14
  //= require_tree .
16
15
 
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,6 @@
1
- if ENV["COVERAGE"] == "true"
2
- require "simplecov"
3
- SimpleCov.start do
1
+ if ENV["COVERALLS_REPO_TOKEN"]
2
+ require "coveralls"
3
+ Coveralls.wear! do
4
4
  add_filter 'dummy'
5
5
  add_filter 'rails_helper.rb'
6
6
  add_filter 'spec_helper.rb'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: angular_sprinkles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabe Scholz
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: simplecov
112
+ name: jeweler
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -123,7 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: jeweler
126
+ name: coveralls
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="