angular_velocity 0.0.2alpha
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.
- data/.gitignore +25 -0
- data/.rspec +2 -0
- data/Gemfile +8 -0
- data/lib/generators/angular_velocity/angular_config.rb +23 -0
- data/lib/generators/angular_velocity/controller/controller_generator.rb +22 -0
- data/lib/generators/angular_velocity/controller/templates/controller.coffee +4 -0
- data/lib/generators/angular_velocity/install/install_generator.rb +60 -0
- data/lib/generators/angular_velocity/install/templates/AppLoader.js +3 -0
- data/lib/generators/angular_velocity/install/templates/angular-cookies.js +183 -0
- data/lib/generators/angular_velocity/install/templates/angular-mocks.js +1764 -0
- data/lib/generators/angular_velocity/install/templates/angular-resource.js +445 -0
- data/lib/generators/angular_velocity/install/templates/angular-sanitize.js +535 -0
- data/lib/generators/angular_velocity/install/templates/angular-scenario.js +26195 -0
- data/lib/generators/angular_velocity/install/templates/angular.js +14733 -0
- data/lib/generators/angular_velocity/install/templates/app.coffee +3 -0
- data/lib/generators/angular_velocity/install/templates/index.html.erb +9 -0
- data/lib/generators/angular_velocity/install/templates/jasmine.yml +24 -0
- data/lib/generators/angular_velocity/install/templates/main_control.html +9 -0
- data/lib/generators/angular_velocity/install/templates/main_controller.coffee +4 -0
- data/lib/generators/angular_velocity/install/templates/main_controller.rb +11 -0
- data/lib/generators/angular_velocity/install/templates/main_controller_spec.coffee +19 -0
- data/lib/generators/angular_velocity/install/templates/templates_controller.rb +11 -0
- data/spec/controller/controller_generator_spec.rb +25 -0
- data/spec/install/install_generator_spec.rb +82 -0
- data/spec/spec_helper.rb +50 -0
- data/spec/support/generator_matcher.rb +45 -0
- metadata +143 -0
@@ -0,0 +1,24 @@
|
|
1
|
+
src_files:
|
2
|
+
- "angular.js"
|
3
|
+
- "angular-mocks.js"
|
4
|
+
- "<%= application_name %>Loader.js"
|
5
|
+
|
6
|
+
stylesheets:
|
7
|
+
|
8
|
+
helpers:
|
9
|
+
- "helpers/**/*.{js,coffee}"
|
10
|
+
|
11
|
+
spec_files:
|
12
|
+
- "**/*[Ss]pec.{js,coffee}"
|
13
|
+
|
14
|
+
src_dir:
|
15
|
+
- "app/assets/javascripts/<%= application_name %>"
|
16
|
+
- "spec/javascripts/<%= application_name %>"
|
17
|
+
|
18
|
+
spec_dir: "spec/javascripts/<%= application_name %>"
|
19
|
+
|
20
|
+
asset_paths:
|
21
|
+
- "vendor/assets/javascripts"
|
22
|
+
|
23
|
+
|
24
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
describe "Controller: MainCtrl", () ->
|
2
|
+
|
3
|
+
MainCtrl = {}
|
4
|
+
scope = {}
|
5
|
+
|
6
|
+
beforeEach(module('<%= application_name %>'))
|
7
|
+
MainCtrl = {}
|
8
|
+
scope = {}
|
9
|
+
beforeEach(inject( ($rootScope, $controller) ->
|
10
|
+
|
11
|
+
scope = $rootScope.$new()
|
12
|
+
MainCtrl = $controller( 'MainCtrl', {
|
13
|
+
$scope: scope
|
14
|
+
})
|
15
|
+
|
16
|
+
))
|
17
|
+
|
18
|
+
it "should attach a list of awesomeThings to the scope", () ->
|
19
|
+
expect(scope.awesomeThings.length).toBe(3)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
require "generators/angular_velocity/controller/controller_generator"
|
4
|
+
|
5
|
+
describe AngularVelocity::Generators::ControllerGenerator 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
|
+
file_should_exist("#{angular_test_app_path}/controllers/post_controller.coffee")
|
21
|
+
("#{angular_test_app_path}/controllers/post_controller.coffee").should be_a_file_containing_text(%{angular.module('AngularVelocityApp').controller( 'PostCtrl', [ '$scope', PostController ])})
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "generators/angular_velocity/install/install_generator"
|
3
|
+
|
4
|
+
describe AngularVelocity::Generators::InstallGenerator do
|
5
|
+
|
6
|
+
include GeneratorSpec::TestCase
|
7
|
+
include GenSpecHelpers
|
8
|
+
include AngularVelocity::Generators::AngularConfig
|
9
|
+
|
10
|
+
destination File.expand_path("../../tmp", __FILE__)
|
11
|
+
|
12
|
+
|
13
|
+
before(:each) do
|
14
|
+
prepare_destination
|
15
|
+
create_fixtures
|
16
|
+
run_generator
|
17
|
+
@angular_test_app_path = "spec/tmp/#{angular_path}"
|
18
|
+
@test_app_path = "spec/tmp/app"
|
19
|
+
@angular_spec_path = "spec/tmp/#{angular_spec_path}"
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
context "angular components" do
|
24
|
+
|
25
|
+
it "should generate an angular application" do
|
26
|
+
expect("#{@angular_test_app_path}/app.coffee").to be_a_file_containing_text(%{angular.module('AngularVelocityApp', [])})
|
27
|
+
expect("#{@test_app_path}/assets/javascripts/application.js").to be_a_file_containing_text(%{//= require ./AngularVelocityApp/angular.js})
|
28
|
+
file_should_exist("#{@angular_test_app_path}/angular-mocks.js")
|
29
|
+
file_should_exist("#{@angular_test_app_path}/angular-cookies.js")
|
30
|
+
file_should_exist("#{@angular_test_app_path}/angular-resource.js")
|
31
|
+
file_should_exist("#{@angular_test_app_path}/angular-sanitize.js")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should package the angular app in an easy to consume sprockets file" do
|
35
|
+
expect("#{@angular_test_app_path}/AngularVelocityAppLoader.js").to be_a_file_containing_text("//= require ./app")
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should create a main_angular controller like yeoman and the seed does" do
|
39
|
+
expect("#{@angular_test_app_path}/controllers/main_controller.coffee").to be_a_file_containing_text(%{angular.module('AngularVelocityApp').controller( 'MainCtrl'})
|
40
|
+
expect("#{@angular_test_app_path}/views/main_control.html").to be_a_file_containing_text(%{ <li ng-repeat="thing in awesomeThings">{{thing}}</li>})
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "rails components" do
|
45
|
+
|
46
|
+
it "should create a main rails controller with an index view" do
|
47
|
+
expect('spec/tmp/app/controllers/main_controller.rb').to be_a_file_containing_text('MainController < ApplicationController')
|
48
|
+
expect('spec/tmp/app/views/main/index.html.erb').to be_a_file_containing_text(%{<div ng-app='AngularVelocityApp'>})
|
49
|
+
expect('spec/tmp/app/views/main/index.html.erb').to be_a_file_containing_text(%{<%= javascript_include_tag "AngularVelocityApp/AngularVelocityAppLoader" %>})
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should create a template serving rails controller to facilitate serving angular views" do
|
53
|
+
expect("#{@test_app_path}/controllers/templates_controller.rb").to be_a_file_containing_text('class TemplatesController < ApplicationController')
|
54
|
+
expect('spec/tmp/config/routes.rb').to be_a_file_containing_text(%{get "/templates/:path.html" => "templates#file", :constraints => { :path => /.+/ }})
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
context "the specs" do
|
61
|
+
|
62
|
+
it "the jasmine.yml file should be created" do
|
63
|
+
expect("spec/tmp/spec/javascripts/support/jasmine.yml").to be_a_file_containing_text('src_files:')
|
64
|
+
end
|
65
|
+
|
66
|
+
it "the routes config file should contain a route for the jasmine specs" do
|
67
|
+
expect('spec/tmp/config/routes.rb').to be_a_file_containing_text(%{mount JasmineRails::Engine => "/specs" unless Rails.env.production?})
|
68
|
+
end
|
69
|
+
|
70
|
+
it "the main controller spec should be created" do
|
71
|
+
expect("#{@angular_spec_path}/controllers/main_controller_spec.coffee").to be_a_file_containing_text(%{describe "Controller: MainCtrl", () ->})
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'rails/all'
|
2
|
+
require 'rspec-rails'
|
3
|
+
#require 'rails/generators/test_case'
|
4
|
+
require "generator_spec/test_case"
|
5
|
+
Dir["./spec/support/*.rb"].each {|f| require f}
|
6
|
+
|
7
|
+
module AngularVelocity
|
8
|
+
class Application < ::Rails::Application
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
module GenSpecHelpers
|
14
|
+
|
15
|
+
def create_fixtures
|
16
|
+
Dir.mkdir("spec/tmp/config") unless Dir.entries("spec/tmp/").include?("config")
|
17
|
+
FileUtils.mkdir_p('spec/tmp/app/assets/javascripts/') unless Dir.entries("spec/tmp/").include?("app")
|
18
|
+
File.open('spec/tmp/app/assets/javascripts/application.js', 'w') do |f|
|
19
|
+
f.puts "//= require jquery"
|
20
|
+
f.puts "//= require jquery_ujs"
|
21
|
+
f.puts "//= require_tree ."
|
22
|
+
end
|
23
|
+
File.open("spec/tmp/config/routes.rb", 'w') do |f|
|
24
|
+
f.puts "Gui::Application.routes.draw do"
|
25
|
+
f.puts "end"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def file_should_exist(file_string)
|
30
|
+
File.file?(file_string).should be_true
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
# RSpec.configure do |config|
|
39
|
+
# config.treat_symbols_as_metadata_keys_with_true_values = true
|
40
|
+
# config.filter_run :focus
|
41
|
+
# config.run_all_when_everything_filtered = true
|
42
|
+
# config.before(:each) do
|
43
|
+
# @real_world = RSpec.world
|
44
|
+
# RSpec.instance_variable_set(:@world, RSpec::Core::World.new)
|
45
|
+
# end
|
46
|
+
# config.after(:each) do
|
47
|
+
# RSpec.instance_variable_set(:@world, @real_world)
|
48
|
+
# end
|
49
|
+
# config.order = :random
|
50
|
+
# end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
|
2
|
+
RSpec::Matchers.define :be_a_file_containing_text do |expected_file_text|
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
match do |file_path|
|
8
|
+
if is_a_file(file_path)
|
9
|
+
File.readlines(file_path).any? {|line| line.include?(expected_file_text)}
|
10
|
+
else
|
11
|
+
false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
failure_message_for_should do |file_path|
|
16
|
+
generate_failure_message
|
17
|
+
end
|
18
|
+
|
19
|
+
description do
|
20
|
+
"expected that the file #{file_path}
|
21
|
+
would contain text #{expected_file_text}"
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
def is_a_file(file_path)
|
26
|
+
@nil_file = true unless file_path
|
27
|
+
@file_not_found = true unless File.file?(file_path)
|
28
|
+
file_path && File.file?(file_path)
|
29
|
+
end
|
30
|
+
|
31
|
+
def generate_failure_message
|
32
|
+
if @file_not_found
|
33
|
+
"the file at path #{file_path} does not exist"
|
34
|
+
elsif @nil_file
|
35
|
+
"something strange going on here, you didnt pass a file_path"
|
36
|
+
else
|
37
|
+
"expected that the file #{file_path}
|
38
|
+
would contain text #{expected_file_text}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
end
|
45
|
+
|
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: angular_velocity
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2alpha
|
5
|
+
prerelease: 5
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Alan Pies
|
9
|
+
- Shayne Defazio
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2013-04-09 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: bundler
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '1.3'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '1.3'
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: rake
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
type: :runtime
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: jasmine-rails
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
type: :runtime
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
description: Setup new rails projects for angular/jasmine, includes generators for
|
80
|
+
angular MVC files.
|
81
|
+
email:
|
82
|
+
- alan.lee.pies@gmail.com
|
83
|
+
- shayne.defazio@move.com
|
84
|
+
executables: []
|
85
|
+
extensions: []
|
86
|
+
extra_rdoc_files: []
|
87
|
+
files:
|
88
|
+
- .gitignore
|
89
|
+
- .rspec
|
90
|
+
- Gemfile
|
91
|
+
- lib/generators/angular_velocity/angular_config.rb
|
92
|
+
- lib/generators/angular_velocity/controller/controller_generator.rb
|
93
|
+
- lib/generators/angular_velocity/controller/templates/controller.coffee
|
94
|
+
- lib/generators/angular_velocity/install/install_generator.rb
|
95
|
+
- lib/generators/angular_velocity/install/templates/AppLoader.js
|
96
|
+
- lib/generators/angular_velocity/install/templates/angular-cookies.js
|
97
|
+
- lib/generators/angular_velocity/install/templates/angular-mocks.js
|
98
|
+
- lib/generators/angular_velocity/install/templates/angular-resource.js
|
99
|
+
- lib/generators/angular_velocity/install/templates/angular-sanitize.js
|
100
|
+
- lib/generators/angular_velocity/install/templates/angular-scenario.js
|
101
|
+
- lib/generators/angular_velocity/install/templates/angular.js
|
102
|
+
- lib/generators/angular_velocity/install/templates/app.coffee
|
103
|
+
- lib/generators/angular_velocity/install/templates/index.html.erb
|
104
|
+
- lib/generators/angular_velocity/install/templates/jasmine.yml
|
105
|
+
- lib/generators/angular_velocity/install/templates/main_control.html
|
106
|
+
- lib/generators/angular_velocity/install/templates/main_controller.coffee
|
107
|
+
- lib/generators/angular_velocity/install/templates/main_controller.rb
|
108
|
+
- lib/generators/angular_velocity/install/templates/main_controller_spec.coffee
|
109
|
+
- lib/generators/angular_velocity/install/templates/templates_controller.rb
|
110
|
+
- spec/controller/controller_generator_spec.rb
|
111
|
+
- spec/install/install_generator_spec.rb
|
112
|
+
- spec/spec_helper.rb
|
113
|
+
- spec/support/generator_matcher.rb
|
114
|
+
homepage: ''
|
115
|
+
licenses:
|
116
|
+
- MIT
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ! '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
none: false
|
129
|
+
requirements:
|
130
|
+
- - ! '>'
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 1.3.1
|
133
|
+
requirements: []
|
134
|
+
rubyforge_project:
|
135
|
+
rubygems_version: 1.8.25
|
136
|
+
signing_key:
|
137
|
+
specification_version: 3
|
138
|
+
summary: angular/jasmine seed for rails
|
139
|
+
test_files:
|
140
|
+
- spec/controller/controller_generator_spec.rb
|
141
|
+
- spec/install/install_generator_spec.rb
|
142
|
+
- spec/spec_helper.rb
|
143
|
+
- spec/support/generator_matcher.rb
|