sinatra-cl 0.1.0 → 0.1.2

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.
@@ -0,0 +1,89 @@
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"
8
+ require_relative "gemfile"
9
+ require_relative "index"
10
+ require_relative "layout"
11
+ require_relative "layout_no_bs"
12
+ require_relative "model"
13
+ require_relative "rakefile"
14
+ require_relative "readme"
15
+
16
+ module Sinatra
17
+ module Cl
18
+ module Files
19
+ class Build
20
+
21
+ def initialize(app_name, flags)
22
+ @app_name = app_name
23
+ @flags = flags
24
+ end
25
+
26
+ def build
27
+ top_level
28
+ lib_files
29
+ public_files unless no_bootstrap?
30
+ no_bootstrap? ? view_files_no_bootstrap : view_files
31
+ end
32
+
33
+ attr_reader :app_name, :flags; private :app_name, :flags
34
+ private
35
+
36
+ def no_bootstrap?
37
+ flags.include?(:no_bootstrap)
38
+ end
39
+
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
+ def top_level
54
+
55
+ [Readme, Rakefile, App, Gemfile].each do |const|
56
+ const.build(app_name)
57
+ end
58
+
59
+ config
60
+ gitignore
61
+ end
62
+
63
+ def public_files
64
+ [Bootstrap,BootstrapResponsive,BootstrapJs,GlyphiconsHalflings,GlyphiconsHalflingsWhite, Custom].each do |const|
65
+ const.build(app_name)
66
+ end
67
+ end
68
+
69
+ def view_files_no_bootstrap
70
+ [LayoutNoBs,Index].each do |const|
71
+ const.build(app_name)
72
+ end
73
+ end
74
+
75
+ def lib_files
76
+ [Model].each do |const|
77
+ const.build(app_name)
78
+ end
79
+ end
80
+
81
+ def view_files
82
+ [Layout,Index].each do |const|
83
+ const.build(app_name)
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
@@ -1,3 +1,10 @@
1
+ module Sinatra
2
+ module Cl
3
+ module Files
4
+ class Custom
5
+ def self.build(app_name)
6
+ File.open("#{app_name}/public/css/custom.css", "w+") { |io|
7
+ io << <<-END
1
8
  body {
2
9
  background: black;
3
10
  font-weight: 400;
@@ -56,4 +63,11 @@ pre {
56
63
  }
57
64
  #github {
58
65
  z-index: 2;
59
- }
66
+ }
67
+ END
68
+ }
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,27 @@
1
+ module Sinatra
2
+ module Cl
3
+ module Files
4
+ class Gemfile
5
+ def self.build(app_name)
6
+ File.open("#{app_name}/Gemfile", "w+") { |io|
7
+ io << <<-END
8
+ source "https://rubygems.org"
9
+
10
+
11
+ gem "sinatra"
12
+ gem "sqlite3"
13
+ gem "activerecord"
14
+ gem "sinatra-activerecord"
15
+ gem "rake"
16
+
17
+ group :development do
18
+ gem "shotgun"
19
+ gem "tux"
20
+ end
21
+ END
22
+ }
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end