ruby-app 0.1.9 → 0.1.10
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 +7 -0
- data/.gitignore +1 -0
- data/Gemfile +1 -1
- data/README.md +3 -3
- data/bin/ruby-app +7 -2
- data/generator/migration.rb.tt +1 -1
- data/generator/project/Gemfile.tt +1 -1
- data/generator/project/config/environments/test.rb +1 -1
- data/generator/project/lib/application.rb.tt +2 -2
- data/lib/ruby-app/application_defaults.rb +11 -11
- data/lib/ruby-app/common_config.rb +10 -10
- data/lib/ruby-app/default_config.rb +1 -1
- data/lib/ruby-app/environment.rb +6 -6
- data/lib/ruby-app/error_mailer.rb +3 -3
- data/lib/ruby-app/local_logger.rb +6 -1
- data/lib/ruby-app/version.rb +1 -1
- data/ruby-app.gemspec +2 -2
- data/spec/app_spec.rb +13 -13
- data/spec/test_app/config/config.rb +1 -1
- data/spec/test_app/config/environments/production.rb +2 -2
- data/spec/test_app/config/environments/test.rb +1 -1
- data/spec/test_app/config/environments/test3.rb +3 -3
- data/spec/test_app/lib/application.rb +1 -1
- metadata +20 -43
- data/generator/project/app/models/.gitkeep +0 -0
- data/generator/project/config/initializers/.gitkeep +0 -0
- data/generator/project/lib/rake_tasks/.gitkeep +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2c1015f458a6dedeba606b5c211980c43ea6a0ab
|
4
|
+
data.tar.gz: 14c56ad549c565b7179e2cc4960a379691a4b2e1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c46d9b7d7e2c8180ccfb6596ce12409545febb2935b374f4276d3f167a44561835d3454d2c2abcf462906ddc7598639306b541c8a76aa454fec9fd36e2df7fba
|
7
|
+
data.tar.gz: f6a90c892c52c1a1c1785778426d09a33031f0b754d2025434383d91d77f1675d5d4b6c98bbef2505e911237e79d3a89a328758357d328faf19e8bb6581545ee
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -9,8 +9,8 @@ Features: bundler, environments, activesupport, rails dirs tree. Fast loading an
|
|
9
9
|
|
10
10
|
$ ruby-app new app
|
11
11
|
$ cd app && bundle
|
12
|
-
|
13
|
-
Run like (default env is development):
|
12
|
+
|
13
|
+
Run like (default env is development):
|
14
14
|
|
15
15
|
$ ./bin/example
|
16
16
|
$ APP_ENV=production ./bin/example
|
@@ -19,4 +19,4 @@ Run like (default env is development):
|
|
19
19
|
Generate app with ActiveRecord support:
|
20
20
|
|
21
21
|
$ ruby-app new app --ar
|
22
|
-
|
22
|
+
|
data/bin/ruby-app
CHANGED
@@ -15,6 +15,11 @@ class New < Thor::Group
|
|
15
15
|
directory('project', "#{name}/")
|
16
16
|
empty_directory("#{name}/log")
|
17
17
|
empty_directory("#{name}/tmp")
|
18
|
+
empty_directory("#{name}/app")
|
19
|
+
empty_directory("#{name}/app/models")
|
20
|
+
empty_directory("#{name}/app/controllers")
|
21
|
+
empty_directory("#{name}/config/initializers")
|
22
|
+
empty_directory("#{name}/lib/rake_tasks")
|
18
23
|
|
19
24
|
if ar
|
20
25
|
copy_file("database.yml", "#{name}/config/database.yml")
|
@@ -64,9 +69,9 @@ private
|
|
64
69
|
end
|
65
70
|
end
|
66
71
|
|
67
|
-
class
|
72
|
+
class RubyAppCli < Thor
|
68
73
|
register New, :new, "new", "create new project [NAME]"
|
69
74
|
register Migration, :migration, "migration", "generate migration [NAME] for app with AR"
|
70
75
|
end
|
71
76
|
|
72
|
-
|
77
|
+
RubyAppCli.start
|
data/generator/migration.rb.tt
CHANGED
@@ -5,7 +5,7 @@ module Application::Defaults
|
|
5
5
|
def tmp_dir
|
6
6
|
@gem_tmp_dir ||= File.join(root, %w{tmp})
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
def logger_dir
|
10
10
|
@gem_logger_dir ||= File.join(root, %w{log})
|
11
11
|
end
|
@@ -13,7 +13,7 @@ module Application::Defaults
|
|
13
13
|
def env
|
14
14
|
@gem_env ||= begin
|
15
15
|
env = ENV['APP_ENV'] || ENV['RAILS_ENV']
|
16
|
-
|
16
|
+
|
17
17
|
# if not specify env, try find file with env config/environment.current
|
18
18
|
# which created this file by a capistrano, by example
|
19
19
|
unless env
|
@@ -22,14 +22,14 @@ module Application::Defaults
|
|
22
22
|
env = File.read(path)
|
23
23
|
env.strip!
|
24
24
|
end
|
25
|
-
end
|
26
|
-
|
25
|
+
end
|
26
|
+
|
27
27
|
env = 'development' unless env
|
28
|
-
|
28
|
+
|
29
29
|
env
|
30
30
|
end
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
alias :environment :env
|
34
34
|
|
35
35
|
def logger
|
@@ -44,22 +44,22 @@ module Application::Defaults
|
|
44
44
|
def config
|
45
45
|
CommonConfig
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
def identifier
|
49
49
|
"ruby-app"
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
def rake_paths
|
53
53
|
@gem_rake_paths ||= []
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
def initializer_paths
|
57
57
|
@gem_initializer_paths ||= []
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
def bundler_group
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
63
|
def error_mailer
|
64
64
|
ErrorMailer
|
65
65
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
class CommonConfig
|
4
4
|
@@configs = {}
|
5
|
-
|
5
|
+
|
6
6
|
def self.define(name, &block)
|
7
7
|
s = Scope.new
|
8
8
|
s.instance_eval(&block)
|
@@ -12,7 +12,7 @@ class CommonConfig
|
|
12
12
|
def self.load(config_file, shouldbe = false)
|
13
13
|
if File.exists?(config_file)
|
14
14
|
require 'yaml'
|
15
|
-
|
15
|
+
|
16
16
|
h = YAML.load_file(config_file)
|
17
17
|
if h.is_a?(Hash)
|
18
18
|
h.symbolize_keys!
|
@@ -26,20 +26,20 @@ class CommonConfig
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
def self.save(filename)
|
31
31
|
File.open(filename, 'w'){|f| f.write YAML.dump(@@configs) }
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
class Scope
|
35
35
|
def initialize
|
36
36
|
@configs = {}
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
attr_reader :configs
|
40
|
-
|
40
|
+
|
41
41
|
private
|
42
|
-
|
42
|
+
|
43
43
|
def method_missing(name, *params, &block)
|
44
44
|
if name.to_s =~ /_address$/i
|
45
45
|
require 'ostruct'
|
@@ -54,11 +54,11 @@ class CommonConfig
|
|
54
54
|
def self.[]=(option, value)
|
55
55
|
@@configs[option.to_sym] = value
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
def self.has_key?(key)
|
59
59
|
@@configs.key?(key.to_sym)
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
62
|
def self.try(method)
|
63
63
|
self.send(method) rescue nil
|
64
64
|
end
|
@@ -66,7 +66,7 @@ class CommonConfig
|
|
66
66
|
def self.method_missing(name, *args)
|
67
67
|
if has_key?(name)
|
68
68
|
res = @@configs[name.to_sym]
|
69
|
-
res.is_a?(Proc) ? res.call : res
|
69
|
+
res.is_a?(Proc) ? res.call : res
|
70
70
|
else
|
71
71
|
super
|
72
72
|
end
|
data/lib/ruby-app/environment.rb
CHANGED
@@ -35,10 +35,6 @@ Bundler.require(App.bundler_group, "#{App.bundler_group}_#{App.env}") if App.bun
|
|
35
35
|
# for free usless data from bundler and gems
|
36
36
|
GC.start
|
37
37
|
|
38
|
-
unless defined?(Rake)
|
39
|
-
App.logger.info "Loading #{App.name}[#{App.env}] ..."
|
40
|
-
end
|
41
|
-
|
42
38
|
# default config from app
|
43
39
|
require File.join(App.root, %w{config config})
|
44
40
|
|
@@ -50,17 +46,21 @@ CommonConfig.load(File.join(App.root, ['config', "config.yml.#{App.env}"]))
|
|
50
46
|
begin
|
51
47
|
require File.join(App.root, %W( config environments #{App.env}))
|
52
48
|
rescue LoadError
|
53
|
-
raise "unknown env #{App.env}"
|
49
|
+
raise "unknown env #{App.env}"
|
54
50
|
end
|
55
51
|
|
56
52
|
# unshift lib app
|
57
53
|
# $:.unshift(File.join(App.root, 'lib'))
|
58
54
|
|
55
|
+
unless defined?(Rake)
|
56
|
+
App.logger.info "Loading #{App.name}[#{App.env}] ..."
|
57
|
+
end
|
58
|
+
|
59
59
|
ActiveSupport::Dependencies::autoload_paths << File.join(App.root, 'lib')
|
60
60
|
|
61
61
|
# unshift dirs app
|
62
62
|
dirs = Dir[File.join(App.root, %w{app *})]
|
63
|
-
dirs.each do |a|
|
63
|
+
dirs.each do |a|
|
64
64
|
$:.unshift(a)
|
65
65
|
ActiveSupport::Dependencies::autoload_paths << a
|
66
66
|
end
|
@@ -2,8 +2,13 @@
|
|
2
2
|
require 'logger'
|
3
3
|
|
4
4
|
class LocalLogger < Logger
|
5
|
+
FORMAT = '%d.%m.%Y %H:%M:%S'
|
6
|
+
|
5
7
|
def initialize(*a)
|
6
8
|
super
|
7
|
-
|
9
|
+
|
10
|
+
self.formatter = Proc.new do |s, d, p, m|
|
11
|
+
"#{d.strftime(FORMAT)} #{s.ljust(5)} -- #{m}\n"
|
12
|
+
end
|
8
13
|
end
|
9
14
|
end
|
data/lib/ruby-app/version.rb
CHANGED
data/ruby-app.gemspec
CHANGED
data/spec/app_spec.rb
CHANGED
@@ -6,51 +6,51 @@ describe "RubyApp" do
|
|
6
6
|
before :all do
|
7
7
|
require File.join(File.dirname(__FILE__), %w{test_app config environment})
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
it "should require in right order" do
|
11
11
|
App.config.test_thing.should == [1,2,3,4]
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
it "should be name" do
|
15
15
|
App.name.should == 'Test_app'
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
it "redefine configs" do
|
19
19
|
App.config.some1.should == 1
|
20
20
|
App.config.some2.should == 'bbb'
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
it "constant - no warnings about redefine" do
|
24
24
|
App::BLA.should == 1
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
it "proc in config" do
|
28
28
|
App.config.proc_test.should == "bbbccc"
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
it "load config from file config/config.yml" do
|
32
32
|
App.config.file.should == :yml
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
it "safe check parameter in config" do
|
36
36
|
App.config.try(:file).should == :yml
|
37
37
|
App.config.try(:file2).should == nil
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
it "should load extensions" do
|
41
41
|
App.some_gem_method.should == "some gem method"
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
it "force set env" do
|
45
45
|
App.env.should == 'test3'
|
46
46
|
App.config.apps.size.should == 4
|
47
47
|
App.config.apps.uniq.should == ['test3']
|
48
48
|
App.config.bla.should == 12
|
49
|
-
end
|
50
|
-
|
49
|
+
end
|
50
|
+
|
51
51
|
it "ErrorMailer should wrap raise" do
|
52
52
|
Model.new.raised_method # should not raise
|
53
|
-
end
|
53
|
+
end
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
end
|
metadata
CHANGED
@@ -1,113 +1,100 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.10
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Makarchev Konstantin
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-09-10 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activesupport
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: thor
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: bundler
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: rspec
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: rake
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - '>='
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: '0'
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - '>='
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: '0'
|
110
|
-
description:
|
97
|
+
description: 'Ruby micro framework for easy create ruby applications (daemons, EventMachine-apps,
|
111
98
|
db-apps, cli...). Features: bundler, environments, activesupport, rails dirs tree.
|
112
99
|
Fast loading and low memory using.'
|
113
100
|
email: kostya27@gmail.com
|
@@ -127,7 +114,6 @@ files:
|
|
127
114
|
- generator/project/.gitignore.tt
|
128
115
|
- generator/project/Gemfile.tt
|
129
116
|
- generator/project/Rakefile.tt
|
130
|
-
- generator/project/app/models/.gitkeep
|
131
117
|
- generator/project/bin/console
|
132
118
|
- generator/project/bin/example
|
133
119
|
- generator/project/config/boot.rb
|
@@ -136,9 +122,7 @@ files:
|
|
136
122
|
- generator/project/config/environments/development.rb
|
137
123
|
- generator/project/config/environments/production.rb
|
138
124
|
- generator/project/config/environments/test.rb
|
139
|
-
- generator/project/config/initializers/.gitkeep
|
140
125
|
- generator/project/lib/application.rb.tt
|
141
|
-
- generator/project/lib/rake_tasks/.gitkeep
|
142
126
|
- generator/project/spec/spec1_spec.rb.tt
|
143
127
|
- generator/project/spec/spec_helper.rb
|
144
128
|
- lib/ruby-app/application_defaults.rb
|
@@ -176,32 +160,25 @@ files:
|
|
176
160
|
- spec/test_app/lib/application.rb
|
177
161
|
homepage: http://github.com/kostya/ruby-app
|
178
162
|
licenses: []
|
163
|
+
metadata: {}
|
179
164
|
post_install_message:
|
180
165
|
rdoc_options: []
|
181
166
|
require_paths:
|
182
167
|
- lib
|
183
168
|
required_ruby_version: !ruby/object:Gem::Requirement
|
184
|
-
none: false
|
185
169
|
requirements:
|
186
|
-
- -
|
170
|
+
- - '>='
|
187
171
|
- !ruby/object:Gem::Version
|
188
172
|
version: '0'
|
189
|
-
segments:
|
190
|
-
- 0
|
191
|
-
hash: -119047907
|
192
173
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
|
-
none: false
|
194
174
|
requirements:
|
195
|
-
- -
|
175
|
+
- - '>='
|
196
176
|
- !ruby/object:Gem::Version
|
197
177
|
version: '0'
|
198
|
-
segments:
|
199
|
-
- 0
|
200
|
-
hash: -119047907
|
201
178
|
requirements: []
|
202
179
|
rubyforge_project:
|
203
|
-
rubygems_version:
|
180
|
+
rubygems_version: 2.0.2
|
204
181
|
signing_key:
|
205
|
-
specification_version:
|
182
|
+
specification_version: 4
|
206
183
|
summary: Ruby application micro framework
|
207
184
|
test_files: []
|
File without changes
|
File without changes
|
File without changes
|