susanoo 0.1.0 → 0.4.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 (34) hide show
  1. checksums.yaml +4 -4
  2. data/Susanoo.gemspec +1 -1
  3. data/TODO.org +3 -0
  4. data/bin/susanoo +3 -5
  5. data/lib/susanoo.rb +8 -0
  6. data/lib/susanoo/cli.rb +47 -0
  7. data/lib/susanoo/cli/global.rb +19 -0
  8. data/lib/susanoo/cli/project.rb +105 -0
  9. data/lib/susanoo/generators.rb +9 -0
  10. data/lib/{Susanoo → susanoo}/generators/cordova.rb +4 -0
  11. data/lib/{Susanoo → susanoo}/generators/frameworks.rb +18 -1
  12. data/lib/susanoo/generators/ng_module.rb +19 -0
  13. data/lib/susanoo/generators/scaffold.rb +20 -0
  14. data/lib/{Susanoo → susanoo}/project.rb +1 -0
  15. data/lib/{Susanoo → susanoo}/tasks.rb +0 -0
  16. data/lib/{Susanoo → susanoo}/tasks/compile.rake +0 -0
  17. data/lib/{Susanoo/templates → susanoo/templates/application}/Gemfile +0 -0
  18. data/lib/{Susanoo/templates → susanoo/templates/application}/Rakefile +0 -0
  19. data/lib/susanoo/templates/application/bin/susanoo +8 -0
  20. data/lib/{Susanoo/templates → susanoo/templates/application}/config.ru +0 -0
  21. data/lib/{Susanoo/templates → susanoo/templates/application}/www/assets/javascripts/app.js +0 -0
  22. data/lib/{Susanoo/templates → susanoo/templates/application}/www/assets/javascripts/application.js +3 -0
  23. data/lib/susanoo/templates/application/www/assets/javascripts/functions.js +6 -0
  24. data/lib/{Susanoo/templates → susanoo/templates/application}/www/assets/javascripts/main.js +0 -0
  25. data/lib/susanoo/templates/application/www/assets/javascripts/variables.js +0 -0
  26. data/lib/{Susanoo/templates → susanoo/templates/application}/www/assets/stylesheets/application.css +0 -0
  27. data/lib/{Susanoo/templates → susanoo/templates/application}/www/assets/stylesheets/main.scss +0 -0
  28. data/lib/{Susanoo/templates → susanoo/templates/application}/www/index.html +0 -0
  29. data/lib/susanoo/version.rb +3 -0
  30. metadata +28 -20
  31. data/lib/Susanoo.rb +0 -8
  32. data/lib/Susanoo/cli.rb +0 -56
  33. data/lib/Susanoo/generators.rb +0 -7
  34. data/lib/Susanoo/version.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a96a120a022cd4f3f11fcf0bf2a3f4c7dc3b5c24
4
- data.tar.gz: a7134c440952acc410209580eda2860280a55a8a
3
+ metadata.gz: cea3a001f96e2e5c895481f0cd45480e1eacb657
4
+ data.tar.gz: ce9a4a01a59b2a3804c13e28991ff1baf6fc4609
5
5
  SHA512:
6
- metadata.gz: 3524d573f04af28ad03fd2c8f6702a3eb9d35e49f9be1a1de7db3bdaea82c8c17008bf88fc02c5a5157ecc419ee7217ac7f756c49b3ff9b8a130563c8f04a024
7
- data.tar.gz: bfa32d4b41c8af0e0a41c0619b89a629feb64954c761be0d637a8dc7d0997d3b65b30dc3195d7b284cd60ca12fbe62f0c3cc8a4bcad106909a4dc7685a6e5325
6
+ metadata.gz: 93658ba6ca437bce4a6fc3312f64c4cf97ddf3e56242341520e7f41433fed7f22c342fa81685c6029e6b24bb84de3e87b99130d25e6ef95bc4a8a6fddc4039ab
7
+ data.tar.gz: 5d47d0fe406d3d0eeb9c588ba6046963547237081ce4db9dff2e3b502852a11282bb34e4fb0b425f2c4503d0eebddd342b0d8f386281d4f4fdbf81da771d62ac
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'Susanoo/version'
4
+ require 'susanoo/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "susanoo"
@@ -0,0 +1,3 @@
1
+ * Tasks
2
+ ** TODO transfer changes from example app to main susanoo headline
3
+ ** TODO Add .gitignore to new projects
@@ -2,9 +2,7 @@
2
2
 
