susanoo 0.5.1 → 0.7.0

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 (30) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.md +12 -1
  4. data/Susanoo.gemspec +1 -1
  5. data/TODO.org +3 -2
  6. data/lib/susanoo.rb +1 -0
  7. data/lib/susanoo/application.rb +10 -29
  8. data/lib/susanoo/cli/project.rb +61 -5
  9. data/lib/susanoo/controller.rb +14 -5
  10. data/lib/susanoo/controllers/assets.rb +52 -0
  11. data/lib/susanoo/controllers/index.rb +21 -0
  12. data/lib/susanoo/controllers/views.rb +40 -0
  13. data/lib/susanoo/generators/frameworks.rb +50 -90
  14. data/lib/susanoo/static_generator.rb +17 -0
  15. data/lib/susanoo/tasks.rb +19 -0
  16. data/lib/susanoo/tasks/assets.rake +18 -7
  17. data/lib/susanoo/templates/application/Gemfile +2 -1
  18. data/lib/susanoo/templates/application/{www → src}/assets/javascripts/app.js +1 -1
  19. data/lib/susanoo/templates/application/{www → src}/assets/javascripts/application.js +0 -0
  20. data/lib/susanoo/templates/application/{www → src}/assets/javascripts/functions.js +0 -0
  21. data/lib/susanoo/templates/application/{www → src}/assets/javascripts/lib/angular-ui-router.js +0 -0
  22. data/lib/susanoo/templates/application/{www → src}/assets/javascripts/main.js +6 -3
  23. data/lib/susanoo/templates/application/src/assets/javascripts/variables.js +5 -0
  24. data/lib/susanoo/templates/application/{www → src}/assets/stylesheets/application.css +0 -0
  25. data/lib/susanoo/templates/application/{www/assets/javascripts/variables.js → src/assets/stylesheets/main.scss} +0 -0
  26. data/lib/susanoo/templates/application/{www → src}/index.html.erb +0 -0
  27. data/lib/susanoo/templates/application/{www → src}/views/main.html +0 -0
  28. data/lib/susanoo/version.rb +1 -1
  29. metadata +20 -16
  30. data/lib/susanoo/templates/application/www/assets/stylesheets/main.scss +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 61ede15e1f796a77d1b652e51ed33d84814affe8
4
- data.tar.gz: 8e319a5828ecc3837b6d55190c037fc55c03b84f
3
+ metadata.gz: 661f149461e9268b41cc670cb3bbc67e308e133c
4
+ data.tar.gz: 5cd189689c98bbae35a5032c79ea9bee2c10dfa7
5
5
  SHA512:
6
- metadata.gz: 5a2445761b8d53871936746576fb72b3c5f04012b2c95ff537a6221333b39a4a265e104f1fb2fa466a0a94e4d60c48f248c6d43fcffff08132a998b95f99d6f1
7
- data.tar.gz: 9ba0397ef22abe8ea0f45466e23d05240e86bcf16ccae8ffdd1fdb5a96afd1e7aa8e1dd53d090dfb6cee376d577db4ab4058a1b8855ae6507fc713b048aaf748
6
+ metadata.gz: 3bba027e972ae9b506c33ad4225701dbe51165a2e9cbff76e6a492a2ee921caaa03f46e645daba42617b881140fef4bf59f55beea406728ec0f78417cded4863
7
+ data.tar.gz: a48dd5e7ff0864ce6d61d55f1829e9c20d346c293c7f46187b75f477463d3c58256d093db499e2df983c3be2f94e693882de1bf6e9961d4fde827f15089e3ae2
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ /**/.sass*/*
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Susanoo
2
2
 
3
- TODO: Write a gem description
3
+ Susanoo is meta framework to create and develop hybrid mobile applications. Using Susanoo you will work in an environment
4
+ which you already are familiar with specially if you are a ruby developer. Susanoo use Apache Cordova
4
5
 
5
6
  ## Installation
6
7
 
@@ -27,3 +28,13 @@ TODO: Write usage instructions here
27
28
  3. Commit your changes (`git commit -am 'Add some feature'`)
28
29
  4. Push to the branch (`git push origin my-new-feature`)
29
30
  5. Create new Pull Request
31
+
32
+ ## Credit
33
+ ![Yellowen](http://www.yellowen.com/images/logo.png)
34
+
35
+ **Susanoo** is maintained and funded by Yellowen. Whenever a code snippet is borrowed or inspired by existing code, we try to credit the original developer/designer in our source code. Let us know if you think we have missed to do this.
36
+
37
+
38
+ # License
39
+
40
+ **Susanoo** is Copyright © 2014 Yellowen. It is free software, and may be redistributed under the terms specified in the LICENSE file.
@@ -32,6 +32,6 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency 'yui-compressor', '~>0.9.6'
33
33
  spec.add_dependency 'sprockets', '~>2.11.0'
34
34
  spec.add_dependency 'sprockets-helpers'
35
- spec.add_dependency 'sass'
35
+ spec.add_dependency 'sass', '3.2.15'
36
36
  spec.add_dependency 'tilt'
37
37
  end
data/TODO.org CHANGED
@@ -1,5 +1,6 @@
1
1
  * Tasks
2
- ** TODO transfer changes from example app to main susanoo headline
3
- ** TODO Add .gitignore to new projects
2
+ ** DONE transfer changes from example app to main susanoo headline
3
+ ** DONE Add .gitignore to new projects
4
4
  ** TODO Add config.xml to templates
5
5
  ** TODO make title tag of index.html dynamic
6
+ ** TODO minify assets on build time.
@@ -10,6 +10,7 @@ require 'lotus/router'
10
10
  module Susanoo
11
11
  end
12
12
 
13
+ require 'susanoo/static_generator'
13
14
  require 'susanoo/controller'
14
15
  require 'susanoo/project'
15
16
  require 'susanoo/cli'
@@ -1,33 +1,14 @@
1
1
  require 'rack'
2
2
 
3
+ # This class contains basic controllers which is needed for Susanoo to
4
+ # work. Each controller should contains `call` and `build` instance methods.
5
+ # `call` is responsible to serving an http request base on **Rack** specification
6
+ # and `build` is responsible to create static files with suitable content. `build`
7
+ # method gets an argumant which is the generator object that calls build methods.
8
+ # `generator` is a **Thor** object so you can use **Thor::Actions** in your method.
3
9
  class Susanoo::Application
4
-
5
- class Index < Susanoo::Controller
6
- def call(env)
7
- template = Tilt.new(File.join(project_root, 'www/index.html.erb'))
8
- [200, {'Content-Type' => 'text/html'}, [template.render(self)]]
9
- end
10
- end
11
-
12
- class Assets < Susanoo::Controller
13
- def call(env)
14
- # [200, {'Content-Type' => 'text/html'}, [environment]]
15
- run environment
16
- end
17
- end
18
-
19
- class Views < Susanoo::Controller
20
- def call(env)
21
- path = env['PATH_INFO']
22
- if File.exist?(File.join(project_root, "www/views#{path}.erb"))
23
- template = Tilt.new(File.join(project_root, "www/views#{path}.erb"))
24
- elsif File.exist?(File.join(project_root, "www/views#{path}"))
25
- template = Tilt.new(File.join(project_root, "www/views#{path}"))
26
- else
27
- fail "There is no '#{path}' in 'www/views' directory."
28
- end
29
- [200, {'Content-Type' => 'text/html'}, [template.render(self)]]
30
- end
31
- end
32
-
33
10
  end
11
+
12
+ require 'susanoo/controllers/index'
13
+ require 'susanoo/controllers/views'
14
+ require 'susanoo/controllers/assets'
@@ -6,10 +6,13 @@ module Susanoo
6
6
  module CLI
7
7
  class Project < Thor
8
8
 
9
+ include ::Thor::Actions
10
+
9
11
  package_name 'Susanoo'
10
12
 
11
13
  map 's' => :server
12
14
  map 'g' => :generate
15
+ map 'r' => :run_in
13
16
 
14
17
  def self.root=(path)
15
18
  @@root = path
@@ -33,20 +36,73 @@ module Susanoo
33
36
  generator.start options
34
37
  end
35
38
 
36
- method_option :debug, default: false
39
+ method_option :debug, default: true
40
+ method_option :built, default: false
37
41
  desc 'server', 'Run development server.'
38
42
  def server(port = 3000)
39
43
  project_root = Susanoo::Project.path
44
+
45
+ if options[:built]
46
+ unless File.directory? File.join(project_root, 'www')
47
+ error "'www' directory is not present. Build you app first."
48
+ return
49
+ end
50
+
51
+ app = Rack::Directory.new File.join(project_root, 'www')
52
+
53
+ else
54
+ require File.join(project_root, 'config/routes')
55
+ # Set global debug flag
56
+ Susanoo::Project.debug = options[:debug]
57
+
58
+ app = ROUTER
59
+ end
60
+
61
+ Rack::Server.start(app: app, server: :thin, Port: port,
62
+ debug: options[:debug])
63
+ end
64
+
65
+ desc 'build', 'Build the application.'
66
+ def build
67
+ project_root = Susanoo::Project.path
68
+
40
69
  require File.join(project_root, 'config/routes')
41
70
 
42
- # Set global debug flag
43
- Susanoo::Project.debug = options[:debug]
71
+ build_dir = File.join(project_root, 'www')
72
+ # setup build directory
73
+
74
+ remove_file build_dir if File.exist? build_dir
75
+ # Create the www directory if there isn't
76
+ # WWW directory will be the build directory
77
+ # which will contains the static files.
78
+ #
79
+ # NOTE: cordova only uses this directory
80
+ # and we can't change it as far as I know
81
+ empty_directory build_dir
82
+
83
+ Susanoo::StaticGenerator.classes.each do |klass|
84
+ instance = klass.new
85
+ if instance.respond_to? :build
86
+ instance.build(self)
87
+ else
88
+ puts "[Warning]: '#{instance.class.to_s}' does not have 'build' method."
89
+ end
90
+ end
44
91
 
45
- app = Rack::Server.start(app: ROUTER, server: :thin, Port: port,
46
- debug: options[:debug])
92
+ end
93
+
94
+ desc 'run PLATFORM', 'Run application on PLATFORM.'
95
+ def run_in(platform = :android)
96
+ # Build the project first
97
+ build
98
+
99
+ inside Susanoo::Project.path do
100
+ system "cordova run #{platform.to_s}"
101
+ end
47
102
  end
48
103
 
49
104
  private
105
+ # Private ---------------------------
50
106
 
51
107
  def camelize(str)
52
108
  str.split("_").each {|s| s.capitalize! }.join("")
@@ -1,3 +1,6 @@
1
+ require 'thor'
2
+ require 'thor/actions'
3
+
1
4
  module Susanoo
2
5
  class Controller
3
6
 
@@ -14,13 +17,19 @@ module Susanoo
14
17
  env.logger = Logger.new(STDOUT)
15
18
  end
16
19
 
17
- @environment.append_path(File.join(@project_root, 'www', 'assets'))
18
- @environment.append_path(File.join(@project_root, 'www', 'assets', 'javascripts'))
19
- @environment.append_path(File.join(@project_root, 'www', 'assets', 'stylesheets'))
20
- @environment.append_path(File.join(@project_root, 'www', 'assets', 'images'))
21
- @environment.append_path(File.join(@project_root, 'www', 'assets', 'fonts'))
20
+ @environment.append_path(File.join(@project_root, 'src', 'assets'))
21
+ @environment.append_path(File.join(@project_root, 'src', 'assets', 'javascripts'))
22
+ @environment.append_path(File.join(@project_root, 'src', 'assets', 'stylesheets'))
23
+ @environment.append_path(File.join(@project_root, 'src', 'assets', 'images'))
24
+ @environment.append_path(File.join(@project_root, 'src', 'assets', 'fonts'))
25
+
26
+ Susanoo::StaticGenerator.register self.class
27
+ end
22
28
 
29
+ def static_compile?
30
+ @static_compile
23
31
  end
24
32
 
33
+
25
34
  end
26
35
  end
@@ -0,0 +1,52 @@
1
+ require 'rack'
2
+
3
+ class Susanoo::Application
4
+
5
+ # This controller is responsible for serving/building assets files
6
+ class Assets < Susanoo::Controller
7
+ def call(env)
8
+ # Environment is a sprockets environment instance
9
+ run environment
10
+ end
11
+
12
+ def build(generator)
13
+ assets = Sprockets::Environment.new
14
+ assets.append_path File.join(project_root,
15
+ 'src/assets/javascripts')
16
+ assets.append_path File.join(project_root,
17
+ 'src/assets/stylesheets')
18
+
19
+ require 'rake/sprocketstask'
20
+ require 'uglifier'
21
+ require 'yui/compressor'
22
+ require "#{project_root}/config/routes"
23
+
24
+ func = lambda do |path, filename|
25
+ filename !~ %r~assets~ && !%w[.js .css].include?(File.extname(path))
26
+ end
27
+
28
+ precompile = [func, /(?:\/|\\|\A)application\.(css|js)$/]
29
+ assets.each_logical_path(*precompile).each {|path|
30
+ case File.extname(path)
31
+ when '.js'
32
+ dir = 'javascripts'
33
+ when '.css'
34
+ dir = 'stylesheets'
35
+ end
36
+ assets[path].write_to "www/assets/#{dir}/#{path}"
37
+ }
38
+
39
+ if File.exist? File.join(project_root,
40
+ 'src/assets/images')
41
+ generator.say_status 'copy', 'src/assets/images'
42
+ `cp #{project_root}/src/assets/images #{project_root}/www/assets/images`
43
+ end
44
+
45
+ if File.exist? File.join(project_root,
46
+ 'src/assets/fonts')
47
+ generator.say_status 'copy', 'src/assets/fonts'
48
+ `cp #{project_root}/src/assets/fonts #{project_root}/www/assets/fonts`
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,21 @@
1
+ require 'rack'
2
+
3
+ class Susanoo::Application
4
+
5
+ # This controller is responsible for serving/building index.html file.
6
+ class Index < Susanoo::Controller
7
+ def call(env)
8
+ # Tilt template object
9
+ template = Tilt.new(File.join(project_root, 'src/index.html.erb'))
10
+ [200, {'Content-Type' => 'text/html'}, [template.render(self)]]
11
+ end
12
+
13
+ def build(generator)
14
+ template = Tilt.new(File.join(project_root, 'src/index.html.erb'))
15
+ data = template.render(self)
16
+ # God forgive me for hard coding this part
17
+ generator.create_file 'www/index.html', data
18
+ end
19
+ end
20
+
21
+ end
@@ -0,0 +1,40 @@
1
+ require 'rack'
2
+
3
+ class Susanoo::Application
4
+ # This controller is responsible to serving/building angularjs templates.
5
+ class Views < Susanoo::Controller
6
+ def call(env)
7
+ path = env['PATH_INFO']
8
+ if File.exist?(File.join(project_root, "src/views#{path}.erb"))
9
+ template = Tilt.new(File.join(project_root, "src/views#{path}.erb"))
10
+ elsif File.exist?(File.join(project_root, "src/views#{path}"))
11
+ template = Tilt.new(File.join(project_root, "src/views#{path}"))
12
+ else
13
+ fail "There is no '#{path}' in 'src/views' directory."
14
+ end
15
+ [200, {'Content-Type' => 'text/html'}, [template.render(self)]]
16
+ end
17
+
18
+ def build(generator)
19
+ file_pattern = File.join(project_root, 'src/views/**/*.{html,html.erb}')
20
+ dest_path = File.join(project_root, 'www')
21
+ src_path = File.join(project_root, 'src')
22
+
23
+ Dir.glob(file_pattern) do |file|
24
+ template = Tilt.new file
25
+
26
+ dest_file = File.join(dest_path,
27
+ file.gsub(src_path, ''))
28
+
29
+ # Create missing directories in destination path
30
+ FileUtils.mkpath dest_path
31
+
32
+ # Remove erb extension name from destination path
33
+ dest_file.gsub!('.erb', '') if File.extname(dest_file) == 'erb'
34
+
35
+ # Create the destination file
36
+ generator.create_file dest_file, template.render(self)
37
+ end
38
+ end
39
+ end
40
+ end
@@ -5,128 +5,96 @@ module Susanoo
5
5
  source_root File.expand_path('../../templates/application', __FILE__)
