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.
- checksums.yaml +4 -4
- data/Susanoo.gemspec +1 -1
- data/TODO.org +3 -0
- data/bin/susanoo +3 -5
- data/lib/susanoo.rb +8 -0
- data/lib/susanoo/cli.rb +47 -0
- data/lib/susanoo/cli/global.rb +19 -0
- data/lib/susanoo/cli/project.rb +105 -0
- data/lib/susanoo/generators.rb +9 -0
- data/lib/{Susanoo → susanoo}/generators/cordova.rb +4 -0
- data/lib/{Susanoo → susanoo}/generators/frameworks.rb +18 -1
- data/lib/susanoo/generators/ng_module.rb +19 -0
- data/lib/susanoo/generators/scaffold.rb +20 -0
- data/lib/{Susanoo → susanoo}/project.rb +1 -0
- data/lib/{Susanoo → susanoo}/tasks.rb +0 -0
- data/lib/{Susanoo → susanoo}/tasks/compile.rake +0 -0
- data/lib/{Susanoo/templates → susanoo/templates/application}/Gemfile +0 -0
- data/lib/{Susanoo/templates → susanoo/templates/application}/Rakefile +0 -0
- data/lib/susanoo/templates/application/bin/susanoo +8 -0
- data/lib/{Susanoo/templates → susanoo/templates/application}/config.ru +0 -0
- data/lib/{Susanoo/templates → susanoo/templates/application}/www/assets/javascripts/app.js +0 -0
- data/lib/{Susanoo/templates → susanoo/templates/application}/www/assets/javascripts/application.js +3 -0
- data/lib/susanoo/templates/application/www/assets/javascripts/functions.js +6 -0
- data/lib/{Susanoo/templates → susanoo/templates/application}/www/assets/javascripts/main.js +0 -0
- data/lib/susanoo/templates/application/www/assets/javascripts/variables.js +0 -0
- data/lib/{Susanoo/templates → susanoo/templates/application}/www/assets/stylesheets/application.css +0 -0
- data/lib/{Susanoo/templates → susanoo/templates/application}/www/assets/stylesheets/main.scss +0 -0
- data/lib/{Susanoo/templates → susanoo/templates/application}/www/index.html +0 -0
- data/lib/susanoo/version.rb +3 -0
- metadata +28 -20
- data/lib/Susanoo.rb +0 -8
- data/lib/Susanoo/cli.rb +0 -56
- data/lib/Susanoo/generators.rb +0 -7
- data/lib/Susanoo/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cea3a001f96e2e5c895481f0cd45480e1eacb657
|
4
|
+
data.tar.gz: ce9a4a01a59b2a3804c13e28991ff1baf6fc4609
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93658ba6ca437bce4a6fc3312f64c4cf97ddf3e56242341520e7f41433fed7f22c342fa81685c6029e6b24bb84de3e87b99130d25e6ef95bc4a8a6fddc4039ab
|
7
|
+
data.tar.gz: 5d47d0fe406d3d0eeb9c588ba6046963547237081ce4db9dff2e3b502852a11282bb34e4fb0b425f2c4503d0eebddd342b0d8f386281d4f4fdbf81da771d62ac
|
data/Susanoo.gemspec
CHANGED
data/TODO.org
ADDED
data/bin/susanoo
CHANGED
data/lib/susanoo.rb
ADDED
data/lib/susanoo/cli.rb
ADDED
@@ -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
|
@@ -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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/{Susanoo/templates → susanoo/templates/application}/www/assets/stylesheets/application.css
RENAMED
File without changes
|
data/lib/{Susanoo/templates → susanoo/templates/application}/www/assets/stylesheets/main.scss
RENAMED
File without changes
|
File without changes
|
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.
|
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
|
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/
|
85
|
-
- lib/
|
86
|
-
- lib/
|
87
|
-
- lib/
|
88
|
-
- lib/
|
89
|
-
- lib/
|
90
|
-
- lib/
|
91
|
-
- lib/
|
92
|
-
- lib/
|
93
|
-
- lib/
|
94
|
-
- lib/
|
95
|
-
- lib/
|
96
|
-
- lib/
|
97
|
-
- lib/
|
98
|
-
- lib/
|
99
|
-
- lib/
|
100
|
-
- lib/
|
101
|
-
- lib/
|
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
|
data/lib/Susanoo.rb
DELETED
data/lib/Susanoo/cli.rb
DELETED
@@ -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
|
data/lib/Susanoo/generators.rb
DELETED
data/lib/Susanoo/version.rb
DELETED