joosy 1.2.0.alpha.62 → 1.2.0.alpha.63

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/Gruntfile.coffee +32 -22
  4. data/bower.json +1 -1
  5. data/lib/joosy.rb +1 -5
  6. data/package.json +3 -6
  7. data/templates/application/application.coffee.tt +12 -0
  8. data/{lib/generators/templates/application/base → templates/application}/helpers/application.coffee +0 -0
  9. data/{lib/generators/templates/application/base → templates/application}/layouts/application.coffee +0 -0
  10. data/{lib/generators/templates/application/base → templates/application}/pages/application.coffee +0 -0
  11. data/{lib/generators/templates/application/base → templates/application}/pages/welcome/index.coffee +0 -0
  12. data/{lib/generators/templates/application/base → templates/application}/routes.coffee +0 -0
  13. data/{lib/generators/templates/application/base → templates/application}/templates/layouts/application.jst.hamlc +0 -0
  14. data/{lib/generators/templates/application/base → templates/application}/templates/pages/welcome/index.jst.hamlc +0 -0
  15. data/{lib/generators/templates/application/standalone/_gitignore → templates/environment/.gitignore} +0 -0
  16. data/{lib/generators/templates/application/standalone → templates/environment}/Gruntfile.coffee +15 -13
  17. data/{lib/generators/templates/application/standalone → templates/environment}/Procfile +0 -0
  18. data/{lib/generators/templates/application/standalone → templates/environment}/app/haml/index.haml +0 -0
  19. data/{lib/generators/templates/application/standalone → templates/environment}/app/stylesheets/application.styl +0 -0
  20. data/{lib/generators/templates/application/standalone → templates/environment}/bower.json +0 -0
  21. data/{lib/generators/templates/application/standalone → templates/environment}/package.json +4 -4
  22. data/{lib/generators/templates/application/standalone → templates/environment}/spec/application_spec.coffee +0 -0
  23. data/{lib/generators/templates/application/standalone → templates/environment}/spec/helpers/environment.coffee +0 -0
  24. data/templates/layout/layouts/%name%.coffee.tt +9 -0
  25. data/templates/layout/templates/layouts/%name%.jst.hamlc +0 -0
  26. data/templates/page/pages/%name%.coffee.tt +11 -0
  27. data/templates/page/templates/pages/%name%.jst.hamlc +0 -0
  28. data/templates/widget/templates/widgets/%name%.jst.hamlc +0 -0
  29. data/templates/widget/widgets/%name%.coffee.tt +9 -0
  30. metadata +25 -37
  31. data/bin/joosy +0 -21
  32. data/lib/generators/base.coffee +0 -108
  33. data/lib/generators/command/command.coffee +0 -63
  34. data/lib/generators/command/help.coffee +0 -38
  35. data/lib/generators/layout.coffee +0 -26
  36. data/lib/generators/page.coffee +0 -26
  37. data/lib/generators/project.coffee +0 -24
  38. data/lib/generators/project/base.coffee +0 -40
  39. data/lib/generators/project/standalone.coffee +0 -51
  40. data/lib/generators/templates/application/base/application.coffee +0 -12
  41. data/lib/generators/templates/application/standalone/tasks/spec.coffee +0 -15
  42. data/lib/generators/templates/layout/basic.coffee +0 -2
  43. data/lib/generators/templates/layout/namespaced.coffee +0 -4
  44. data/lib/generators/templates/page/basic.coffee +0 -3
  45. data/lib/generators/templates/page/namespaced.coffee +0 -5
  46. data/lib/generators/templates/widget/basic.coffee +0 -2
  47. data/lib/generators/templates/widget/namespaced.coffee +0 -4
  48. data/lib/generators/widget.coffee +0 -26
  49. data/lib/tasks/testem.coffee +0 -58
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3026cc5a8fa556721dea56bca1cd26624997d893
4
- data.tar.gz: 7b33f80118d9b346b6e878f65155b5de68c2ddc2
3
+ metadata.gz: 69739c36a5ebd92252282522b35939310ad81bc1
4
+ data.tar.gz: d594f2adcdeefa91aacf255cbf0a3985e23de4de
5
5
  SHA512:
6
- metadata.gz: 12407f1b9f3f29b45cfab2fcacf1a918c2e9a5148fd8b7d9140ec44cb91608cd66ab5d6e71f5413fac82798c6bec8aabf621c93f548473f65b571a74a3c915aa
7
- data.tar.gz: f22ccf20ee0fc3b87b19ffe598914fdca3241841f2a7de90d0fb678bb0dd9e2dfbe0264051c5bd4e1914ab8117f3b3bbf0d39fefae79d287f4fc368789e1663b
6
+ metadata.gz: 91bb29b74b08df165afa9623556424de32ea0540692d09e2e929df9b89089983377d21f20cd9b4ae4f3ce2b5ca6681f7055d12e6670947cbd843951eca808d08
7
+ data.tar.gz: 4846c9b0cdc628f0d75c958936d18191fc42d9bfa15ad23660963b4850ca9536c24602831f71654e27857be7eedb0dcad87005ea1472631d8fc8a20633b8a5a2
data/.travis.yml CHANGED
@@ -5,7 +5,7 @@ before_script:
5
5
  - npm install -g phantomjs