3
3
 
4
4
  lib = File.expand_path('../../lib', __FILE__)
5
- $LOAD_PATH << lib
5
+ $LOAD_PATH.unshift lib
6
6
 
7
- require "thor"
8
- require 'Susanoo'
9
-
10
- Susanoo::Cli.start
7
+ require 'susanoo'
8
+ Susanoo::CLI.run
@@ -0,0 +1,8 @@
1
+ require "susanoo/version"
2
+ require "colorize"
3
+
4
+ module Susanoo
5
+ end
6
+
7
+ require "susanoo/project"
8
+ require "susanoo/cli"
@@ -0,0 +1,47 @@
1
+ require "pathname"
2
+ require "susanoo/cli/global"
3
+ require "susanoo/cli/project"
4
+
5
+
6
+ module Susanoo
7
+ module CLI
8
+
9
+ EXEC_FILES = ["bin/susanoo"]
10
+
11
+ def self.run
12
+ unless execute
13
+ Susanoo::CLI::Global.start
14
+ end
15
+ end
16
+
17
+ def self.execute
18
+ cwd = Dir.pwd
19
+
20
+ loop do
21
+ # Find an executable in bin/susanoo
22
+ # In other word are we in an susanoo project or not?
23
+ if exec_file = find_executable
24
+
25
+ # Inject path
26
+ inject_dev_path
27
+ exec Gem.ruby, exec_file, *ARGV
28
+ break
29
+ end
30
+
31
+ Dir.chdir(cwd) and return false if Pathname.new(Dir.pwd).root?
32
+ Dir.chdir("../")
33
+ end
34
+ end
35
+
36
+ def self.inject_dev_path
37
+ if File.exist? File.expand_path("../../../.git", __FILE__)
38
+ ENV["SUSANOO_HOME"] = File.expand_path("../../", __FILE__)
39
+ end
40
+ end
41
+
42
+ def self.find_executable
43
+ EXEC_FILES.find { |exe| File.file?(exe) }
44
+ end
45
+
46
+ end
47
+ end
@@ -0,0 +1,19 @@
1
+ require 'thor'
2
+ require 'susanoo/generators'
3
+
4
+
5
+ module Susanoo
6
+ module CLI
7
+ class Global < Thor
8
+
9
+ desc "new PROJECT", "Create a new Susanoo/Cordova project"
10
+ def new(name)
11
+ Susanoo::Project.folder_name = name
12
+ Susanoo::Generators::Cordova.start
13
+
14
+ Susanoo::Generators::Frameworks.start
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,105 @@
1
+ require 'thor'
2
+ require 'susanoo/generators'
3
+
4
+
5
+ module Susanoo
6
+ module CLI
7
+ class Project < Thor
8
+
9
+ package_name "Susanoo"
10
+
11
+ def self.root=(path)
12
+ @@root = path
13
+ Susanoo::Project.path = path
14
+ end
15
+
16
+ method_option :aliases => "g"
17
+ desc "generate GENERATOR [options]", "Run the given generator"
18
+ def generate(generator_name=nil, *options)
19
+ if generator_name.nil?
20
+ print_generator_list
21
+ return
22
+ end
23
+
24
+ begin
25
+ generator = Susanoo::Generators.const_get(camelize(generator_name.downcase))
26
+ rescue NameError
27
+ print "[Error]:".colorize(:red)
28
+ say "Generator `#{generator}` not found."
29
+ exit 1
30
+ end
31
+ generator.start options
32
+ end
33
+
34
+ desc "server", "Run development server."
35
+ def server(port=6000)
36
+ require 'sprockets'
37
+ require 'rack'
38
+ requireh 'rack/rewrite'
39
+
40
+ root = Dir.getwd
41
+ #Rack::Handler::WEBrick.run :Port => 3000, :DocumentRoot => root
42
+ server = Rack::Builder.app do
43
+ map "/statics" do
44
+ project_root = Dir.getwd
45
+
46
+ assets = Sprockets::Environment.new(project_root) do |env|
47
+ env.logger = Logger.new(STDOUT)
48
+ end
49
+
50
+ assets.append_path(File.join(project_root, 'www', 'assets'))
51
+ assets.append_path(File.join(project_root, 'www', 'assets', 'javascripts'))
52
+ assets.append_path(File.join(project_root, 'www', 'assets', 'stylesheets'))
53
+ assets.append_path(File.join(project_root, 'www', 'assets', 'images'))
54
+
55
+ run assets
56
+ end
57
+
58
+ map "/" do
59
+ use Rack::Static, :urls => [""], :index => "index.html"
60
+ run lambda { |env|
61
+ [
62
+ 200,
63
+ {
64
+ 'Content-Type' => 'text/html',
65
+ 'Cache-Control' => 'public, max-age=86400'
66
+ },
67
+ File.open('www/index.html', File::RDONLY)
68
+ ]
69
+ }
70
+ end
71
+ end
72
+ Rack::Handler::WEBrick.run(server, Port: port)
73
+ end
74
+
75
+ private
76
+
77
+ def camelize(str)
78
+ str.split("_").each {|s| s.capitalize! }.join("")
79
+ end
80
+
81
+ def underscore(str)
82
+ str.gsub(/::/, '/').
83
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
84
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
85
+ tr("-", "_").
86
+ downcase
87
+ end
88
+
89
+ def print_generator_list
90
+ say "Available generators:"
91
+ say "---------------------------------------------------"
92
+ Susanoo::Generators.constants.each do |g|
93
+ generator = Susanoo::Generators.const_get(g)
94
+
95
+ unless generator.is_global_generator?
96
+ generator_name = underscore(generator.to_s.split("::").last)
97
+ say "#{generator_name}\t\t #{generator.desc}\n"
98
+ end
99
+
100
+ end
101
+
102
+ end
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,9 @@
1
+ module Susanoo
2
+ module Generators
3
+ end
4
+ end
5
+
6
+ require 'susanoo/generators/cordova'
7
+ require 'susanoo/generators/frameworks'
8
+ require 'susanoo/generators/scaffold'
9
+ require 'susanoo/generators/ng_module'
@@ -48,6 +48,10 @@ module Susanoo
48
48
  end
