backbone_generator 0.0.4 → 0.0.5
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 +4 -4
- data/README.md +33 -5
- data/lib/backbone_generator/generators/collections/collections_generator.rb +2 -2
- data/lib/backbone_generator/generators/models/models_generator.rb +2 -2
- data/lib/backbone_generator/generators/models/template/Model.tt +1 -1
- data/lib/backbone_generator/generators/new/new_generator.rb +8 -4
- data/lib/backbone_generator/generators/new/template/main.tt +4 -3
- data/lib/backbone_generator/generators/route/route_generator.rb +2 -2
- data/lib/backbone_generator/generators/route/template/Routes.tt +4 -0
- data/lib/backbone_generator/generators/templates/templates_generator.rb +2 -2
- data/lib/backbone_generator/generators/utilities/utilities_generator.rb +1 -1
- data/lib/backbone_generator/generators/views/template/View.tt +1 -1
- data/lib/backbone_generator/generators/views/views_generator.rb +2 -2
- data/lib/backbone_generator/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7111d753bae9e1ddece53a1d6e1a0370b9aa0ac7
|
4
|
+
data.tar.gz: d4a4fda7177798f41add98efab677ee560a81d33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f3062afec1b8b761343aebbaed67e6a8bc9a6bcc15582b3dd216a3804881af7667f94778972eeaecef0e982296a9721b06a7ef7d328c467b8175d4630f56823
|
7
|
+
data.tar.gz: 9442410ffa002b7f3cb343aef147bf35d45a06f751ae940e912eb5bc54dc92b2879c6799bd49ed1a85660ae4a56e8f995ae13aabe931c9d074b58743edadf184
|
data/README.md
CHANGED
@@ -18,13 +18,39 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
+
### new
|
22
|
+
To scaffold out new backbonejs app run this command
|
21
23
|
`backbone_generator new app_name`
|
22
|
-
|
24
|
+
|
25
|
+
### model
|
26
|
+
To create a model run the command
|
27
|
+
`backbone_generator model model_name`
|
28
|
+
|
29
|
+
### view
|
30
|
+
To create a new view run this command
|
23
31
|
`backbone_generator view view_name`
|
24
|
-
|
32
|
+
|
33
|
+
### route
|
34
|
+
To create a new route run this command
|
35
|
+
`backbone_generator route route_name`
|
36
|
+
|
37
|
+
### collection
|
38
|
+
To create a new collection run this command
|
25
39
|
`backbone_generator collection collection_name`
|
40
|
+
|
41
|
+
### utility
|
42
|
+
To add a utility to your project run this command
|
26
43
|
`backbone_generator utility utility_name`
|
27
|
-
|
44
|
+
|
45
|
+
### server
|
46
|
+
To start a server run this command
|
47
|
+
`backbone_generator server {optional port number}`
|
48
|
+
The default port that server starts on is 5000, conditionally you can specify a different port number
|
49
|
+
|
50
|
+
|
51
|
+
### library
|
52
|
+
To create add a new javascript library to your project run this command
|
53
|
+
`backbone_generator library library_name`
|
28
54
|
|
29
55
|
## Contributing
|
30
56
|
|
@@ -34,5 +60,7 @@ Or install it yourself as:
|
|
34
60
|
4. Push to the branch (`git push origin my-new-feature`)
|
35
61
|
5. Create new Pull Request
|
36
62
|
|
37
|
-
## Credit
|
38
|
-
Mhd Tahawi for
|
63
|
+
## Credit and Thank you!
|
64
|
+
Mhd Tahawi for his help in thinking through some of the features
|
65
|
+
Addy Osamani for his open source book on backbonejs
|
66
|
+
Derick Bailey for his awesomse post on naming conventions
|
@@ -15,12 +15,12 @@ module BackboneGenerator
|
|
15
15
|
else
|
16
16
|
dir_path = File.join(Dir.getwd)
|
17
17
|
end
|
18
|
-
template_path = File.expand_path(File.dirname(__FILE__)) + "/template/Collection.tt"
|
19
|
-
target_path = "/js/collections/" + collection_name.capitalize + ".Collection.js"
|
20
18
|
collection_hash = {
|
21
19
|
:app_name => app_name.slice(0,1).capitalize + app_name.slice(1..-1),
|
22
20
|
:collection_name => collection_name.slice(0,1).capitalize + collection_name.slice(1..-1),
|
23
21
|
}
|
22
|
+
template_path = File.expand_path(File.dirname(__FILE__)) + "/template/Collection.tt"
|
23
|
+
target_path = "/js/collections/" + collection_hash[:collection_name] + ".Collection.js"
|
24
24
|
if File.exist? dir_path + target_path
|
25
25
|
print "error ".red
|
26
26
|
puts "Collection with the name specified already exists"
|
@@ -15,12 +15,12 @@ module BackboneGenerator
|
|
15
15
|
else
|
16
16
|
dir_path = File.join(Dir.getwd)
|
17
17
|
end
|
18
|
-
template_path = File.expand_path(File.dirname(__FILE__)) + "/template/Model.tt"
|
19
|
-
target_path = "/js/models/" + model_name.capitalize + ".Model.js"
|
20
18
|
model_hash = {
|
21
19
|
:app_name => app_name.slice(0,1).capitalize + app_name.slice(1..-1),
|
22
20
|
:model_name => model_name.slice(0,1).capitalize + model_name.slice(1..-1),
|
23
21
|
}
|
22
|
+
template_path = File.expand_path(File.dirname(__FILE__)) + "/template/Model.tt"
|
23
|
+
target_path = "/js/models/" + model_hash[:model_name] + ".Model.js"
|
24
24
|
if File.exist? dir_path + target_path
|
25
25
|
print "error ".red
|
26
26
|
puts "Model with the name specified already exists"
|
@@ -25,7 +25,7 @@ var <%= config[:app_name] %> = <%= config[:app_name] %> || {};
|
|
25
25
|
|
26
26
|
//TODO: Add any initialization code here
|
27
27
|
initialize: function() {
|
28
|
-
console.log("Initializing
|
28
|
+
console.log("Initializing <%= config[:model_name] %> model");
|
29
29
|
},
|
30
30
|
|
31
31
|
//TODO: Getters and Setters for the model object
|
@@ -35,8 +35,10 @@ module BackboneGenerator
|
|
35
35
|
dot_files = ["/.gitignore", "/.BACKBONE_GENERATOR_APP", "/index.html"]
|
36
36
|
dot_files.each do |file|
|
37
37
|
FileUtils.cp(@template_path + file, @target_path)
|
38
|
-
|
39
|
-
|
38
|
+
if !file.include? "BACKBONE_GENERATOR_APP"
|
39
|
+
print "created ".green
|
40
|
+
puts BackboneGenerator.option_details[:app_name] + file
|
41
|
+
end
|
40
42
|
end
|
41
43
|
|
42
44
|
js_files = ['/js/collections', '/js/models', '/js/views', '/js/templates', '/js/utilities', '/js/libs', '/js/routes']
|
@@ -73,8 +75,10 @@ module BackboneGenerator
|
|
73
75
|
BackboneGenerator::ViewGenerator.create_view("hello")
|
74
76
|
BackboneGenerator::ModelGenerator.create_model("hello")
|
75
77
|
BackboneGenerator::CollectionGenerator.create_collection("hello")
|
76
|
-
BackboneGenerator::RouteGenerator.create_route(
|
77
|
-
BackboneGenerator::UtilityGenerator.create_utility(
|
78
|
+
BackboneGenerator::RouteGenerator.create_route("Main")
|
79
|
+
BackboneGenerator::UtilityGenerator.create_utility("Main")
|
80
|
+
|
81
|
+
|
78
82
|
# This is some hacky stuff! Will remove in future release, Beacuse
|
79
83
|
# the initial template contains a special message from me, there got
|
80
84
|
# to be a way to replace the message so that it only appears the first time
|
@@ -31,12 +31,13 @@
|
|
31
31
|
require([
|
32
32
|
'backbone',
|
33
33
|
'views/Main.View',
|
34
|
-
'routes
|
35
|
-
|
34
|
+
'routes/Main.Route',
|
35
|
+
'utilities/Main.Utility',
|
36
|
+
], function (Backbone, <%= config[:app_name] %>MainView, <%= config[:app_name] %>MainRoute) {
|
36
37
|
/*jshint nonew:false*/
|
37
38
|
|
38
39
|
// Initialize routing and start Backbone.history()
|
39
|
-
new <%= config[:app_name] %>
|
40
|
+
new <%= config[:app_name] %>MainRoute();
|
40
41
|
Backbone.history.start();
|
41
42
|
|
42
43
|
// Initialize the main application view
|
@@ -15,12 +15,12 @@ module BackboneGenerator
|
|
15
15
|
else
|
16
16
|
dir_path = File.join(Dir.getwd)
|
17
17
|
end
|
18
|
-
template_path = File.expand_path(File.dirname(__FILE__)) + "/template/Routes.tt"
|
19
|
-
target_path = "/js/routes/" + route_name + ".Route.js"
|
20
18
|
route_hash = {
|
21
19
|
:app_name => app_name.slice(0,1).capitalize + app_name.slice(1..-1),
|
22
20
|
:route_name => route_name.slice(0,1).capitalize + route_name.slice(1..-1),
|
23
21
|
}
|
22
|
+
template_path = File.expand_path(File.dirname(__FILE__)) + "/template/Routes.tt"
|
23
|
+
target_path = "/js/routes/" + route_hash[:route_name] + ".Route.js"
|
24
24
|
|
25
25
|
if File.exists? dir_path + target_path
|
26
26
|
print "error ".red
|
@@ -20,6 +20,10 @@ var <%= config[:app_name] %> = <%= config[:app_name] %> || {};
|
|
20
20
|
<%= config[:app_name] %>.<%= config[:route_name]%>Route = Backbone.Router.extend({
|
21
21
|
|
22
22
|
//TODO: Define all your routes here
|
23
|
+
routes: {
|
24
|
+
},
|
25
|
+
|
26
|
+
//TODO: Function definition for routes here
|
23
27
|
});
|
24
28
|
|
25
29
|
return <%= config[:app_name] %>.<%= config[:route_name] %>Route;
|
@@ -15,12 +15,12 @@ module BackboneGenerator
|
|
15
15
|
else
|
16
16
|
dir_path = File.join(Dir.getwd)
|
17
17
|
end
|
18
|
-
template_path = File.expand_path(File.dirname(__FILE__)) + "/template/Template.tt"
|
19
|
-
target_path = "/js/templates/" + template_name.capitalize + ".Template.html"
|
20
18
|
template_hash = {
|
21
19
|
:app_name => app_name.slice(0,1).capitalize + app_name.slice(1..-1),
|
22
20
|
:template_name => template_name.slice(0,1).capitalize + template_name.slice(1..-1),
|
23
21
|
}
|
22
|
+
template_path = File.expand_path(File.dirname(__FILE__)) + "/template/Template.tt"
|
23
|
+
target_path = "/js/templates/" + template_hash[:template_name] + ".Template.html"
|
24
24
|
if File.exist? dir_path + target_path
|
25
25
|
print "error ".red
|
26
26
|
puts "View with the name specified already exists"
|
@@ -20,7 +20,7 @@ module BackboneGenerator
|
|
20
20
|
:utility_name => utility_name.slice(0,1).capitalize + utility_name.slice(1..-1),
|
21
21
|
}
|
22
22
|
template_path = File.expand_path(File.dirname(__FILE__)) + "/template/Utility.tt"
|
23
|
-
target_path = "/js/utilities/" +
|
23
|
+
target_path = "/js/utilities/" + utility_hash[:utility_name] + ".Utility.js"
|
24
24
|
if File.exist? dir_path + target_path
|
25
25
|
print "error ".red
|
26
26
|
puts "Utility with the name specified already exists"
|
@@ -15,12 +15,12 @@ module BackboneGenerator
|
|
15
15
|
else
|
16
16
|
dir_path = File.join(Dir.getwd)
|
17
17
|
end
|
18
|
-
template_path = File.expand_path(File.dirname(__FILE__)) + "/template/View.tt"
|
19
|
-
target_path = "/js/views/" + view_name.capitalize + ".View.js"
|
20
18
|
view_hash = {
|
21
19
|
:app_name => app_name.slice(0,1).capitalize + app_name.slice(1..-1),
|
22
20
|
:view_name => view_name.slice(0,1).capitalize + view_name.slice(1..-1),
|
23
21
|
}
|
22
|
+
template_path = File.expand_path(File.dirname(__FILE__)) + "/template/View.tt"
|
23
|
+
target_path = "/js/views/" + view_hash[:view_name] + ".View.js"
|
24
24
|
if File.exist? dir_path + target_path
|
25
25
|
print "error ".red
|
26
26
|
puts "View with the name specified already exists"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backbone_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tawheed Abdul-Raheem
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|