weapon 0.1.0 → 0.1.1

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: d135d41cb66b61ac9a95892619b24ba26c128ea5
4
- data.tar.gz: 8f46284f2c05f2486fcff62df0ae75c24e9742b3
3
+ metadata.gz: dd05b8383fdf6a56aee99e98e7c4e6aadfd800e4
4
+ data.tar.gz: caf2a88d30150d5b98fd8824fdb5af1b90ba5e90
5
5
  SHA512:
6
- metadata.gz: eb1fb80986a8a0a127742f495fe3d14e2cbf9bf5982e77f34ddfa9aee348bed7d397596487d721c3dc8433682af92a4c9acb37f89f40fd734fdfff132da387d3
7
- data.tar.gz: 7e6219c63a6687a35f2b9b4381dc57e748afd00d643c7c93cb930d5da8e0a7a24922967ac3012ae7576c6b0e5122c627117c0958211c45ab59d089c608b3b967
6
+ metadata.gz: 40ed25df93a88f72b4f1f14ae96a59de044d39fd23563b7943c8aa05dcaf9accaf2117b58bfb18529d2db826ebf522674417e504038ec5f6a322771f04fed121
7
+ data.tar.gz: 026e9afc4441a43fbef02c8ca2c9f73de6c12866b5a034927420daf0ff1ca680f265e658f538d1cd203f2586040d938059380e25e5034b49ded79ca06eb86f3a
@@ -0,0 +1,36 @@
1
+
2
+ class Weapon::ActiveadminGenerator < Rails::Generators::NamedBase # :nodoc:
3
+ desc 'This generator creates a example email setting and add exception_notification for production'
4
+
5
+ def create_example_email
6
+ application(nil, env: "production") do
7
+ config.action_mailer.raise_delivery_errors = true
8
+ config.action_mailer.default_url_options = {:host => '120.25.61.54:8100'}
9
+ config.action_mailer.delivery_method = :smtp
10
+ config.action_mailer.smtp_settings = {
11
+ :address => "smtp.163.com",
12
+ :port => 25,
13
+ :user_name => "ledcloud@163.com",
14
+ :password => "ffgexobhlolfjhij",
15
+ :enable_starttls_auto => true,
16
+ :authentication => "plain",
17
+ :domain => "163.com"
18
+ }
19
+ end
20
+ end
21
+
22
+ def add_exception_notify
23
+ gem_group :production do
24
+ gem "rspec-rails"
25
+ end
26
+
27
+ application(nil, env: "production") do
28
+ config.middleware.use ExceptionNotification::Rack,
29
+ :email => {
30
+ :email_prefix => "[weapon] ",
31
+ :sender_address => "weapon <ledcloud@163.com>",
32
+ :exception_recipients => %w{dilin.life@gmail.com}
33
+ }
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,40 @@
1
+
2
+ class Weapon::EmailGenerator < Rails::Generators::Base # :nodoc:
3
+ desc 'This generator creates a example email setting and add exception_notification for production'
4
+
5
+ def create_example_email
6
+ application(nil, env: "production") do
7
+ %(
8
+ config.action_mailer.raise_delivery_errors = true
9
+ config.action_mailer.default_url_options = {:host => 'http://www.example.com'}
10
+ config.action_mailer.delivery_method = :smtp
11
+ config.action_mailer.smtp_settings = {
12
+ :address => "smtp.163.com",
13
+ :port => 25,
14
+ :user_name => "weapontest@163.com",
15
+ :password => "abcdef1234",
16
+ :enable_starttls_auto => true,
17
+ :authentication => "plain",
18
+ :domain => "163.com"
19
+ }
20
+ )
21
+ end
22
+ end
23
+
24
+ def add_exception_notify
25
+ gem_group :production do
26
+ gem "exception_notification"
27
+ end
28
+
29
+ application(nil, env: "production") do
30
+ %(
31
+ config.middleware.use ExceptionNotification::Rack,
32
+ :email => {
33
+ :email_prefix => "[weapon] ",
34
+ :sender_address => "weapon <ledcloud@163.com>",
35
+ :exception_recipients => %w{dilin.life@gmail.com}
36
+ }
37
+ )
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,49 @@
1
+ require 'magicfile'
2
+ require 'fileutils'
3
+
4
+
5
+ class Weapon::GrapeGenerator < Rails::Generators::Base # :nodoc:
6
+ desc 'This generator creates grape entity for model'
7
+
8
+ def generate_grape_entity
9
+
10
+ prefix_dirs = Dir.glob('app/api/*/')
11
+ if prefix_dirs.count == 0
12
+ prefix = 'app/api/v1'
13
+ elsif prefix_dirs.count == 1
14
+ prefix = prefix_dirs[0]
15
+ else
16
+ prefix = ask('there are multi directory in app/api directory, please input path like app/api/v1')
17
+ end
18
+
19
+ if args[0].nil? || args[0] == "all"
20
+ names = Dir["app/models/*.rb"].map {|x| File.basename(x, '.rb')}
21
+ else
22
+ names = args
23
+ end
24
+
25
+ ap names
26
+
27
+ names.each do |name|
28
+ entity_dir = File.join(prefix, "entities")
29
+ entity_path = File.join(entity_dir, "#{name}.rb")
30
+
31
+ ap "dir is #{entity_dir}"
32
+ ap "path is #{entity_path}"
33
+
34
+ next unless name.camelize.constantize.respond_to? 'column_names'
35
+ column_names = name.camelize.constantize.column_names
36
+ infos = column_names.map {|column| "expose :#{column}"}
37
+
38
+ FileUtils.mkdir_p entity_dir
39
+ a = Magicfile.new
40
+ module_array = prefix.split('/')[1..-1].append('entities')
41
+ a.append_modules(module_array)
42
+ a.append_class(name.camelize, 'Grape::Entity')
43
+ a.append_string_lines(infos)
44
+ a.to_file entity_path
45
+ end
46
+
47
+ end
48
+
49
+ end
@@ -0,0 +1,5 @@
1
+
2
+ class Weapon::I18nGenerator < Rails::Generators::NamedBase # :nodoc:
3
+ desc 'This generator creates a example email setting and add exception_notification for production'
4
+
5
+ end
data/lib/weapon.rb CHANGED
@@ -231,7 +231,7 @@ class Weapon < Thor
231
231
 