6
6
  - npm install -g grunt-cli
7
7
  - ./node_modules/.bin/bower -V install
8
- script: "grunt"
8
+ script: "grunt --launch=phantomjs"
9
9
  branches:
10
10
  except:
11
11
  - 1.0
data/Gruntfile.coffee CHANGED
@@ -2,27 +2,35 @@ require 'sugar'
2
2
 
3
3
  module.exports = (grunt) ->
4
4
  #
5
- # Locations
5
+ # Common settings
6
6
  #
7
7
  locations =
8
+
8
9
  source:
9
- root: 'joosy.coffee'
10
- path: 'source'
10
+ root: 'joosy.coffee'
11
+ path: 'source'
11
12
  build: 'build/joosy.js'
13
+
12
14
  extensions: (name) ->
13
- root: "joosy/extensions/#{name || '*'}"
15
+ root: "joosy/extensions/#{name || '*'}"
14
16
  build: "build/joosy/extensions/#{name || '**/*'}.js"
15
- specs:
16
- helpers: [
17
- 'bower_components/sinonjs/sinon.js',
18
- 'bower_components/sugar/release/sugar-full.min.js',
19
- 'spec/helpers/*.coffee'
20
- ]
17
+
18
+ specs: [
19
+ 'bower_components/sinonjs/sinon.js',
20
+ 'bower_components/sugar/release/sugar-full.min.js',
21
+ 'spec/helpers/*.coffee'
22
+ ]
23
+
24
+ testem =
25
+ parallel: 8
26
+ launch_in_dev: ['PhantomJS'],
27
+ launch_in_ci: ['PhantomJS', 'Chrome', 'Firefox', 'Safari', 'IE7', 'IE8', 'IE9']
21
28
 
22
29
  #
23
30
  # Grunt extensions
24
31
  #
25
32
  grunt.loadTasks 'lib/tasks'
33
+ grunt.loadNpmTasks 'grunt-contrib-testem'
26
34
  grunt.loadNpmTasks 'grunt-coffeelint'
27
35
  grunt.loadNpmTasks 'grunt-release'
28
36
 
@@ -54,33 +62,38 @@ module.exports = (grunt) ->
54
62
 
55
63
  testem:
56
64
  core:
57
- src: locations.specs.helpers
65
+ src: locations.specs
58
66
  .include('bower_components/jquery/jquery.js')
59
67
  .include(locations.source.build)
60
68
  .include('spec/joosy/core/**/*_spec.coffee')
69
+ options: testem
61
70
  zepto:
62
- src: locations.specs.helpers
71
+ src: locations.specs
63
72
  .include('bower_components/zepto/zepto.js')
64
73
  .include(locations.source.build)
65
74
  .include('spec/joosy/core/**/*_spec.coffee')
75
+ options: testem
66
76
  'environments-global':
67
- src: locations.specs.helpers
77
+ src: locations.specs
68
78
  .include('bower_components/jquery/jquery.js')
69
79
  .include(locations.source.build)
70
80
  .include('spec/joosy/environments/global_spec.coffee')
81
+ options: testem
71
82
  'environments-amd':
72
- src: locations.specs.helpers
83
+ src: locations.specs
73
84
  .include('bower_components/jquery/jquery.js')
74
85
  .include('bower_components/requirejs/require.js')
75
86
  .include(locations.source.build)
76
87
  .include('spec/joosy/environments/amd_spec.coffee')
88
+ options: testem
77
89
  extensions:
78
- src: locations.specs.helpers
90
+ src: locations.specs
79
91
  .include('bower_components/jquery/jquery.js')
80
- .include('bower_components/jquery-form/jquery.form.js')
81
92
  .include(locations.source.build)
93
+ .include('bower_components/jquery-form/jquery.form.js')
82
94
  .include(locations.source.extensions().build)
83
95
  .include('spec/joosy/extensions/**/*_spec.coffee')
96
+ options: testem
84
97
 
85
98
  release:
86
99
  options:
@@ -92,12 +105,9 @@ module.exports = (grunt) ->
92
105
  #
93
106
  # Main tasks
94
107
  #
95
- grunt.registerTask 'default', ['testem:generate', 'testem:ci']
108
+ grunt.registerTask 'default', 'testem'
96
109
 
97
110
  grunt.registerTask 'test', ->
98
- grunt.fatal "Specify module to run manual tests for" unless @args[0]
99
-
100
- grunt.task.run "testem:generate:#{@args[0]}"
101
- grunt.task.run "testem:run:#{@args[0]}"
111
+ grunt.task.run if @args[0] then "testem:run:#{@args[0]}" else 'testem'
102
112
 
103
- grunt.registerTask 'publish', ['testem:ci', 'publish:ensureCommits', 'doc', 'release', 'publish:gem']
113
+ grunt.registerTask 'publish', ['testem', 'publish:ensureCommits', 'doc', 'release', 'publish:gem']
data/bower.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joosy",
3
- "version": "1.2.0-alpha.62",
3
+ "version": "1.2.0-alpha.63",
4
4
  "main": "lib/joosy.js",
5
5
  "ignore": [
6
6
  "bin",
data/lib/joosy.rb CHANGED
@@ -12,11 +12,7 @@ module Joosy
12
12
  ]
