angular_velocity 0.0.2alpha → 0.0.3alpha

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Move Inc.
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # AngularVelocity
2
+
3
+
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'angular_velocity'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install angular_velocity
18
+
19
+
20
+ ## Usage
21
+ ```
22
+ rails g angular_velocity:install -f
23
+ rm public/index.html
24
+
25
+ ```
26
+
27
+ File are created under app/assets/javascripts/<application_name>/
28
+ And jasmine specs are created under spec/javascripts/<application_name>/
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task default: :spec
@@ -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 'angular_velocity/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "angular_velocity"
8
+ spec.version = AngularVelocity::VERSION
9
+ spec.authors = ["Alan Pies", "Shayne Defazio"]
10
+ spec.email = ["alan.lee.pies@gmail.com","shayne.defazio@move.com"]
11
+ spec.description = %q{Setup new rails projects for angular/jasmine, includes generators for angular MVC files.}
12
+ spec.summary = %q{angular/jasmine seed for rails}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = (`git ls-files`.split($/)).select { |file_name| !file_name.include?("tmp") }
17
+
18
+
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_dependency "bundler", "~> 1.3"
24
+ spec.add_dependency "rake"
25
+ spec.add_dependency "rspec"
26
+ spec.add_dependency "jasmine-rails"
27
+ end
@@ -0,0 +1,3 @@
1
+ module AngularVelocity
2
+ VERSION = "0.0.3alpha"
3
+ end
@@ -0,0 +1,17 @@
1
+ require "angular_velocity/version"
2
+ require "jasmine-rails"
3
+
4
+ module AngularVelocity
5
+
6
+ def self.setup
7
+ yield self
8
+ end
9
+
10
+ unless File.file?("#{Dir.pwd}/spec/javascripts/support/jasmine.yml")
11
+ FileUtils.mkdir_p "#{Dir.pwd}/spec/javascripts/support/"
12
+ File.open("#{Dir.pwd}/spec/javascripts/support/jasmine.yml", "w") do |file_line|
13
+ file_line.puts "Hello"
14
+ file_line.puts "world"
15
+ end
16
+ end
17
+ end
@@ -52,6 +52,10 @@ module AngularVelocity
52
52
  end
53
53
  end
54
54
 
55
+ def create_angular_velocity_initializer
56
+ copy_file "angular_velocity.rb", "config/initializers/angular_velocity.rb"
57
+ end
58
+
55
59
 
56
60
 
57
61
 
@@ -0,0 +1 @@
1
+ require 'jasmine-rails'
@@ -0,0 +1,21 @@
1
+ require 'generators/angular_velocity/angular_config'
2
+
3
+ #Rails.root.join('public','images','logo.png')
4
+
5
+ module AngularVelocity
6
+ module Generators
7
+
8
+ class ServiceGenerator < Rails::Generators::NamedBase
9
+ include AngularVelocity::Generators::AngularConfig
10
+ source_root File.expand_path('../templates', __FILE__)
11
+ desc "This generator creates an angular service"
12
+
13
+ def create_angular_service
14
+ template "service.coffee", "#{angular_path}/services/#{file_name}_service.coffee"
15
+ end
16
+
17
+ end
18
+
19
+ end
20
+ end
21
+
@@ -0,0 +1,8 @@
1
+ angular.module('<%= application_name %>Service', []).factory( '<%=file_name.camelize %>', [ '$scope','$http',
2
+ class <%=file_name.camelize %>
3
+ constructor: (data) ->
4
+ @instantiate(data)
5
+ instantiate: (data) ->
6
+ @attributes = data
7
+ angular.extend(@, data)
8
+ ])
@@ -54,6 +54,10 @@ describe AngularVelocity::Generators::InstallGenerator do
54
54
  expect('spec/tmp/config/routes.rb').to be_a_file_containing_text(%{get "/templates/:path.html" => "templates#file", :constraints => { :path => /.+/ }})
55
55
  end
56
56
 
57
+ it "should create an initializer for jasmine rails that requires it" do
58
+ expect("spec/tmp/config/initializers/angular_velocity.rb").to be_a_file_containing_text("require 'jasmine-rails'")
59
+ end
60
+
57
61
 
