aetherg 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cafc02c602bb38f6c1412906ea672a8758eeab04
4
- data.tar.gz: ab6acf04cad253f804e45991b039b323f182b157
3
+ metadata.gz: 0f8c32d788d2d204866503b3f3e867c271b1c310
4
+ data.tar.gz: a3a783e3ba09742a4f826c3546447c6faf758518
5
5
  SHA512:
6
- metadata.gz: a80d15bd8a0205a45b5689b77294b6e35311825741eef6f9b2a8106ae39e6be736a5215b6df1b8233023ff28c60c3ac82d923ea044fda4b0f1a2c110c147e36d
7
- data.tar.gz: cf7ceaa353794eaa9a32c9f8837e1edf59866c7347d21f688e44c189658de3d96b39ff11917dfb473b93cb4be6a3c6b96a69307f18e0183acb058aa696d09c97
6
+ metadata.gz: aaefb371de1e92c5ab0edd28840f0478b1cd9d9e6e76a5f308dc26257ce61ef9c708af20b333185b6f0a32397bb24adf8356eed7ebb36d208aa297324c8feed7
7
+ data.tar.gz: 9a55f873b505ae27df75b4617392c363ea619d660996e066cf7e73700b984a8415c34fd9ee7b79e296b7a638a06e4f5591d3204d06ab0e74609b84de4deea0d1
data/aetherg.gemspec ADDED
@@ -0,0 +1,21 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'aetherg'
3
+ s.version = '0.3.4'
4
+ s.date = '2017-03-24'
5
+ s.summary = "Aetherg (Aether Generator) is a generator of sinatra app."
6
+ s.description = "Aetherg (Aether Generator) is a sinatra based App generator. Light-weight for API service or full-stack Web apps"
7
+ s.authors = ["Allen Chan"]
8
+ s.email = 'chenillen@gmail.com'
9
+ s.extra_rdoc_files = [
10
+ "LICENSE",
11
+ "README.md"
12
+ ]
13
+ s.files = Dir['**/*'].keep_if { |file| File.file?(file) }
14
+ s.require_paths = ["lib"]
15
+ s.bindir = 'bin'
16
+ s.executables = ['aetherg']
17
+ s.add_runtime_dependency('thor', '~> 0.19')
18
+ s.required_ruby_version = '>= 1.9.3'
19
+ s.homepage = 'https://github.com/chenillen/aetherg'
20
+ s.license = 'MIT'
21
+ end
data/lib/aetherg.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'rubygems'
2
2
  require 'thor/group'
3
- require File.expand_path('../aetherg/string', __FILE__)
4
3
  require File.expand_path('../aetherg/aetherg', __FILE__)
5
4
  require File.expand_path('../aetherg/version', __FILE__)
@@ -1,3 +1,6 @@
1
+ require File.expand_path('../array', __FILE__)
2
+ require File.expand_path('../string', __FILE__)
3
+
1
4
  module Aetherg
2
5
  class Generator < Thor::Group
3
6
  include Thor::Actions
@@ -5,17 +8,21 @@ module Aetherg
5
8
  desc "Create a new sinatra application with aetherg"
6
9
  argument :name, type: :string, desc: "What's the name of your application"
7
10
  class_option :database, aliases: "-d", default: "mysql", desc: "The type of database to use, sqlite, mysql, postgresql supported"
8
- class_option :no_database, type: :boolean, desc: "Exclude all database configuration files"
9
- class_option :redis, type: :boolean, desc: "Include Redis configuration"
10
- class_option :no_views, type: :boolean, desc: "Disable/Enable views, default: true"
11
+ class_option :no_database, aliases: '-D', type: :boolean, default: false, desc: "Exclude all database configuration files"
12
+ class_option :no_redis, aliases: '-R', type: :boolean, default: false, desc: "Include Redis configuration"
13
+ class_option :no_views, aliases: '-V', type: :boolean, default: false, desc: "Disable views, will not generate views of the project"
11
14
 
12
15
  # Creates instance variables from options passed to Aether
13
16
 
14
17
  def setup
15
18
  @name = @app_path = name.filename