13
13
  end
14
14
 
15
- def self.generators_path
16
- File.expand_path '../../lib/generators', __FILE__
17
- end
18
-
19
15
  def self.templates_path
20
- File.expand_path '../../lib/generators/templates', __FILE__
16
+ File.expand_path '../../templates', __FILE__
21
17
  end
22
18
  end
data/package.json CHANGED
@@ -4,16 +4,13 @@
4
4
  "keywords": [
5
5
  "joosy"
6
6
  ],
7
- "version": "1.2.0-alpha.62",
7
+ "version": "1.2.0-alpha.63",
8
8
  "author": "Boris Staal <boris@staal.io>",
9
9
  "homepage": "http://joosy.ws/",
10
10
  "repository": {
11
11
  "type": "git",
12
12
  "url": "git://github.com/joosy/joosy.git"
13
13
  },
14
- "bin": {
15
- "joosy": "bin/joosy"
16
- },
17
14
  "engines": {
18
15
  "node": ">=0.4.0"
19
16
  },
@@ -32,8 +29,8 @@
32
29
  "bower": "~1.1.2",
33
30
  "mincer": ">= 0.5.5",
34
31
  "semver": "~2.1.0",
35
- "testem": "~0.3.24",
36
32
  "grunt-coffeelint": "0.0.6",
37
- "grunt-release": "~0.3.5"
33
+ "grunt-release": "~0.3.5",
34
+ "grunt-contrib-testem": ">=0.2.0"
38
35
  }
39
36
  }
@@ -0,0 +1,12 @@
1
+ <%= dependencies %>
2
+ #
3
+ #= require joosy
4
+ #
5
+ #= require_tree ./
6
+
7
+ $ ->
8
+ Joosy.Application.initialize 'body',
9
+ router:
10
+ html5: <%= html5 %><% if (typeof prefix !== 'undefined' && prefix.length > 0) { %>
11
+ templater:
12
+ prefix: '<%= prefix %>'<% } %>
@@ -3,8 +3,7 @@ module.exports = (grunt) ->
3
3
  grunt.loadNpmTasks 'joosy'
4
4
  grunt.loadNpmTasks 'grunt-contrib-uglify'
5
5
  grunt.loadNpmTasks 'grunt-contrib-cssmin'
6
- grunt.loadNpmTasks 'grunt-contrib-jasmine'
7
- grunt.loadNpmTasks 'grunt-contrib-coffee'
6
+ grunt.loadNpmTasks 'grunt-contrib-testem'
8
7
 
9
8
  #
10
9
  # Config
@@ -31,23 +30,26 @@ module.exports = (grunt) ->
31
30
  files:
32
31
  'public/application.css': 'public/application.css'
33
32
 
34
- jasmine:
33
+ testem:
35
34
  application:
36
- src: 'public/application.js'
37
- options:
38
- keepRunner: true
39
- outfile: 'spec/application.html'
40
- specs: '.grunt/spec/*_spec.js'
41
- helpers: '.grunt/spec/helpers/environment.js'
35
+ src: [
36
+ 'public/application.js',
37
+ 'spec/helpers/*.coffee',
38
+ 'spec/**/*_spec.coffee'
39
+ ]
40
+ options:
41
+ parallel: 4
42
+ launch_in_dev: ['PhantomJS'],
43
+ launch_in_ci: ['PhantomJS']
42
44
 
43
45
  #
44
46
  # Tasks
45
47
  #
46
- grunt.loadTasks 'tasks'
47
-
48
48
  grunt.registerTask 'compile', ['joosy:compile', 'uglify', 'cssmin']
49
49
  grunt.registerTask 'server', ['joosy:server']
50
50
 
51
- grunt.registerTask 'spec', ['coffee', 'joosy:compile', 'jasmine']
51
+ grunt.registerTask 'spec', ['testem']
52
52
 
53
- grunt.registerTask 'joosy:postinstall', ['joosy:bower', 'joosy:compile']
53
+ grunt.registerTask 'deploy', ->
54
+ if process.env['NODE_ENV'] == 'production'
55
+ grunt.task.run ['joosy:bower', 'joosy:compile']
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "dependencies": {
3
- "joosy": "~<%= joosy_version %>",
3
+ "joosy": "<%= joosy %>",
4
4
  "haml-coffee": "~1.11.1",
5
5
  "stylus": "~0.32.1",
6
6
  "nib": "~0.9.1",
@@ -8,10 +8,10 @@
8
8
  "grunt-cli": "~0.1.9",
9
9
  "grunt-contrib-uglify": "~0.2.2",
10
10
  "grunt-contrib-cssmin": "~0.6.1",
11
- "grunt-contrib-jasmine": "~0.5.1",
12
- "grunt-contrib-coffee": "~0.7.0"
11
+ "grunt-contrib-testem": "~0.2.0",
12
+ "phantom": "~0.5.2"
13
13
  },
14
14
  "scripts": {
15
- "postinstall": "node_modules/.bin/grunt joosy:postinstall"
15
+ "postinstall": "node_modules/.bin/grunt deploy"
16
16
  }
17
17
  }