232
232
  end
233
233
 
234
- desc "create_gem", "create basic gem information"
234
+ desc "create_gem", "create basic gem information and push to github, push to rubygems"
235
235
  def create_gem(name)
236
236
  FileUtils.mkdir_p "lib"
237
237
  FileUtils.mkdir_p "bin"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weapon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
- - Chuck.lei
7
+ - seaify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-23 00:00:00.000000000 Z
11
+ date: 2016-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.6'
69
+ - !ruby/object:Gem::Dependency
70
+ name: magicfile
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.0.3
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.0.3
69
83
  description: provide mina deploy, github setup, slack exception notify, i18n scaffold,
70
84
  rails-settings-ui, guard custom
71
85
  email: dilin.life@gmail.com
@@ -75,6 +89,10 @@ extensions: []
75
89
  extra_rdoc_files: []
76
90
  files:
77
91
  - bin/weapon
92
+ - lib/generators/weapon/activeadmin/activeadmin_generator.rb
93
+ - lib/generators/weapon/email/email_generator.rb
94
+ - lib/generators/weapon/grape/grape_generator.rb
95
+ - lib/generators/weapon/i18n/i18n_generator.rb
78
96
  - lib/support/create_gem/basic.bin
79
97
  - lib/support/create_gem/basic.gemspec
80
98
  - lib/support/create_gem/basic.rb
@@ -113,9 +131,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
131
  version: '0'
114
132
  requirements: []
115
133
  rubyforge_project:
116
- rubygems_version: 2.4.7
134
+ rubygems_version: 2.4.8
117
135
  signing_key:
118
136
  specification_version: 4
119
137
  summary: weapon for rails application!
120
138
  test_files: []
121
- has_rdoc: