jazz-jss 0.0.1

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.
@@ -0,0 +1,37 @@
1
+ module Jazz
2
+ class AppGenerator < Thor::Group
3
+ include Thor::Actions
4
+ include Jazz::AppDetector
5
+
6
+ desc "Creates a new Jazz app"
7
+
8
+ argument :name
9
+
10
+ def self.source_root
11
+ File.join(File.dirname(__FILE__), '..', '..')
12
+ end
13
+
14
+ def greeting
15
+ $stdout.puts "Creating new Jazz app #{name}"
16
+ end
17
+
18
+ def build_the_app
19
+ directory "templates/app_root", new_app_path
20
+ directory 'dist/jazz', "#{new_app_path}/lib/jazz"
21
+ directory 'dist/hashchange', "#{new_app_path}/vendor/hashchange"
22
+ directory 'dist/jquery', "#{new_app_path}/vendor/jquery"
23
+ directory 'dist/mustache', "#{new_app_path}/vendor/mustache"
24
+ directory 'dist/require', "#{new_app_path}/vendor/require"
25
+ directory 'dist/underscore', "#{new_app_path}/vendor/underscore"
26
+
27
+ template "templates/application.js", "#{new_app_path}/config/application.js"
28
+ template "templates/index.html", "#{new_app_path}/index.html"
29
+
30
+ end
31
+
32
+ def farewell
33
+ $stdout.puts "Thank you for installing Jazz"
34
+ end
35
+
36
+ end
37
+ end
data/lib/jazz/cli.rb ADDED
@@ -0,0 +1,14 @@
1
+ module Jazz
2
+ class CLI < Thor
3
+
4
+ desc "Jazz generate [generator] [name]", "call a generator"
5
+ def generate(requested_generator, name, *args)
6
+ ARGV.delete('generate')
7
+ if(ARGV.include?(requested_generator))
8
+ ARGV.delete(requested_generator)
9
+ ActiveSupport::Inflector.constantize("Jazz::#{requested_generator.capitalize}Generator").start
10
+ end
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,27 @@
1
+ module Jazz
2
+ class ControllerGenerator < Thor::Group
3
+ include Thor::Actions
4
+ include Jazz::AppDetector
5
+
6
+ desc "Creates a new Jazz controller"
7
+
8
+ argument :name
9
+
10
+ def self.source_root
11
+ File.join(File.dirname(__FILE__), '..', '..')
12
+ end
13
+
14
+ def greeting
15
+ $stdout.puts "Creating new Jazz controller #{name.pluralize}Controller"
16
+ end
17
+
18
+ def build_the_controller
19
+ template "templates/controller.js", "#{app_path}/app/controllers/#{name.downcase}_controller.js"
20
+ empty_directory "#{app_path}/app/views/#{name.downcase}"
21
+ end
22
+
23
+ def farewell
24
+ $stdout.puts "Your controller is ready to rule!"
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ module Jazz
2
+ class ModelGenerator < Thor::Group
3
+ include Thor::Actions
4
+ include Jazz::AppDetector
5
+
6
+ desc "Creates a new Jazz model"
7
+ argument :name
8
+ argument :attrs, :type => :array
9
+
10
+ def self.source_root
11
+ File.join(File.dirname(__FILE__), '..', '..')
12
+ end
13
+
14
+ def greeting
15
+ $stdout.puts "Creating new Jazz model #{name}"
16
+ end
17
+
18
+ def build_the_model
19
+ template "templates/model.js", "#{app_path}/app/models/#{name.downcase}.js"
20
+ template "templates/db.js", "#{app_path}/db/create_#{name.downcase.pluralize}.js"
21
+ end
22
+
23
+ def farewell
24
+ $stdout.puts "Your model is ready to rock!"
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,43 @@
1
+ module Jazz
2
+ class ScaffoldGenerator < Thor::Group
3
+ include Thor::Actions
4
+ include Jazz::AppDetector
5
+
6
+ desc "Creates a new Jazz scaffold"
7
+
8
+ argument :name
9
+ argument :attrs, :type => :array
10
+
11
+ def self.source_root
12
+ File.join(File.dirname(__FILE__), '..', '..')
13
+ end
14
+
15
+ def self.destination_root
16
+ "#{name}"
17
+ end
18
+
19
+ def greeting
20
+ $stdout.puts "Creating new Jazz scaffold, model controller and views for #{name}"
21
+ end
22
+
23
+ def build_the_model
24
+ template "templates/model.js", "#{app_path}/app/models/#{name.downcase}.js"
25
+ template "templates/db.js", "#{app_path}/db/create_#{name.downcase.pluralize}.js"
26
+ end
27
+
28
+ def build_the_controller
29
+ template "templates/scaffold_controller.js", "#{app_path}/app/controllers/#{name.downcase.pluralize}_controller.js"
30
+ end
31
+
32
+ # def build_the_views
33
+ # template "templates/scaffold_index.html", "#{public_path}/#{name.downcase.pluralize}.html"
34
+ # template "templates/scaffold_partial.html.mustache", "#{app_path}/app/views/#{name.downcase.pluralize}/_#{name.downcase}.html.mustache"
35
+ # template "templates/scaffold_edit.html.mustache", "#{app_path}/app/views/#{name.downcase.pluralize}/edit.html.mustache"
36
+ # end
37
+
38
+ def farewell
39
+ $stdout.puts "Your scaffold is ready to rumble!"
40
+ end
41
+
42
+ end
43
+ end
data/lib/jazz.rb ADDED
@@ -0,0 +1,11 @@
1
+ require 'rubygems'
2
+ require 'thor'
3
+ require 'thor/group'
4
+ require 'active_support/inflector'
5
+
6
+ require 'jazz/app_detector'
7
+ require 'jazz/app_generator'
8
+ require 'jazz/cli'
9
+ require 'jazz/controller_generator'
10
+ require 'jazz/model_generator'
11
+ require 'jazz/scaffold_generator'
@@ -0,0 +1,7 @@
1
+ var Glue = {
2
+ Db: [],
3
+ Helpers: [],
4
+ Models: [],
5
+ Views: [],
6
+ Controllers: []
7
+ };
@@ -0,0 +1,4 @@
1
+ Jazz.Route.draw(
2
+ {
3
+ }
4
+ );
@@ -0,0 +1,4 @@
1
+ Jazz.Config.appName = '<%= name %>';
2
+ <%= name %> = {
3
+ initialize: function(){}
4
+ }
@@ -0,0 +1,19 @@
1
+ var <%= name.capitalize %>Controller = Jazz.Controller.create(
2
+ {
3
+
4
+ initialize: function(){},
5
+
6
+ index: function(){},
7
+
8
+ show: function(){},
9
+
10
+ create: function(){},
11
+
12
+ update: function(){},
13
+
14
+ destroy: function(){}
15
+
16
+ }
17
+ );
18
+
19
+ <%= name %>_controller = new <%= name.capitalize %>Controller;
data/templates/db.js ADDED
@@ -0,0 +1,14 @@
1
+ var Create<%= name.capitalize.pluralize %> = Jazz.Db.create(
2
+ {
3
+
4
+ columns: {
5
+ <% attrs.each_with_index do |attr, index| %>
6
+ <%= attr %>: {
7
+ value: ''
8
+ }<% unless attrs.length == index + 1 %>,<% end %>
9
+ <% end %>
10
+ },
11
+ }
12
+ );
13
+
14
+ <%= name.pluralize %> = new Create<%= name.capitalize.pluralize %>;
@@ -0,0 +1,9 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset='utf-8'>
5
+ <title><%= name %></title>
6
+ <script data-main="lib/jazz/main.js" src="vendor/require/require.js"></script>
7
+ </head>
8
+ <body></body>
9
+ </html>
@@ -0,0 +1,9 @@
1
+ var <%= name.capitalize %>Model = Jazz.Model.create(
2
+ {
3
+ _config: {
4
+
5
+ table: '<%= name.pluralize %>'
6
+
7
+ }
8
+ }
9
+ );
@@ -0,0 +1,18 @@
1
+ var <%= name.capitalize.pluralize -%>Controller = Jazz.Controller.create(
2
+ {
3
+ initialize: function(){},
4
+
5
+ index: function(){},
6
+
7
+ show: function(){},
8
+
9
+ create: function(){},
10
+
11
+ edit: function(){},
12
+
13
+ destroy: function(){},
14
+
15
+ }
16
+ );
17
+
18
+ <%= name.pluralize -%>_controller = new <%= name.capitalize.pluralize -%>Controller;
metadata ADDED
@@ -0,0 +1,185 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jazz-jss
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Florian Schade
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-12-14 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ none: false
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ hash: 3
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ name: thor
31
+ prerelease: false
32
+ type: :runtime
33
+ requirement: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ version_requirements: &id002 !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ hash: 3
41
+ segments:
42
+ - 0
43
+ version: "0"
44
+ name: activesupport
45
+ prerelease: false
46
+ type: :runtime
47
+ requirement: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ version_requirements: &id003 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ hash: 3
55
+ segments:
56
+ - 0
57
+ version: "0"
58
+ name: shoulda
59
+ prerelease: false
60
+ type: :development
61
+ requirement: *id003
62
+ - !ruby/object:Gem::Dependency
63
+ version_requirements: &id004 !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ hash: 23
69
+ segments:
70
+ - 1
71
+ - 0
72
+ - 0
73
+ version: 1.0.0
74
+ name: bundler
75
+ prerelease: false
76
+ type: :development
77
+ requirement: *id004
78
+ - !ruby/object:Gem::Dependency
79
+ version_requirements: &id005 !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ~>
83
+ - !ruby/object:Gem::Version
84
+ hash: 7
85
+ segments:
86
+ - 1
87
+ - 6
88
+ - 4
89
+ version: 1.6.4
90
+ name: jeweler
91
+ prerelease: false
92
+ type: :development
93
+ requirement: *id005
94
+ - !ruby/object:Gem::Dependency
95
+ version_requirements: &id006 !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ hash: 3
101
+ segments:
102
+ - 0
103
+ version: "0"
104
+ name: rcov
105
+ prerelease: false
106
+ type: :development
107
+ requirement: *id006
108
+ description:
109
+ email: f.schade@purpled.de
110
+ executables:
111
+ - jazz
112
+ extensions: []
113
+
114
+ extra_rdoc_files:
115
+ - LICENSE.txt
116
+ - README.rdoc
117
+ files:
118
+ - bin/jazz
119
+ - dist/hashchange/jquery.ba-hashchange.js
120
+ - dist/jazz/lib/controller.js
121
+ - dist/jazz/lib/db.js
122
+ - dist/jazz/lib/helper.js
123
+ - dist/jazz/lib/model.js
124
+ - dist/jazz/lib/route.js
125
+ - dist/jazz/lib/view.js
126
+ - dist/jazz/main.js
127
+ - dist/jquery/jquery.js
128
+ - dist/mustache/mustache.js
129
+ - dist/require/order.js
130
+ - dist/require/require.js
131
+ - dist/underscore/underscore.js
132
+ - lib/jazz.rb
133
+ - lib/jazz/app_detector.rb
134
+ - lib/jazz/app_generator.rb
135
+ - lib/jazz/cli.rb
136
+ - lib/jazz/controller_generator.rb
137
+ - lib/jazz/model_generator.rb
138
+ - lib/jazz/scaffold_generator.rb
139
+ - templates/app_root/app/assets/javascripts/application.js
140
+ - templates/app_root/app/assets/stylesheets/application.css
141
+ - templates/app_root/config/glue.js
142
+ - templates/app_root/config/routes.js
143
+ - templates/application.js
144
+ - templates/controller.js
145
+ - templates/db.js
146
+ - templates/index.html
147
+ - templates/model.js
148
+ - templates/scaffold_controller.js
149
+ - LICENSE.txt
150
+ - README.rdoc
151
+ homepage: https://github.com/purpled/jazz
152
+ licenses:
153
+ - MIT
154
+ post_install_message:
155
+ rdoc_options: []
156
+
157
+ require_paths:
158
+ - lib
159
+ required_ruby_version: !ruby/object:Gem::Requirement
160
+ none: false
161
+ requirements:
162
+ - - ">="
163
+ - !ruby/object:Gem::Version
164
+ hash: 3
165
+ segments:
166
+ - 0
167
+ version: "0"
168
+ required_rubygems_version: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ hash: 3
174
+ segments:
175
+ - 0
176
+ version: "0"
177
+ requirements: []
178
+
179
+ rubyforge_project:
180
+ rubygems_version: 1.8.10
181
+ signing_key:
182
+ specification_version: 3
183
+ summary: A lightweight javascript MVC framework.
184
+ test_files: []
185
+