@@ -0,0 +1,9 @@
1
+ <% if (typeof namespace !== 'undefined' && namespace.length > 0) { -%>
2
+ Joosy.namespace '<%= namespace %>', ->
3
+
4
+ class @<%= klass %>Layout extends ApplicationLayout
5
+ @view '<%= view %>'
6
+ <% } else { -%>
7
+ class @<%= klass %>Layout extends ApplicationLayout
8
+ @view '<%= view %>'
9
+ <% } -%>
@@ -0,0 +1,11 @@
1
+ <% if (typeof namespace !== 'undefined' && namespace.length > 0) { -%>
2
+ Joosy.namespace '<%= namespace %>', ->
3
+
4
+ class @<%= klass %>Page extends ApplicationPage
5
+ @layout ApplicationLayout
6
+ @view '<%= view %>'
7
+ <% } else { -%>
8
+ class @<%= klass %>Page extends ApplicationPage
9
+ @layout ApplicationLayout
10
+ @view '<%= view %>'
11
+ <% } -%>
File without changes
@@ -0,0 +1,9 @@
1
+ <% if (typeof namespace !== 'undefined' && namespace.length > 0) { -%>
2
+ Joosy.namespace '<%= namespace %>', ->
3
+
4
+ class @<%= klass %>Widget extends Joosy.Widget
5
+ @view '<%= view %>'
6
+ <% } else { -%>
7
+ class @<%= klass %>Widget extends Joosy.Widget
8
+ @view '<%= view %>'
9
+ <% } -%>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: joosy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0.alpha.62
4
+ version: 1.2.0.alpha.63
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Staal
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-08-19 00:00:00.000000000 Z
13
+ date: 2013-08-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sprockets
@@ -51,50 +51,15 @@ files:
51
51
  - .travis.yml
52
52
  - Gruntfile.coffee
53
53
  - README.md
54
- - bin/joosy
55
54
  - bower.json
56
55
  - build/joosy.js
57
56
  - build/joosy/extensions/resources-form.js
58
57
  - build/joosy/extensions/resources.js
59
58
  - joosy.gemspec
60
- - lib/generators/base.coffee
61
- - lib/generators/command/command.coffee
62
- - lib/generators/command/help.coffee
63
- - lib/generators/layout.coffee
64
- - lib/generators/page.coffee
65
- - lib/generators/project.coffee
66
- - lib/generators/project/base.coffee
67
- - lib/generators/project/standalone.coffee
68
- - lib/generators/templates/application/base/application.coffee
69
- - lib/generators/templates/application/base/helpers/application.coffee
70
- - lib/generators/templates/application/base/layouts/application.coffee
71
- - lib/generators/templates/application/base/pages/application.coffee
72
- - lib/generators/templates/application/base/pages/welcome/index.coffee
73
- - lib/generators/templates/application/base/routes.coffee
74
- - lib/generators/templates/application/base/templates/layouts/application.jst.hamlc
75
- - lib/generators/templates/application/base/templates/pages/welcome/index.jst.hamlc
76
- - lib/generators/templates/application/standalone/Gruntfile.coffee
77
- - lib/generators/templates/application/standalone/Procfile
78
- - lib/generators/templates/application/standalone/_gitignore
79
- - lib/generators/templates/application/standalone/app/haml/index.haml
80
- - lib/generators/templates/application/standalone/app/stylesheets/application.styl
81
- - lib/generators/templates/application/standalone/bower.json
82
- - lib/generators/templates/application/standalone/package.json
83
- - lib/generators/templates/application/standalone/spec/application_spec.coffee
84
- - lib/generators/templates/application/standalone/spec/helpers/environment.coffee
85
- - lib/generators/templates/application/standalone/tasks/spec.coffee
86
- - lib/generators/templates/layout/basic.coffee
87
- - lib/generators/templates/layout/namespaced.coffee
88
- - lib/generators/templates/page/basic.coffee
89
- - lib/generators/templates/page/namespaced.coffee
90
- - lib/generators/templates/widget/basic.coffee
91
- - lib/generators/templates/widget/namespaced.coffee
92
- - lib/generators/widget.coffee
93
59
  - lib/joosy.rb
94
60
  - lib/tasks/build.coffee
95
61
  - lib/tasks/doc.coffee
96
62
  - lib/tasks/publish.coffee
97
- - lib/tasks/testem.coffee
98
63
  - package.json
99
64
  - source/joosy.coffee
100
65
  - source/joosy/application.coffee
@@ -157,6 +122,29 @@ files:
157
122
  - spec/joosy/extensions/resources/rest_spec.coffee
158
123
  - spec/support/test.js
159
124
  - tasks/joosy.coffee