58
62
  end
59
63
 
@@ -0,0 +1,24 @@
1
+ require "spec_helper"
2
+
3
+ require "generators/angular_velocity/service/service_generator"
4
+
5
+ describe AngularVelocity::Generators::ServiceGenerator do
6
+
7
+ include GeneratorSpec::TestCase
8
+ include GenSpecHelpers
9
+ include AngularVelocity::Generators::AngularConfig
10
+
11
+ destination File.expand_path("../../tmp", __FILE__)
12
+
13
+ before(:each) {prepare_destination}
14
+
15
+ let(:angular_test_app_path) { "spec/tmp/#{angular_path}" }
16
+
17
+
18
+ it "should generator a controller" do
19
+ run_generator ["post"]
20
+ ("#{angular_test_app_path}/services/post_service.coffee").should be_a_file_containing_text(%{ class Post})
21
+ end
22
+
23
+
24
+ end
@@ -13,7 +13,7 @@ RSpec::Matchers.define :be_a_file_containing_text do |expected_file_text|
13
13
  end
14
14
 
15
15
  failure_message_for_should do |file_path|
16
- generate_failure_message
16
+ generate_failure_message(file_path)
17
17
  end
18
18
 
19
19
  description do
@@ -28,7 +28,7 @@ RSpec::Matchers.define :be_a_file_containing_text do |expected_file_text|
28
28
  file_path && File.file?(file_path)
29
29
  end
30
30
 
31
- def generate_failure_message
31
+ def generate_failure_message(file_path)
32
32
  if @file_not_found
33
33
  "the file at path #{file_path} does not exist"
34
34
  elsif @nil_file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: angular_velocity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2alpha
4
+ version: 0.0.3alpha
5
5
  prerelease: 5
6
6
  platform: ruby
7
7
  authors:
@@ -88,6 +88,12 @@ files:
88
88
  - .gitignore
89
89
  - .rspec
90
90
  - Gemfile
91
+ - LICENSE.txt
92
+ - README.md
93
+ - Rakefile
94
+ - angular_velocity.gemspec
95
+ - lib/angular_velocity.rb
96
+ - lib/angular_velocity/version.rb
91
97
  - lib/generators/angular_velocity/angular_config.rb
92
98
  - lib/generators/angular_velocity/controller/controller_generator.rb
93
99
  - lib/generators/angular_velocity/controller/templates/controller.coffee
@@ -99,6 +105,7 @@ files:
99
105
  - lib/generators/angular_velocity/install/templates/angular-sanitize.js
100
106
  - lib/generators/angular_velocity/install/templates/angular-scenario.js
101
107
  - lib/generators/angular_velocity/install/templates/angular.js
108
+ - lib/generators/angular_velocity/install/templates/angular_velocity.rb
102
109
  - lib/generators/angular_velocity/install/templates/app.coffee
103
110
  - lib/generators/angular_velocity/install/templates/index.html.erb
104
111
  - lib/generators/angular_velocity/install/templates/jasmine.yml
@@ -107,8 +114,11 @@ files:
107
114
  - lib/generators/angular_velocity/install/templates/main_controller.rb
108
115
  - lib/generators/angular_velocity/install/templates/main_controller_spec.coffee
109
116
  - lib/generators/angular_velocity/install/templates/templates_controller.rb
117
+ - lib/generators/angular_velocity/service/service_generator.rb
118
+ - lib/generators/angular_velocity/service/templates/service.coffee
110
119
  - spec/controller/controller_generator_spec.rb
111
120
  - spec/install/install_generator_spec.rb
121
+ - spec/service/service_generator_spec.rb
112
122
  - spec/spec_helper.rb
113
123
  - spec/support/generator_matcher.rb
114
124
  homepage: ''
@@ -139,5 +149,6 @@ summary: angular/jasmine seed for rails
139
149
  test_files:
140
150
  - spec/controller/controller_generator_spec.rb
141
151
  - spec/install/install_generator_spec.rb
152
+ - spec/service/service_generator_spec.rb
142
153
  - spec/spec_helper.rb
143
154
  - spec/support/generator_matcher.rb