16
- options.each do |key, value|
17
- instance_variable_set "@#{key.to_s}".to_sym, value
18
- end
19
+ # options.each do |key, value|
20
+ # instance_variable_set "@#{key.to_s}".to_sym, value
21
+ # end
22
+ @database = options[:database]
23
+ options[:no_database]? @no_database = true : @no_database = false
24
+ options[:no_redis]? @no_redis = true : @no_redis = false
25
+ options[:no_views]? @no_views = true : @no_views = false
19
26
  end
20
27
 
21
28
  def self.source_root
@@ -40,7 +47,7 @@ module Aetherg
40
47
 
41
48
  def create_views_layout
42
49
  unless @no_views
43
- template "app/views/layouts/application.erb", File.join(@app_path, "/app/views/layouts/application.erb")
50
+ copy_file "app/views/layouts/application.erb", File.join(@app_path, "/app/views/layouts/application.erb")
44
51
  end
45
52
  end
46
53
 
@@ -86,7 +93,7 @@ module Aetherg
86
93
  end
87
94
 
88
95
  def create_redis_config_and_initializer
89
- if @redis
96
+ unless @no_redis
90
97
  copy_file("config/redis.yml", File.join(@app_path, "config/redis.yml"))
91
98
  template("config/initializers/redis.rb", File.join(@app_path, "config/initializers/redis.rb"))
92
99
  end
@@ -111,6 +118,7 @@ module Aetherg
111
118
  create_file File.join(@app_path, "lib", ".keep")
112
119
  create_file File.join(@app_path, "db", "migrate", ".keep")
113
120
  create_file File.join(@app_path, "public", ".keep") unless @no_views
121
+ create_file File.join(@app_path, "public", "favicon.ico") unless @no_views
114
122
  end
115
123
  end
116
124
  end
@@ -0,0 +1,9 @@
1
+ module Aetherg
2
+ module Array
3
+ def present?
4
+ !self.nil? && !self.empty?
5
+ end
6
+ end
7
+ end
8
+
9
+ Array.send(:include, Aetherg::Array)
@@ -1,4 +1,4 @@
1
- module Aether
1
+ module Aetherg
2
2
  module String
3
3
  def camelcase
4
4
  return self.gsub(/^./) { |l| l.capitalize } if !match(/[_-]/)
@@ -28,7 +28,18 @@ module Aether
28
28
  def filename!
29
29
  self.replace file_name
30
30
  end
31
+
32
+ def present?
33
+ !self.nil? && !self.empty?
34
+ end
35
+ end
36
+
37
+ module Array
38
+ def present?
39
+ !self.nil? && !self.empty?
40
+ end
31
41
  end
32
42
  end
33
43
 
34
- String.send(:include, Aether::String)
44
+ String.send(:include, Aetherg::String)
45
+ Array.send(:include, Aetherg::Array)
@@ -1,4 +1,4 @@
1
1
  module Aetherg
2
- VERSION = "0.3.3"
3
- BUILD = "2016-12-22"
2
+ VERSION = "0.3.4"
3
+ BUILD = "2017-03-24"
4
4
  end
@@ -4,7 +4,7 @@
4
4
  <meta charset="utf-8">
5
5
  <meta http-equiv=X-UA-Compatible content="Chrome=1,IE=edge">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, maximum-scale=1">
7
- <title><%= @name.camelcase %></title>
7
+ <title></title>
8
8
 
9
9
  <meta name="keywords" content="">
10
10
  <meta name="description" content="">
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aetherg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Allen Chan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-22 00:00:00.000000000 Z
11
+ date: 2017-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -39,9 +39,11 @@ files:
39
39
  - LICENSE
40
40
  - README.md
41
41
  - VERSION
42
+ - aetherg.gemspec
42
43
  - bin/aetherg
43
44
  - lib/aetherg.rb
44
45
  - lib/aetherg/aetherg.rb
46
+ - lib/aetherg/array.rb
45
47
  - lib/aetherg/string.rb
46
48
  - lib/aetherg/version.rb
47
49
  - lib/templates/Gemfile
@@ -82,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
84
  version: '0'
83
85
  requirements: []
84
86
  rubyforge_project:
85
- rubygems_version: 2.6.6
87
+ rubygems_version: 2.6.8
86
88
  signing_key:
87
89
  specification_version: 4
88
90
  summary: Aetherg (Aether Generator) is a generator of sinatra app.