125
+ - templates/application/application.coffee.tt
126
+ - templates/application/helpers/application.coffee
127
+ - templates/application/layouts/application.coffee
128
+ - templates/application/pages/application.coffee
129
+ - templates/application/pages/welcome/index.coffee
130
+ - templates/application/routes.coffee
131
+ - templates/application/templates/layouts/application.jst.hamlc
132
+ - templates/application/templates/pages/welcome/index.jst.hamlc
133
+ - templates/environment/.gitignore
134
+ - templates/environment/Gruntfile.coffee
135
+ - templates/environment/Procfile
136
+ - templates/environment/app/haml/index.haml
137
+ - templates/environment/app/stylesheets/application.styl
138
+ - templates/environment/bower.json
139
+ - templates/environment/package.json
140
+ - templates/environment/spec/application_spec.coffee
141
+ - templates/environment/spec/helpers/environment.coffee
142
+ - templates/layout/layouts/%name%.coffee.tt
143
+ - templates/layout/templates/layouts/%name%.jst.hamlc
144
+ - templates/page/pages/%name%.coffee.tt
145
+ - templates/page/templates/pages/%name%.jst.hamlc
146
+ - templates/widget/templates/widgets/%name%.jst.hamlc
147
+ - templates/widget/widgets/%name%.coffee.tt
160
148
  homepage: http://github.com/joosy/joosy
161
149
  licenses:
162
150
  - MIT