49
49
  end
50
50
 
51
+ def self.is_global_generator?
52
+ true
53
+ end
54
+
51
55
  private
52
56
 
53
57
  def version
@@ -2,7 +2,7 @@ module Susanoo
2
2
  module Generators
3
3
  class Frameworks < Thor::Group
4
4
  include Thor::Actions
5
- source_root File.expand_path('../../templates', __FILE__)
5
+ source_root File.expand_path('../../templates/application', __FILE__)
6
6
 
7
7
  @@bower_data = {
8
8
  :name => "",
@@ -15,6 +15,7 @@ module Susanoo
15
15
  "angular-animate" => "*",
16
16
  "angular-sanitize" => "*",
17
17
  "angular-resource" => "*",
18
+ "angular-gettext" => "*",
18
19
  "jquery" => "*",
19
20
  "lodash" => "*",
20
21
  },
@@ -28,6 +29,7 @@ module Susanoo
28
29
  "angular-sanitize/angular-sanitize",
29
30
  "angular-touch/angular-touch",
30
31
  "angular-gestures/gestures",
32
+ "angular-gettext/dist/angular-gettext",
31
33
  "angular-resource/angular-resource",
32
34
  ]
33
35
  @@js_dirs = []
@@ -41,6 +43,7 @@ module Susanoo
41
43
  template "Gemfile", "#{Susanoo::Project.folder_name}/Gemfile"
42
44
  template "Rakefile", "#{Susanoo::Project.folder_name}/Rakefile"
43
45
  template "config.ru", "#{Susanoo::Project.folder_name}/config.ru"
46
+ template "bin/susanoo", "#{Susanoo::Project.folder_name}/bin/susanoo"
44
47
  end
45
48
 
46
49
  def ask_for_framework
@@ -84,7 +87,16 @@ module Susanoo
84
87
 
85
88
  def install_templates
86
89
  template "www/index.html", "#{Susanoo::Project.folder_name}/www/index.html"
90
+ create_file "#{Susanoo::Project.folder_name}/www/views/.keep" do
91
+ " "
92
+ end
87
93
  template "www/assets/javascripts/application.js", "#{Susanoo::Project.folder_name}/www/assets/javascripts/application.js"
