sinatra-cl 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/files/app.rb +1 -1
- data/lib/files/build.rb +49 -35
- data/lib/sinatra-cl/version.rb +1 -1
- metadata +10 -10
- /data/lib/files/{bootstrap.rb → bootstrap/bootstrap.rb} +0 -0
- /data/lib/files/{bootstrap_js.rb → bootstrap/bootstrap_js.rb} +0 -0
- /data/lib/files/{bootstrap_responsive.rb → bootstrap/bootstrap_responsive.rb} +0 -0
- /data/lib/files/{custom.rb → bootstrap/custom.rb} +0 -0
- /data/lib/files/{glyphicons_halflings.rb → bootstrap/glyphicons_halflings.rb} +0 -0
- /data/lib/files/{glyphicons_halflings_white.rb → bootstrap/glyphicons_halflings_white.rb} +0 -0
- /data/lib/files/{layout.rb → bootstrap/layout.rb} +0 -0
- /data/lib/files/{layout_no_bs.rb → no-bootstrap/layout_no_bs.rb} +0 -0
data/lib/files/app.rb
CHANGED
data/lib/files/build.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require_relative "app"
|
2
|
-
require_relative "bootstrap"
|
3
|
-
require_relative "bootstrap_js"
|
4
|
-
require_relative "bootstrap_responsive"
|
5
|
-
require_relative "custom"
|
6
|
-
require_relative "glyphicons_halflings"
|
7
|
-
require_relative "glyphicons_halflings_white"
|
2
|
+
require_relative "bootstrap/bootstrap"
|
3
|
+
require_relative "bootstrap/bootstrap_js"
|
4
|
+
require_relative "bootstrap/bootstrap_responsive"
|
5
|
+
require_relative "bootstrap/custom"
|
6
|
+
require_relative "bootstrap/glyphicons_halflings"
|
7
|
+
require_relative "bootstrap/glyphicons_halflings_white"
|
8
8
|
require_relative "gemfile"
|
9
9
|
require_relative "index"
|
10
|
-
require_relative "layout"
|
11
|
-
require_relative "layout_no_bs"
|
10
|
+
require_relative "bootstrap/layout"
|
11
|
+
require_relative "no-bootstrap/layout_no_bs"
|
12
12
|
require_relative "model"
|
13
13
|
require_relative "rakefile"
|
14
14
|
require_relative "readme"
|
@@ -25,9 +25,7 @@ module Sinatra
|
|
25
25
|
|
26
26
|
def build
|
27
27
|
top_level
|
28
|
-
|
29
|
-
public_files unless no_bootstrap?
|
30
|
-
no_bootstrap? ? view_files_no_bootstrap : view_files
|
28
|
+
no_bootstrap? ? no_bootstrap_files : boostrap_files
|
31
29
|
end
|
32
30
|
|
33
31
|
attr_reader :app_name, :flags; private :app_name, :flags
|
@@ -37,22 +35,9 @@ module Sinatra
|
|
37
35
|
flags.include?(:no_bootstrap)
|
38
36
|
end
|
39
37
|
|
40
|
-
|
41
|
-
def config
|
42
|
-
File.open("#{app_name}/config.ru", "w+") { |io|
|
43
|
-
io << "require File.join(File.dirname(__FILE__), 'app.rb')\nrun Name::#{app_name.capitalize}"
|
44
|
-
}
|
45
|
-
end
|
46
|
-
|
47
|
-
def gitignore
|
48
|
-
File.open("#{app_name}/.gitignore", "w+") { |io|
|
49
|
-
io << ".DS_STORE\n*ds_store\n*.db"
|
50
|
-
}
|
51
|
-
end
|
52
|
-
|
53
38
|
def top_level
|
54
39
|
|
55
|
-
|
40
|
+
file_constant_generator.each do |const|
|
56
41
|
const.build(app_name)
|
57
42
|
end
|
58
43
|
|
@@ -60,29 +45,58 @@ module Sinatra
|
|
60
45
|
gitignore
|
61
46
|
end
|
62
47
|
|
63
|
-
|
64
|
-
|
48
|
+
|
49
|
+
def no_bootstrap_files
|
50
|
+
no_bootstrap_file_constant_generator.each do |const|
|
65
51
|
const.build(app_name)
|
66
52
|
end
|
67
53
|
end
|
68
54
|
|
69
|
-
def
|
70
|
-
|
55
|
+
def boostrap_files
|
56
|
+
boostrap_file_constant_generator.each do |const|
|
71
57
|
const.build(app_name)
|
72
58
|
end
|
73
59
|
end
|
74
60
|
|
75
|
-
def
|
76
|
-
|
77
|
-
const.
|
61
|
+
def file_constant_generator
|
62
|
+
FileList.new("./lib/files/*.rb").map do |file|
|
63
|
+
const = my_constantize("Sinatra::Cl::Files::" << file.pathmap("%n").split("_").map{|x| x.capitalize}.join(""))
|
64
|
+
const unless const == Build
|
65
|
+
end.compact
|
66
|
+
end
|
67
|
+
|
68
|
+
def boostrap_file_constant_generator
|
69
|
+
FileList.new("./lib/files/bootstrap/*.rb").map do |file|
|
70
|
+
my_constantize("Sinatra::Cl::Files::" << file.pathmap("%n").split("_").map{|x| x.capitalize}.join(""))
|
78
71
|
end
|
79
72
|
end
|
80
73
|
|
81
|
-
def
|
82
|
-
|
83
|
-
|
74
|
+
def no_bootstrap_file_constant_generator
|
75
|
+
FileList.new("./lib/files/no-boostrap/*.rb").map do |file|
|
76
|
+
my_constantize("Sinatra::Cl::Files::" << file.pathmap("%n").split("_").map{|x| x.capitalize}.join(""))
|
84
77
|
end
|
85
78
|
end
|
79
|
+
|
80
|
+
def config
|
81
|
+
File.open("#{app_name}/config.ru", "w+") { |io|
|
82
|
+
io << "require File.join(File.dirname(__FILE__), 'app.rb')\nrun #{app_name.capitalize}::App"
|
83
|
+
}
|
84
|
+
end
|
85
|
+
|
86
|
+
def gitignore
|
87
|
+
File.open("#{app_name}/.gitignore", "w+") { |io|
|
88
|
+
io << ".DS_STORE\n*ds_store\n*.db"
|
89
|
+
}
|
90
|
+
end
|
91
|
+
|
92
|
+
def my_constantize(class_name)
|
93
|
+
unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ class_name
|
94
|
+
raise NameError, "#{class_name.inspect} is not a valid constant name!"
|
95
|
+
end
|
96
|
+
|
97
|
+
Object.module_eval("::#{$1}", __FILE__, __LINE__)
|
98
|
+
end
|
99
|
+
|
86
100
|
end
|
87
101
|
end
|
88
102
|
end
|
data/lib/sinatra-cl/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-cl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -43,18 +43,18 @@ files:
|
|
43
43
|
- bin/sinatra-cl
|
44
44
|
- lib/directory.rb
|
45
45
|
- lib/files/app.rb
|
46
|
-
- lib/files/bootstrap.rb
|
47
|
-
- lib/files/bootstrap_js.rb
|
48
|
-
- lib/files/bootstrap_responsive.rb
|
46
|
+
- lib/files/bootstrap/bootstrap.rb
|
47
|
+
- lib/files/bootstrap/bootstrap_js.rb
|
48
|
+
- lib/files/bootstrap/bootstrap_responsive.rb
|
49
|
+
- lib/files/bootstrap/custom.rb
|
50
|
+
- lib/files/bootstrap/glyphicons_halflings.rb
|
51
|
+
- lib/files/bootstrap/glyphicons_halflings_white.rb
|
52
|
+
- lib/files/bootstrap/layout.rb
|
49
53
|
- lib/files/build.rb
|
50
|
-
- lib/files/custom.rb
|
51
54
|
- lib/files/gemfile.rb
|
52
|
-
- lib/files/glyphicons_halflings.rb
|
53
|
-
- lib/files/glyphicons_halflings_white.rb
|
54
55
|
- lib/files/index.rb
|
55
|
-
- lib/files/layout.rb
|
56
|
-
- lib/files/layout_no_bs.rb
|
57
56
|
- lib/files/model.rb
|
57
|
+
- lib/files/no-bootstrap/layout_no_bs.rb
|
58
58
|
- lib/files/rakefile.rb
|
59
59
|
- lib/files/readme.rb
|
60
60
|
- lib/flag.rb
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|