data/bin/joosy DELETED
@@ -1,21 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- 'use strict';
4
-
5
- var resolve = require('resolve').sync
6
- var path = require('path')
7
- var base = ''
8
- var location = path.join('lib', 'generators', 'command', 'command')
9
-
10
- try {
11
- base = resolve('joosy', {
12
- basedir: process.cwd(),
13
- extensions: ['.coffee'],
14
- packageFilter: function(pkg) { pkg.main = location; return pkg; }
15
- });
16
- } catch (ex) {
17
- base = path.join('..', location);
18
- }
19
-
20
- require('coffee-script');
21
- require(base)();
@@ -1,108 +0,0 @@
1
- if module?
2
- File = require('grunt').file
3
- Log = require('grunt').log
4
- Path = require('path')
5
- EJS = require('ejs')
6
- Commander = require('commander')
7
-
8
- class Base
9
- constructor: (@options, @destination, @templates) ->
10
- @destination ||= process?.cwd()
11
- @templates ||= @join(__dirname, 'templates') if __dirname?
12
- @actions = []
13
-
14
- getNamespace: (name) ->
15
- name = name.split('/')
16
- name.pop()
17
- name
18
-
19
- getBasename: (name) ->
20
- name = name.split('/')
21
- name.pop()
22
-
23
- template: (source, destination, data) ->
24
- source = @join(source...) if source instanceof Array
25
- destination = @join(destination...) if destination instanceof Array
26
-
27
- @actions.push ['template', destination, source, data]
28
-
29
- file: (destination, content='') ->
30
- destination = @join(destination...) if destination instanceof Array
31
-
32
- @actions.push ['file', destination, content]
33
-
34
- copy: (source, destination) ->
35
- source = @join(source...) if source instanceof Array
36
- destination = @join(destination...) if destination instanceof Array
37
-
38
- @actions.push ['copy', destination, source]
39
-
40
- camelize: (string) ->
41
- parts = (part.charAt(0).toUpperCase() + part.substr(1) for part in string.split(/_|-/))
42
- parts.join ''
43
-
44
- join: ->
45
- if Path?
46
- Path.join arguments...
47
- else
48
- Array.prototype.slice.call(arguments, 0).join('/')
49
-
50
- #
51
- # Methods that have to be overrided outside of Node.js
52
- #
53
- version: ->
54
- require('../../package.json').version
55
-
56
- #
57
- # Node-base performer
58
- #
59
- compileTemplate: (source, data) ->
60
- EJS.render File.read(source), data
61
-
62
- perform: (callback) ->
63
- actions = @actions.clone()
64
- @performAction actions.pop(), actions, callback
65
-
66
- performAction: (action, actions, callback) ->
67
- method = "perform#{action.shift().camelize()}Action"
68
- next = =>
69
- if actions.length > 0
70
- @performAction(actions.pop(), actions, callback)
71
- else
72
- callback()
73
-
74
- @[method] next, action...
75
-
76
- performCopyAction: (callback, destination, source) ->
77
- write = =>
78
- File.copy @join(@templates, source), @join(@destination, destination)
79
- Log.ok "#{destination} copied..."
80
-
81
- if File.exists(@destination, destination)
82
- Commander.confirm "#{destination} exists. Overwrite? ", (y) ->
83
- write() if y
84
- callback()
85
- else
86
- write()
87
- callback()
88
-
89
- performFileAction: (callback, destination, content) ->
90
- write = =>
91
- File.write(@join(@destination, destination), content)
92
- Log.ok "#{destination} generated..."
93
-
94
- if File.exists(@destination, destination)
95
- Commander.confirm "#{destination} exists. Overwrite? ", (y) ->
96
- write() if y
97
- callback()
98
- else
99
- write()
100
- callback()
101
-
102
- performTemplateAction: (callback, destination, source, data) ->
103
- @performFileAction callback, destination, @compileTemplate(@join(@templates, source), data)
104
-
105
- if module?
106
- module.exports = Base
107
- else
108
- @Base = Base
@@ -1,63 +0,0 @@
1
- module.exports = ->
2
- Sugar = require 'sugar'
3
- cli = require 'command-router'
4
- meta = require '../../../package.json'
5
- grunt = require 'grunt'
6
- path = require 'path'
7
-
8
- cli.command /help\s?(.*)/, ->
9
- name = cli.params.splats[0]
10
- commands = ['new', 'generate']
11
- name = 'banner' if name == ''
12
-
13
- if !commands.some(name) && name != 'banner'
14
- console.error "Unknown command '#{name}'. Possible values: #{commands.join(', ')}."
15
- process.exit 1
16
-
17
- helper = require('./help')
18
- helper[name]()
19
-
20
- cli.command /new\s?(.*)?/, ->
21
- name = cli.params.splats[0]
22
-
23
- unless name?
24
- console.error "Usage: `new :name`. Run `help` for details."
25
- process.exit(1)
26
-
27
- generator = require('../project')
28
- generator = new generator(name: name)
29
- generator.generate()
30
- generator.perform -> process.exit 0
31
-
32
- cli.command /g(enerate)?\s?(.*)/, ->
33
- params = cli.params.splats[1].split(' ')
34
- entity = params[0]
35
- name = params[1]
36
-
37
- generators = ['page', 'resource', 'widget', 'layout']
38
-
39
- if !entity? || !name?
40
- console.error "Usage: `generate :entity :name`. Run `help` for details."
41
- process.exit 1
42
-
43
- unless generators.some(entity)
44
- console.error "Don't know how to generate '#{entity}'. Possible values: #{generators.join(', ')}."
45
- process.exit 1
46
-
47
- unless grunt.file.exists(process.cwd(), 'source')
48
- console.error "Failed: `source' directory not found. Are you in the root of project?"
49
- process.exit 1
50
-
51
- generator = require("../#{entity}")
52
- generator = new generator({name: name}, path.join(process.cwd(), 'source'))
53
- generator.generate()
54
- generator.perform -> process.exit 0
55
-
56
-
57
- cli.on 'notfound', (action) ->
58
- if action.length > 0
59
- console.error "'#{action}' is an unknown action :("
60
- else
61
- console.log "Joosy #{meta.version}. Run `help` to list possible commands."
62
-
63
- cli.parse process.argv
@@ -1,38 +0,0 @@
1
- module.exports =
2
-
3
- generate: ->
4
- console.log 'Usage:'
5
- console.log ' joosy generate :generator'
6
- console.log ''
7
- console.log 'Description:'
8
- console.log ' Runs one of the following generators to create something for you:'
9
- console.log ''
10
- console.log ' page create new page'
11
- console.log ' resource create new resource'
12
- console.log ' widget create new widget'
13
- console.log ' layout create new layout'
14
-
15
- new: ->
16
- console.log 'Usage:'
17
- console.log ' joosy new :name'
18
- console.log ''
19
- console.log 'Description:'
20
- console.log ' Generates brand new Joosy application named :name (directory with the name of application will be created)'
21
-
22
- banner: ->
23
- console.log ' __________________________'
24
- console.log ' /_ ____ ____ ____ __ __/'
25
- console.log ' __/ / / / ___/ / /'
26
- console.log ' / / / / / / /__ / / /'
27
- console.log ' /____/____/____/____/__ /'
28
- console.log '/_________________________/'
29
- console.log ''
30
- console.log 'Usage:'
31
- console.log ' joosy COMMAND [ARGS]'
32
- console.log ''
33
- console.log 'Available commands:'
34
- console.log ' generate Insert new entity in the application (short-cut alias "g")'
35
- console.log ' new Create a new application'
36
- console.log ''
37
- console.log 'Description:'
38
- console.log ' Help is also available on per-command basis (joosy help command)'
@@ -1,26 +0,0 @@
1
- @Base = require './base' if module?
2
-
3
- #
4
- # Possible options:
5
- #
6
- # name: name of layout including namespace (i.e. 'foo/bar/baz')
7
- #
8
- class Layout extends @Base
9
- generate: ->
10
- namespace = @getNamespace @options.name
11
- basename = @getBasename @options.name
12
- template = if namespace.length > 0 then 'namespaced' else 'basic'
13
-
14
- @template ['layout', "#{template}.coffee"], ['layouts', @join(namespace...), "#{basename}.coffee"],
15
- namespace_name: (@camelize(x) for x in namespace).join('.')
16
- class_name: @camelize(basename)
17
- view_name: basename
18
-
19
- @file ['templates', 'layouts', @join(namespace...), "#{basename}.jst.hamlc"]
20
-
21
- @actions
22
-
23
- if module?
24
- module.exports = Layout
25
- else
26
- @Generator = Layout
@@ -1,26 +0,0 @@
1
- @Base = require './base' if module?
2
-
3
- #
4
- # Possible options:
5
- #
6
- # name: name of page including namespace (i.e. 'foo/bar/baz')
7
- #
8
- class Page extends @Base
9
- generate: ->
10
- namespace = @getNamespace @options.name
11
- basename = @getBasename @options.name
12
- template = if namespace.length > 0 then 'namespaced' else 'basic'
13
-
14
- @template ['page', "#{template}.coffee"], ['pages', @join(namespace...), "#{basename}.coffee"],
15
- namespace_name: (@camelize(x) for x in namespace).join('.')
16
- class_name: @camelize(basename)
17
- view_name: basename
18
-
19
- @file ['templates', 'pages', @join(namespace...), "#{basename}.jst.hamlc"]
20
-
21
- @actions
22
-
23
- if module?
24
- module.exports = Page
25
- else
26
- @Generator = Page
@@ -1,24 +0,0 @@
1
- Standalone = require './project/standalone'
2
- Base = require './project/base'
3
- Path = require 'path'
4
-
5
- module.exports = class
6
- constructor: (@options) ->
7
- @options.enableHTML5 = true
8
- @options.dependencies = """
9
- #= require jquery/jquery.js
10
- #= require jquery-form/jquery.form.js
11
- #= require sugar/release/sugar.min.js
12
- """
13
-
14
- @standalone = new Standalone(@options)
15
- @base = new Base(@options, Path.join(@standalone.destination, 'app/javascript'))
16
-
17
- generate: ->
18
- @standalone.generate()
19
- @base.generate()
20
-
21
- perform: (callback) ->
22
- @standalone.perform =>
23
- @base.perform =>
24
- callback()
@@ -1,40 +0,0 @@
1
- @Base = require '../base' if module?
2
-
3
- #
4
- # Possible options:
5
- #
6
- # name: name of project
7
- #
8
- class ProjectBase extends @Base
9
- constructor: (@options, destination, templates) ->
10
- super(@options, destination, templates)
11
-
12
- generate: ->
13
- @file ['resources', '.gitkeep']
14
- @file ['widgets', '.gitkeep']
15
- @file ['templates', 'widgets', '.gitkeep']
16
-
17
- @copy ['application', 'base', 'routes.coffee'], ['routes.coffee']
18
- @copy ['application', 'base', 'helpers', 'application.coffee'], ['helpers', 'application.coffee']
19
- @copy ['application', 'base', 'layouts', 'application.coffee'], ['layouts', 'application.coffee']
20
- @copy ['application', 'base', 'pages', 'application.coffee'], ['pages', 'application.coffee']
21
- @copy ['application', 'base', 'pages', 'welcome', 'index.coffee'], ['pages', 'welcome', 'index.coffee']
22
-
23
- @copy ['application', 'base', 'templates', 'layouts', 'application.jst.hamlc'],
24
- ['templates', 'layouts', 'application.jst.hamlc']
25
-
26
- @copy ['application', 'base', 'templates', 'pages', 'welcome', 'index.jst.hamlc'],
27
- ['templates', 'pages', 'welcome', 'index.jst.hamlc']
28
-
29
-
30
- @template ['application', 'base', 'application.coffee'], ['application.coffee'],
31
- templaterPrefix: @options.templaterPrefix || null
32
- enableHTML5: !!@options.enableHTML5
33
- dependencies: @options.dependencies.replace /^\s+|\s+$/g, ''
34
-
35
- @actions
36
-
37
- if module?
38
- module.exports = ProjectBase
39
- else
40
- @Generator = ProjectBase
@@ -1,51 +0,0 @@
1
- @Base = require '../base' if module?
2
-
3
- #
4
- # Possible options:
5
- #
6
- # name: name of project
7
- #
8
- class ProjectStandalone extends @Base
9
- constructor: (@options, destination, templates) ->
10
- destination = @join process.cwd(), @options.name if !destination? && process?
11
- super(@options, destination, templates)
12
-
13
- generate: ->
14
- @file ['public', '.gitkeep']
15
- @file ['vendor', '.gitkeep']
16
-
17
- @copy ['application', 'standalone', '_gitignore'], ['.gitignore']
18
- @copy ['application', 'standalone', 'Gruntfile.coffee'], ['Gruntfile.coffee']
19
- @copy ['application', 'standalone', 'Procfile'], ['Procfile']
20
-
21
- @copy ['application', 'standalone', 'app', 'haml', 'index.haml'],
22
- ['app', 'haml', 'index.haml']
23
-
24
- @copy ['application', 'standalone', 'app', 'stylesheets', 'application.styl'],
25
- ['app', 'stylesheets', 'application.styl']
26
-
27
- @file ['app', 'images', '.gitkeep']
28
-
29
- @file ['app', 'fonts', '.gitkeep']
30
-
31
- @copy ['application', 'standalone', 'tasks', 'spec.coffee'],
32
- ['tasks', 'spec.coffee']
33
-
34
- @copy ['application', 'standalone', 'spec', 'helpers', 'environment.coffee'],
35
- ['spec', 'helpers', 'environment.coffee']
36
-
37
- @copy ['application', 'standalone', 'spec', 'application_spec.coffee'],
38
- ['spec', 'application_spec.coffee']
39
-
40
- @template ['application', 'standalone', 'bower.json'], ['bower.json'],
41
- application: @options.name
42
-
43
- @template ['application', 'standalone', 'package.json'], ['package.json'],
44
- joosy_version: @version()
45
-
46
- @actions
47
-
48
- if module?
49
- module.exports = ProjectStandalone
50
- else
51
- @Generator = ProjectStandalone
@@ -1,12 +0,0 @@
1
- <%= dependencies %>
2
- #
3
- #= require joosy
4
- #
5
- #= require_tree ./
6
-
7
- $ ->
8
- Joosy.Application.initialize 'body',
9
- router:
10
- html5: <%= enableHTML5 %><% if (templaterPrefix && templaterPrefix.length > 0) { %>
11
- templater:
12
- prefix: '<%= templaterPrefix %>'<% } %>
@@ -1,15 +0,0 @@
1
- module.exports = (grunt) ->
2
-
3
- grunt.config.data.coffee ||= {}
4
-
5
- grunt.config.data.coffee.specs =
6
- expand: true
7
- src: 'spec/**/*_spec.coffee'
8
- dest: '.grunt'
9
- ext: '.js'
10
-
11
- grunt.config.data.coffee.spec_helpers =
12
- expand: true
13
- src: 'spec/helpers/**/*.coffee'
14
- dest: '.grunt'
15
- ext: '.js'
@@ -1,2 +0,0 @@
1
- class @<%= class_name %>Layout extends ApplicationLayout
2
- @view '<%= view_name %>'
@@ -1,4 +0,0 @@
1
- Joosy.namespace '<%= namespace_name %>', ->
2
-
3
- class @<%= class_name %>Layout extends ApplicationLayout
4
- @view '<%= view_name %>'
@@ -1,3 +0,0 @@
1
- class @<%= class_name %>Page extends ApplicationPage
2
- @layout ApplicationLayout
3
- @view '<%= view_name %>'
@@ -1,5 +0,0 @@
1
- Joosy.namespace '<%= namespace_name %>', ->
2
-
3
- class @<%= class_name %>Page extends ApplicationPage
4
- @layout ApplicationLayout
5
- @view '<%= view_name %>'
@@ -1,2 +0,0 @@
1
- class @<%= class_name %>Widget extends Joosy.Widget
2
- @view '<%= view_name %>'
@@ -1,4 +0,0 @@
1
- Joosy.namespace '<%= namespace_name %>', ->
2
-
3
- class @<%= class_name %>Widget extends Joosy.Widget
4
- @view '<%= view_name %>'
@@ -1,26 +0,0 @@
1
- @Base = require './base' if module?
2
-
3
- #
4
- # Possible options:
5
- #
6
- # name: name of widget including namespace (i.e. 'foo/bar/baz')
7
- #
8
- class Widget extends @Base
9
- generate: ->
10
- namespace = @getNamespace @options.name
11
- basename = @getBasename @options.name
12
- template = if namespace.length > 0 then 'namespaced' else 'basic'
13
-
14
- @template ['widget', "#{template}.coffee"], ['widgets', @join(namespace...), "#{basename}.coffee"],
15
- namespace_name: (@camelize(x) for x in namespace).join('.')
16
- class_name: @camelize(basename)
17
- view_name: basename
18
-
19
- @file ['templates', 'widgets', @join(namespace...), "#{basename}.jst.hamlc"]
20
-
21
- @actions
22
-
23
- if module?
24
- module.exports = Widget
25
- else
26
- @Generator = Widget
@@ -1,58 +0,0 @@
1
- Path = require 'path'
2
-
3
- module.exports = (grunt) ->
4
-
5
- grunt.registerTask 'testem:generate', ->
6
- unless @args[0]
7
- grunt.config.requires 'testem'
8
- return Object.each grunt.config.get('testem'), (key, value) ->
9
- grunt.task.run "testem:generate:#{key}"
10
-
11
- grunt.config.requires "testem.#{@args[0]}"
12
-
13
- coffee = []
14
- source = grunt.file.expand grunt.config.get("testem.#{@args[0]}.src")
15
-
16
- serve = source.map (name) ->
17
- if Path.extname(name) == '.coffee'
18
- destination = ".grunt/#{Path.dirname(name)}/#{Path.basename(name, '.coffee')}.js"
19
- coffee.push "coffee -o #{Path.dirname(destination)} -c #{name}"
20
- destination
21
- else
22
- name
23
-
24
- result =
25
- framework: 'jasmine',
26
- src_files: source
27
- serve_files: serve
28
- before_tests: 'grunt mince;'+coffee.join(';')
29
- launch_in_dev: ['PhantomJS'],
30
- launch_in_ci: ['PhantomJS', 'Chrome', 'Firefox', 'Safari', 'IE7', 'IE8', 'IE9']
31
-
32
- grunt.file.write "spec/#{@args[0]}.json", JSON.stringify(result, null, 2)
33
-
34
- grunt.registerTask 'testem:ci', ->
35
- unless @args[0]
36
- grunt.config.requires 'testem'
37
- return Object.each grunt.config.get('testem'), (key, value) ->
38
- grunt.task.run "testem:ci:#{key}"
39
-
40
- complete = @async()
41
-
42
- grunt.config.requires "testem.#{@args[0]}"
43
-
44
- command = "node_modules/.bin/testem"
45
- options = ['ci', '-f', "spec/#{@args[0]}.json", '-R', 'dot', '-P', '8']
46
-
47
- grunt.util.spawn {cmd: command, args: options, opts: {stdio: [0,1,2]}}, (error, result) ->
48
- grunt.fatal "Tests did not succed" if error
49
- complete()
50
-
51
- grunt.registerTask 'testem:run', ->
52
- complete = @async()
53
-
54
- command = "node_modules/.bin/testem"
55
- options = ['-f', "spec/#{@args[0]}.json"]
56
-
57
- grunt.util.spawn {cmd: command, args: options, opts: {stdio: [0,1,2]}}, (error, result) ->
58
- complete()