6
6
 
7
7
  @@bower_data = {
8
- :name => "",
8
+ :name => 'temp_name',
9
9
  :dependencies => {
10
10
  # TODO: Set this to new version of angular
11
- angular: "1.2.9",
12
- "angular-touch" => "*",
13
- "angular-gestures" => "*",
14
- "angular-route" => "*",
15
- "angular-animate" => "*",
16
- "angular-sanitize" => "*",
17
- "angular-resource" => "*",
18
- "angular-gettext" => "*",
19
- "jquery" => "*",
20
- "lodash" => "*",
11
+ angular: '1.2.9',
12
+ 'angular-touch' => '*',
13
+ 'angular-gestures' => '*',
14
+ 'angular-route' => '*',
15
+ 'angular-animate' => '*',
16
+ 'angular-sanitize' => '*',
17
+ 'angular-resource' => '*',
18
+ 'angular-gettext' => '*',
19
+ 'jquery' => '*',
20
+ 'lodash' => '*',
21
21
  },
22
22
  }
23
23
 
24
- @@js_files = ["jquery/dist/jquery",
25
- "lodash/dist/lodash",
26
- "angular/angular",
27
- "angular-animate/angular-animate",
28
- "angular-route/angular-route",
29
- "angular-sanitize/angular-sanitize",
30
- "angular-touch/angular-touch",
31
- "angular-gestures/gestures",
32
- "angular-gettext/dist/angular-gettext",
33
- "angular-resource/angular-resource",
24
+ @@js_files = ['jquery/dist/jquery',
25
+ 'lodash/dist/lodash',
26
+ 'angular/angular',
27
+ 'angular-animate/angular-animate',
28
+ 'angular-route/angular-route',
29
+ 'angular-sanitize/angular-sanitize',
30
+ 'angular-touch/angular-touch',
31
+ 'angular-gestures/gestures',
32
+ 'angular-gettext/dist/angular-gettext',
33
+ 'angular-resource/angular-resource',
34
34
  ]
35
35
  @@js_dirs = []
36
36
  @@css_files = []
37
37
  @@css_dirs = []
38
38
 
39
- @@is_foundation = false
40
- @@is_ionic = false
41
-
42
39
  def susanoo_files
43
- template "Gemfile", "#{Susanoo::Project.folder_name}/Gemfile"
44
- template "Rakefile", "#{Susanoo::Project.folder_name}/Rakefile"
45
- directory "config", "#{Susanoo::Project.folder_name}/config"
46
- template ".gitignore", "#{Susanoo::Project.folder_name}/.gitignore"
47
- template "bin/susanoo", "#{Susanoo::Project.folder_name}/bin/susanoo"
48
- end
49
-
50
- def ask_for_framework
51
- @@bower_data[:name] = Susanoo::Project.folder_name
52
-
53
- if yes? "Do you need Zurb Foundation? (y/n)"
54
- # installing Zurb Foundation
55
- @@bower_data[:dependencies][:foundation] = "*"
56
-
57
- @@css_dirs << "foundation/scss"
58
- @@js_files.unshift "modernizr/modernizr"
59
- @@js_files.unshift "foundation/js/foundation"
60
- @@js_dirs << "foundation/js/foundation"
61
- @@is_foundation = true
62
- return
63
- end
64
-
65
- if yes? "What about ionic framework? (y/n)"
66
- # Install ionic framework
67
- @@bower_data[:dependencies][:ionic] = "*"
68
- @@js_files.unshift "ionic/dist/js/ionic"
69
- @@js_files << "angular-ui-router"
70
- @@js_files << "ionic/dist/js/ionic-angular"
71
- @@css_dirs.concat(["ionic/scss"])
72
- # Unfortunately angular-ui-router bower package did not provide current
73
- # So we have to install it manually
74
- template "www/assets/javascripts/lib/angular-ui-router.js", "#{Susanoo::Project.folder_name}/www/assets/javascripts/lib/angular-ui-router.js"
75
- @@is_ionic = true
76
- end
40
+ template 'Gemfile', "#{Susanoo::Project.folder_name}/Gemfile"
41
+ template 'Rakefile', "#{Susanoo::Project.folder_name}/Rakefile"
42
+ directory 'config', "#{Susanoo::Project.folder_name}/config"
43
+ template '.gitignore', "#{Susanoo::Project.folder_name}/.gitignore"
44
+ template 'bin/susanoo', "#{Susanoo::Project.folder_name}/bin/susanoo"
77
45
  end
78
46
 
79
47
  def bower_install
80
- require "json"
48
+ require 'json'
81
49
  inside Susanoo::Project.folder_name do
82
- inside "www" do
83
- create_file "bower.json" do
50
+ inside 'src' do
51
+ create_file 'bower.json' do
84
52
  JSON.pretty_generate(@@bower_data)
85
53
  end
86
- system "bower install"
54
+ system 'bower install'
87
55
  end
88
56
  end
89
57
  end
90
58
 
91
59
  def install_templates
92
- copy_file "www/index.html.erb", "#{Susanoo::Project.folder_name}/www/index.html.erb"
93
- template "www/views/main.html", "#{Susanoo::Project.folder_name}/www/views/main.html"
94
- template "www/assets/javascripts/application.js", "#{Susanoo::Project.folder_name}/www/assets/javascripts/application.js"
95
- template "www/assets/javascripts/functions.js", "#{Susanoo::Project.folder_name}/www/assets/javascripts/functions.js"
96
- template "www/assets/javascripts/variables.js", "#{Susanoo::Project.folder_name}/www/assets/javascripts/variables.js"
97
-
98
- create_file "#{Susanoo::Project.folder_name}/www/assets/javascripts/modules/.keep" do
99
- " "
60
+ copy_file 'src/index.html.erb', "#{Susanoo::Project.folder_name}/src/index.html.erb"
61
+ template 'src/views/main.html', "#{Susanoo::Project.folder_name}/src/views/main.html"
62
+ template 'src/assets/javascripts/application.js', "#{Susanoo::Project.folder_name}/src/assets/javascripts/application.js"
63
+ template 'src/assets/javascripts/functions.js', "#{Susanoo::Project.folder_name}/src/assets/javascripts/functions.js"
64
+ copy_file 'src/assets/javascripts/variables.js', "#{Susanoo::Project.folder_name}/src/assets/javascripts/variables.js.erb"
65
+
66
+ create_file "#{Susanoo::Project.folder_name}/src/assets/javascripts/modules/.keep" do
67
+ ' '
100
68
  end
101
- template "www/assets/javascripts/app.js", "#{Susanoo::Project.folder_name}/www/assets/javascripts/app.js"
102
- template "www/assets/javascripts/main.js", "#{Susanoo::Project.folder_name}/www/assets/javascripts/main.js"
103
- template "www/assets/stylesheets/application.css", "#{Susanoo::Project.folder_name}/www/assets/stylesheets/application.css"
104
- template "www/assets/stylesheets/main.scss", "#{Susanoo::Project.folder_name}/www/assets/stylesheets/main.scss"
69
+ template 'src/assets/javascripts/app.js', "#{Susanoo::Project.folder_name}/src/assets/javascripts/app.js"
70
+ template 'src/assets/javascripts/main.js', "#{Susanoo::Project.folder_name}/src/assets/javascripts/main.js"
71
+ template 'src/assets/stylesheets/application.css', "#{Susanoo::Project.folder_name}/src/assets/stylesheets/application.css"
72
+ template 'src/assets/stylesheets/main.scss', "#{Susanoo::Project.folder_name}/src/assets/stylesheets/main.scss"
105
73
 
106
- @source_paths << File.expand_path("#{Susanoo::Project.folder_name}/www/bower_components/")
74
+ @source_paths << File.expand_path("#{Susanoo::Project.folder_name}/src/bower_components/")
107
75
  @@js_files.each do |file|
108
- unless file == "angular-ui-router"
109
- copy_file "#{file}.js", "#{Susanoo::Project.folder_name}/www/assets/javascripts/lib/#{file}.js"
76
+ unless file == 'angular-ui-router'
77
+ copy_file "#{file}.js", "#{Susanoo::Project.folder_name}/src/assets/javascripts/lib/#{file}.js"
110
78
  end
111
79
  end
112
80
 
113
81
  @@js_dirs.each do |dir|
114
- directory dir, "#{Susanoo::Project.folder_name}/www/assets/javascripts/lib/#{dir}"
82
+ directory dir, "#{Susanoo::Project.folder_name}/src/assets/javascripts/lib/#{dir}"
115
83
  end
116
84
 
117
85
  @@css_files.each do |file|
118
- copy_file "#{file}.scss", "#{Susanoo::Project.folder_name}/www/assets/stylesheets/lib/#{file}.scss"
86
+ copy_file "#{file}.scss", "#{Susanoo::Project.folder_name}/src/assets/stylesheets/lib/#{file}.scss"
119
87
  end
120
88
 
121
89
  @@css_dirs.each do |dir|
122
- directory dir, "#{Susanoo::Project.folder_name}/www/assets/stylesheets/lib/#{dir}"
90
+ directory dir, "#{Susanoo::Project.folder_name}/src/assets/stylesheets/lib/#{dir}"
123
91
  end
124
92
 
125
93
  end
126
94
 
127
95
  def remove_temp
128
- if yes? "Do want to remove unneccessary files? (y/n)".colorize(:red)
129
- remove_dir "#{Susanoo::Project.folder_name}/www/bower_components"
96
+ if yes? 'Do want to remove unneccessary files? (y/n)'.colorize(:red)
97
+ remove_dir "#{Susanoo::Project.folder_name}/src/bower_components"
130
98
  end
131
99
  end
132
100
 
@@ -136,18 +104,10 @@ module Susanoo
136
104
 
137
105
  private
138
106
 
139
- def is_foundation?
140
- @@is_foundation
141
- end
142
-
143
107
  def js_dirs
144
108
  @@js_dirs
145
109
  end
146
110
 
147
- def is_ionic?
148
- @@is_ionic
149
- end
150
-
151
111
  def js_files
152
112
  @@js_files
153
113
  end
@@ -0,0 +1,17 @@
1
+ require 'set'
2
+
3
+ module Susanoo
4
+ class StaticGenerator
5
+
6
+ @@classes = Set.new
7
+
8
+ def self.register(klass)
9
+ @@classes << klass
10
+ end
11
+
12
+ def self.classes
13
+ @@classes.to_a
14
+ end
15
+
16
+ end
17
+ end
@@ -8,3 +8,22 @@ module Susanoo
8
8
  end
9
9
  end
10
10
  end
11
+
12
+ require 'rake'
13
+ require 'rake/sprocketstask'
14
+ require 'uglifier'
15
+ require 'yui/compressor'
16
+
17
+ assets = Sprockets::Environment.new
18
+ assets.append_path File.join(Dir.pwd,
19
+ 'src/assets/javascripts')
20
+ assets.append_path File.join(Dir.pwd,
21
+ 'src/assets/stylesheets')
22
+
23
+ Rake::SprocketsTask.new do |t|
24
+ t.environment = assets
25
+ t.output = File.join(Dir.pwd, 'www/assets/')
26
+ t.assets = %w(application.css application.js)
27
+ t.environment.css_compressor = YUI::CssCompressor.new
28
+ t.environment.js_compressor = Uglifier.new(:mangle => true)
29
+ end.define
@@ -3,23 +3,34 @@ require "bundler/setup"
3
3
  Bundler.require
4
4
 
5
5
  desc "Compile assets into statics folder"
6
- task :assets do
6
+ task :assets1 do
7
7
  require "sprockets"
8
8
  #require "rake/sprocketstask"
9
9
 
10
10
  assets = Sprockets::Environment.new
11
- assets.append_path "www/assets/javascripts"
12
- assets.append_path "www/assets/stylesheets"
11
+ assets.append_path "src/assets/javascripts"
12
+ assets.append_path "src/assets/stylesheets"
13
13
 
14
- Susanoo::Assets.path = ""
14
+ #Susanoo::Assets.path = ""
15
15
  LOOSE_APP_ASSETS = lambda do |path, filename|
16
+ puts ">>>>>>>>>>>>>>>>>>>> ", filename, filename !~ %r~assets~ && !%w[.js .css].include?(File.extname(path))
16
17
  filename !~ %r~assets~ && !%w[.js .css].include?(File.extname(path))
17
18
  end
19
+ puts ">>>>>"
18
20
  precompile = [LOOSE_APP_ASSETS, /(?:\/|\\|\A)application\.(css|js)$/]
19
21
  assets.each_logical_path(*precompile).each {|path|
20
- assets[path].write_to "www/statics/#{path}"
22
+ puts "<$$$$$$ ", File.extname(path)
23
+ dir = ''
24
+ case File.extname(path)
25
+ when '.js'
26
+ dir = 'javascripts'
27
+ when '.css'
28
+ dir = 'stylesheets'
29
+ end
30
+ puts "<<<<<<<<<<<<<<<< ", dir
31
+ assets[path].write_to "www/assets/#{dir}/#{path}"
21
32
  }
22
33
 
23
- system "cp www/assets/images www/statics/images -rv"
24
- system "cp www/assets/fonts www/statics/fonts -rv"
34
+ #system "cp www/assets/images www/statics/images -rv"
35
+ #system "cp www/assets/fonts www/statics/fonts -rv"
25
36
  end
@@ -1,6 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'susanoo', '~>0.5.0', path: '/home/lxsameer/src/Yellowen/Susanoo'
3
+ gem 'susanoo'
4
4
  gem 'pry'
5
5
  gem 'rerun'
6
6
  gem 'rack'
7
+ gem 'rake'
@@ -1,7 +1,7 @@
1
1
  // Main Application Module
2
2
  // -----------------------
3
3
  // This module is the start point of application.
4
- var App = angular.module("Application", ["ngTouch", "ngAnimate", "ngRoute", "gettext", "angular-gestures"<% if is_ionic? %>, "ionic"<% end %>]);
4
+ var App = angular.module("Application", ["ngTouch", "ngAnimate", "ngRoute", "gettext", "angular-gestures"]);
5
5
 
6
6
  // configuration section ---------------------------
7
7
  App.config(["$routeProvider", function($routeProvider){
@@ -4,9 +4,12 @@ document.addEventListener("deviceready", onDeviceReady, false);
4
4
 
5
5
  // Device Ready event handler
6
6
  function onDeviceReady() {
7
- <% if is_foundation? %>
8
- $(document).foundation();
9
- <% end %>
10
7
  // Bootstrap and run angular application
11
8
  angular.bootstrap(document, ["Application"]);
12
9
  }
10
+ $(function(){
11
+ if (window.debug === true) {
12
+ console.log("Run in debug mode.");
13
+ onDeviceReady();
14
+ }
15
+ });
@@ -0,0 +1,5 @@
1
+ <% if Susanoo::Project.debug %>
2
+ window.debug = true;
3
+ <% else %>
4
+ window.debug = false;
5
+ <% end %>
@@ -1,3 +1,3 @@
1
1
  module Susanoo
2
- VERSION = "0.5.1"
2
+ VERSION = '0.7.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: susanoo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sameer Rahmani
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-24 00:00:00.000000000 Z
11
+ date: 2014-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -196,16 +196,16 @@ dependencies:
196
196
  name: sass
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
- - - ">="
199
+ - - '='
200
200
  - !ruby/object:Gem::Version
201
- version: '0'
201
+ version: 3.2.15
202
202
  type: :runtime
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
- - - ">="
206
+ - - '='
207
207
  - !ruby/object:Gem::Version
208
- version: '0'
208
+ version: 3.2.15
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: tilt
211
211
  requirement: !ruby/object:Gem::Requirement
@@ -243,12 +243,16 @@ files:
243
243
  - lib/susanoo/cli/global.rb
244
244
  - lib/susanoo/cli/project.rb
245
245
  - lib/susanoo/controller.rb
246
+ - lib/susanoo/controllers/assets.rb
247
+ - lib/susanoo/controllers/index.rb
248
+ - lib/susanoo/controllers/views.rb
246
249
  - lib/susanoo/generators.rb
247
250
  - lib/susanoo/generators/cordova.rb
248
251
  - lib/susanoo/generators/frameworks.rb
249
252
  - lib/susanoo/generators/ng_module.rb
250
253
  - lib/susanoo/generators/scaffold.rb
251
254
  - lib/susanoo/project.rb
255
+ - lib/susanoo/static_generator.rb
252
256
  - lib/susanoo/tasks.rb
253
257
  - lib/susanoo/tasks/assets.rake
254
258
  - lib/susanoo/tasks/compile.rake
@@ -259,16 +263,16 @@ files:
259
263
  - lib/susanoo/templates/application/Rakefile
260
264
  - lib/susanoo/templates/application/bin/susanoo
261
265
  - lib/susanoo/templates/application/config/routes.rb
262
- - lib/susanoo/templates/application/www/assets/javascripts/app.js
263
- - lib/susanoo/templates/application/www/assets/javascripts/application.js
264
- - lib/susanoo/templates/application/www/assets/javascripts/functions.js
265
- - lib/susanoo/templates/application/www/assets/javascripts/lib/angular-ui-router.js
266
- - lib/susanoo/templates/application/www/assets/javascripts/main.js
267
- - lib/susanoo/templates/application/www/assets/javascripts/variables.js
268
- - lib/susanoo/templates/application/www/assets/stylesheets/application.css
269
- - lib/susanoo/templates/application/www/assets/stylesheets/main.scss
270
- - lib/susanoo/templates/application/www/index.html.erb
271
- - lib/susanoo/templates/application/www/views/main.html
266
+ - lib/susanoo/templates/application/src/assets/javascripts/app.js
267
+ - lib/susanoo/templates/application/src/assets/javascripts/application.js
268
+ - lib/susanoo/templates/application/src/assets/javascripts/functions.js
269
+ - lib/susanoo/templates/application/src/assets/javascripts/lib/angular-ui-router.js
270
+ - lib/susanoo/templates/application/src/assets/javascripts/main.js
271
+ - lib/susanoo/templates/application/src/assets/javascripts/variables.js
272
+ - lib/susanoo/templates/application/src/assets/stylesheets/application.css
273
+ - lib/susanoo/templates/application/src/assets/stylesheets/main.scss
274
+ - lib/susanoo/templates/application/src/index.html.erb
275
+ - lib/susanoo/templates/application/src/views/main.html
272
276
  - lib/susanoo/version.rb
273
277
  homepage: http://github.com/lxsameer/Susanoo
274
278
  licenses:
@@ -1,6 +0,0 @@
1
- <% if is_ionic? %>
2
- @import "lib/ionic/scss/ionic";
3
- <% end %>
4
- <% if is_foundation? %>
5
- @import "lib/foundation/scss/foundation";
6
- <% end %>