94
+ template "www/assets/javascripts/functions.js", "#{Susanoo::Project.folder_name}/www/assets/javascripts/functions.js"
95
+ template "www/assets/javascripts/variables.js", "#{Susanoo::Project.folder_name}/www/assets/javascripts/variables.js"
96
+
97
+ create_file "#{Susanoo::Project.folder_name}/www/assets/javascripts/modules/.keep" do
98
+ " "
99
+ end
88
100
  template "www/assets/javascripts/app.js", "#{Susanoo::Project.folder_name}/www/assets/javascripts/app.js"
89
101
  template "www/assets/javascripts/main.js", "#{Susanoo::Project.folder_name}/www/assets/javascripts/main.js"
90
102
  template "www/assets/stylesheets/application.css", "#{Susanoo::Project.folder_name}/www/assets/stylesheets/application.css"
@@ -115,6 +127,11 @@ module Susanoo
115
127
  remove_dir "#{Susanoo::Project.folder_name}/www/bower_components"
116
128
  end
117
129
  end
130
+
131
+ def self.is_global_generator?
132
+ true
133
+ end
134
+
118
135
  private
119
136
 
120
137
  def is_foundation?
@@ -0,0 +1,19 @@
1
+ module Susanoo
2
+ module Generators
3
+ class NgModule < Thor::Group
4
+ include Thor::Actions
5
+
6
+ desc "Create an AngularJS module."
7
+
8
+ argument :name, :type => :string, :desc => "Name of AngularJS"
9
+
10
+ def self.is_global_generator?
11
+ false
12
+ end
13
+
14
+ def install_templates
15
+ puts "Adasdasd> #{name}"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,20 @@
1
+ module Susanoo
2
+ module Generators
3
+ class Scaffold < Thor::Group
4
+ include Thor::Actions
5
+
6
+ desc "Create an scaffold."
7
+
8
+ argument :name, :type => :string, :desc => "Name of scaffold"
9
+
10
+ def self.is_global_generator?
11
+ false
12
+ end
13
+
14
+ def test
15
+ puts "Adasdasd"
16
+ end
17
+
18
+ end
19
+ end
20
+ end
@@ -4,6 +4,7 @@ module Susanoo
4
4
  attr_accessor :folder_name
5
5
  attr_accessor :project_name
6
6
  attr_accessor :package_name
7
+ attr_accessor :path
7
8
  end
8
9
  end
9
10
  end
File without changes
@@ -0,0 +1,8 @@
1
+ if ENV.include? "SUSANOO_HOME"
2
+ $:.unshift ENV["SUSANOO_HOME"]
3
+ end
4
+
5
+ require 'susanoo'
6
+
7
+ Susanoo::CLI::Project.root = File.expand_path("../../", __FILE__)
8
+ Susanoo::CLI::Project.start
@@ -1,5 +1,8 @@
1
+ //= require variables
2
+ //= require functions
1
3
  <% js_files.each do |file| %>
2
4
  //= require lib/<%= file %>
3
5
  <% end %>
6
+ //= require_tree ./modules
4
7
  //= require app
5
8
  //= require main
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Return the path of given template
3
+ **/
4
+ function template(patH) {
5
+ return "/www/views/" + path + ".html";
6
+ }
@@ -0,0 +1,3 @@
1
+ module Susanoo
2
+ VERSION = "0.4.0"
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.1.0
4
+ version: 0.4.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-01-28 00:00:00.000000000 Z
11
+ date: 2014-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,25 +80,33 @@ files:
80
80
  - README.md
81
81
  - Rakefile
82
82
  - Susanoo.gemspec
83
+ - TODO.org
83
84
  - bin/susanoo
84
- - lib/Susanoo.rb
85
- - lib/Susanoo/cli.rb
86
- - lib/Susanoo/generators.rb
87
- - lib/Susanoo/generators/cordova.rb
88
- - lib/Susanoo/generators/frameworks.rb
89
- - lib/Susanoo/project.rb
90
- - lib/Susanoo/tasks.rb
91
- - lib/Susanoo/tasks/compile.rake
92
- - lib/Susanoo/templates/Gemfile
93
- - lib/Susanoo/templates/Rakefile
94
- - lib/Susanoo/templates/config.ru
95
- - lib/Susanoo/templates/www/assets/javascripts/app.js
96
- - lib/Susanoo/templates/www/assets/javascripts/application.js
97
- - lib/Susanoo/templates/www/assets/javascripts/main.js
98
- - lib/Susanoo/templates/www/assets/stylesheets/application.css
99
- - lib/Susanoo/templates/www/assets/stylesheets/main.scss
100
- - lib/Susanoo/templates/www/index.html
101
- - lib/Susanoo/version.rb
85
+ - lib/susanoo.rb
86
+ - lib/susanoo/cli.rb
87
+ - lib/susanoo/cli/global.rb
88
+ - lib/susanoo/cli/project.rb
89
+ - lib/susanoo/generators.rb
90
+ - lib/susanoo/generators/cordova.rb
91
+ - lib/susanoo/generators/frameworks.rb
92
+ - lib/susanoo/generators/ng_module.rb
93
+ - lib/susanoo/generators/scaffold.rb
94
+ - lib/susanoo/project.rb
95
+ - lib/susanoo/tasks.rb
96
+ - lib/susanoo/tasks/compile.rake
97
+ - lib/susanoo/templates/application/Gemfile
98
+ - lib/susanoo/templates/application/Rakefile
99
+ - lib/susanoo/templates/application/bin/susanoo
100
+ - lib/susanoo/templates/application/config.ru
101
+ - lib/susanoo/templates/application/www/assets/javascripts/app.js
102
+ - lib/susanoo/templates/application/www/assets/javascripts/application.js
103
+ - lib/susanoo/templates/application/www/assets/javascripts/functions.js
104
+ - lib/susanoo/templates/application/www/assets/javascripts/main.js
105
+ - lib/susanoo/templates/application/www/assets/javascripts/variables.js
106
+ - lib/susanoo/templates/application/www/assets/stylesheets/application.css
107
+ - lib/susanoo/templates/application/www/assets/stylesheets/main.scss
108
+ - lib/susanoo/templates/application/www/index.html
109
+ - lib/susanoo/version.rb
102
110
  homepage: http://github.com/lxsameer/Susanoo
103
111
  licenses:
104
112
  - GPL-2
@@ -1,8 +0,0 @@
1
- require "Susanoo/version"
2
- require "colorize"
3
-
4
- module Susanoo
5
- end
6
-
7
- require "Susanoo/cli"
8
- require "Susanoo/project"
@@ -1,56 +0,0 @@
1
- require 'thor'
2
- require 'Susanoo/generators'
3
-
4
-
5
- module Susanoo
6
- class Cli < Thor
7
- desc "new PROJECT", "Create a new Susanoo/Cordova project"
8
- def new(name)
9
- Susanoo::Project.folder_name = name
10
- Susanoo::Generators::Cordova.start
11
-
12
- Susanoo::Generators::Frameworks.start
13
- end
14
-
15
- desc "server", "Run development server."
16
- def server(port=6000)
17
- require 'sprockets'
18
- require 'rack'
19
- require 'rack/rewrite'
20
-
21
- root = Dir.getwd
22
- #Rack::Handler::WEBrick.run :Port => 3000, :DocumentRoot => root
23
- server = Rack::Builder.app do
24
- map "/statics" do
25
- project_root = Dir.getwd
26
-
27
- assets = Sprockets::Environment.new(project_root) do |env|
28
- env.logger = Logger.new(STDOUT)
29
- end
30
-
31
- assets.append_path(File.join(project_root, 'www', 'assets'))
32
- assets.append_path(File.join(project_root, 'www', 'assets', 'javascripts'))
33
- assets.append_path(File.join(project_root, 'www', 'assets', 'stylesheets'))
34
- assets.append_path(File.join(project_root, 'www', 'assets', 'images'))
35
-
36
- run assets
37
- end
38
-
39
- map "/" do
40
- use Rack::Static, :urls => [""], :index => "index.html"
41
- run lambda { |env|
42
- [
43
- 200,
44
- {
45
- 'Content-Type' => 'text/html',
46
- 'Cache-Control' => 'public, max-age=86400'
47
- },
48
- File.open('www/index.html', File::RDONLY)
49
- ]
50
- }
51
- end
52
- end
53
- Rack::Handler::WEBrick.run(server, Port: port)
54
- end
55
- end
56
- end
@@ -1,7 +0,0 @@
1
- module Susanoo
2
- module Generators
3
- end
4
- end
5
-
6
- require 'Susanoo/generators/cordova'
7
- require 'Susanoo/generators/frameworks'
@@ -1,3 +0,0 @@
1
- module Susanoo
2
- VERSION = "0.1.0"
3
- end