subapp_model 0.9.1

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.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "http://ruby.taobao.org"
2
+
3
+ gem 'activerecord', '3.2.13', :require => 'active_record'
4
+ # Specify your gem's dependencies in subapp_model.gemspec
5
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 TODO: Write your name
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # SubappModel
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'subapp_model'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install subapp_model
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/ctags.rb ADDED
@@ -0,0 +1,3 @@
1
+ require 'bundler'
2
+ paths = Bundler.load.specs.map(&:full_gem_path)
3
+ system("ctags -R -f .gemtags #{paths.join(' ')}")
@@ -0,0 +1,18 @@
1
+ require "subapp_model/version"
2
+ %w{subapp_model}.each do |dir|
3
+ Dir.glob(File.expand_path("../#{dir}", __FILE__) + '/**/*.rb').each do |file|
4
+ # if(file.index("home_controller") == nil)
5
+ #$LOAD_PATH.unshift(file)
6
+
7
+ require_file = File.basename(file, ".rb")
8
+ require_class = require_file.split('_').map {|w| w.capitalize}.join
9
+
10
+ #puts "#{require_class} : #{file}"
11
+
12
+ autoload "#{require_class}".to_sym,file
13
+
14
+ if(ENV["RACK_ENV"]=="development")
15
+ also_reload file
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,92 @@
1
+ #-*- encoding: utf-8 -*-
2
+ class App < ActiveRecord::Base
3
+ self.table_name = 'tb_app' # 子app
4
+ establish_connection SUBAPP_DB
5
+ attr_accessible :title,
6
+ :name, # 拼音
7
+ :content_type, # 1:多人 2:单人 3:单专辑
8
+ :is_published, # 是否发布过
9
+ :app_icon_path,
10
+ :app_icon_default,
11
+ :app_icon_57_path,
12
+ :app_icon_124_path,
13
+ :background_path,
14
+ :default_background,
15
+ :loading_icon_path,
16
+ :loading_default,
17
+ :loading_320x480_path,
18
+ :loading_640x960_path,
19
+ :loading_640x1136_path,
20
+ :loading_480x800_path,
21
+ :loading_1280x720_path,
22
+ :loading_music_path,
23
+ :loading_music_default,
24
+ :apple_appid,
25
+ :talkingdata_iphone_key,
26
+ :talkingdata_android_key,
27
+ :duomeng_ios_key, # 多盟广告ios版key
28
+ :duomeng_android_key, # 多盟广告android版key
29
+ :googlead_ios_key,
30
+ :googlead_android_key,
31
+ :weixin_ios_key,
32
+ :weixin_android_key,
33
+ :irateid,
34
+ :certificate_name, #打包用的苹果证书名
35
+ :envir, #环境 0:开发 1:测试
36
+ :app_icon_72_path, #android用
37
+ :app_icon_144_path, #android用
38
+ :channel_num, #渠道号
39
+ :baidu_ios_id, :baidu_ios_key, :baidu_android_id, :baidu_android_key, :ios_ads, :android_ads, :ios_is_upgraded, :android_is_upgraded,
40
+ :ios_is_recommended, :android_is_recommended
41
+
42
+ validates :title, :apple_appid, :name, :certificate_name, :presence => true
43
+ CONTENT_TYPES = {MUTI_BOZHU: 1, SINGLE_PERSON: 2, SINGLE_ALBUM: 3}
44
+ # json:
45
+ # {
46
+ # id: app.id,
47
+ # title: app.title, # app名
48
+ # name: app.name, # app名
49
+ # content_type: app.content_type,
50
+ # app_icon_57_url: File.join(Settings.fdfs_root, app.app_icon_57_path), # app图标1
51
+ # app_icon_124_url: File.join(Settings.fdfs_root, app.app_icon_124_path), # app图标2
52
+ # loading_icon_320_url: picture_url('app_loading', app.loading_icon_path, '320'), # loading图标1
53
+ # loading_icon_640_960_url: picture_url('app_loading', app.loading_icon_path, '640_960'), # loading图标2
54
+ # loading_icon_640_1136_url: picture_url('app_loading', app.loading_icon_path, '640_1136'), # loading图标3
55
+ # loading_icon_480_url: picture_url('app_loading', app.loading_icon_path, '480'), # loading图标4
56
+ # loading_icon_1280_url: picture_url('app_loading', app.loading_icon_path, '1280'), # loading图标5
57
+ # talkingdata_iphone_key: app.talkingdata_iphone_key,
58
+ # talkingdata_android_key: app.talkingdata_android_key,
59
+ # duomeng_ios_key: app.duomeng_ios_key,
60
+ # duomeng_android_key: app.duomeng_android_key,
61
+ # apple_appid: app.apple_appid, # 苹果appid
62
+ # googlead_ios_key: app.googlead_ios_key,
63
+ # googlead_android_key: app.googlead_android_key,
64
+ # weixin_ios_key: app.weixin_ios_key,
65
+ # weixin_android_key: app.weixin_android_key,
66
+ # irateid: app.irateid,
67
+ # certificate_name: app.certificate_name
68
+ # }
69
+
70
+ #APP类型显示
71
+ def content_type_disp
72
+ case self.content_type
73
+ when 1
74
+ "多用户"
75
+ when 2
76
+ "单用户多专辑"
77
+ when 3
78
+ "单用户单专辑"
79
+ end
80
+ end
81
+
82
+ def envir_disp
83
+ case self.envir
84
+ when true
85
+ "测试"
86
+ when false
87
+ "开发"
88
+ end
89
+ end
90
+
91
+
92
+ end
@@ -0,0 +1,6 @@
1
+ #-*- encoding: utf-8 -*-
2
+ class AppAd < ActiveRecord::Base
3
+ establish_connection SUBAPP_DB
4
+ self.table_name = 'tb_app_ad' # 子App广告
5
+ attr_accessible :name, :description
6
+ end
@@ -0,0 +1,6 @@
1
+ #-*- encoding: utf-8 -*-
2
+ class AppAdChangelog < ActiveRecord::Base
3
+ establish_connection SUBAPP_DB
4
+ self.table_name = 'tb_app_ad_changelog' # 子App广告配置修改日志
5
+ attr_accessible :user, :op, :action
6
+ end
@@ -0,0 +1,6 @@
1
+ #-*- encoding: utf-8 -*-
2
+ class AppAdMaterial < ActiveRecord::Base
3
+ establish_connection SUBAPP_DB
4
+ self.table_name = 'tb_app_ad_material' # 子App广告物料关系
5
+ attr_accessible :ad_id, :material_id, :start_time, :end_time, :is_active
6
+ end
@@ -0,0 +1,16 @@
1
+ #-*- encoding: utf-8 -*-
2
+ class AppAlbum < ActiveRecord::Base
3
+ establish_connection SUBAPP_DB
4
+ self.table_name = 'tb_app_album' # 子App专辑
5
+
6
+ attr_accessible :album_id,
7
+ :app_id,
8
+ :uid,
9
+ :order_num,
10
+ :cover_path,
11
+ :album_title,
12
+ :album_intro
13
+
14
+ #belongs_to :app_bozhu,:foreign_key=>"uid"
15
+ #belongs_to :app
16
+ end
@@ -0,0 +1,20 @@
1
+ class AppBozhu < ActiveRecord::Base
2
+ establish_connection SUBAPP_DB
3
+ self.table_name = 'tb_app_bozhu'
4
+
5
+ attr_accessible :app_id,
6
+ :uid,
7
+ :bozhu_name,
8
+ :is_all_album,
9
+ :is_auto_update,
10
+ :order_num,
11
+ :bozhu_pic
12
+
13
+ # has_many :app_album
14
+ # belongs_to :app
15
+ # has_many :app_album,:association_foreign_key=>"uid", :limit=>Settings.per_page.app_album
16
+
17
+ def self.find_by_appid(appid, limit)
18
+ return AppBozhu.where(app_id: appid).page(limit[:page_id]).per(limit[:page_size]).order("order_num asc, created_at desc")
19
+ end
20
+ end
@@ -0,0 +1,6 @@
1
+ #-*- encoding: utf-8 -*-
2
+ class AppCategory < ActiveRecord::Base
3
+ establish_connection SUBAPP_DB
4
+ self.table_name = 'tb_app_category' # 子App分类类型
5
+ attr_accessible :appid, :category_id, :is_all_tags, :order_num
6
+ end
@@ -0,0 +1,6 @@
1
+ #-*- encoding: utf-8 -*-
2
+ class AppMaterial < ActiveRecord::Base
3
+ establish_connection SUBAPP_DB
4
+ self.table_name = 'tb_app_material' # 子App物料
5
+ attr_accessible :pic_url, :web_url, :is_delete, :name
6
+ end
@@ -0,0 +1,6 @@
1
+ #-*- encoding: utf-8 -*-
2
+ class AppTag < ActiveRecord::Base
3
+ establish_connection SUBAPP_DB
4
+ self.table_name = 'tb_app_tag' # 子App标签类型
5
+ attr_accessible :app_id, :tag_name, :is_all_albums, :order_num
6
+ end
@@ -0,0 +1,3 @@
1
+ module SubappModel
2
+ VERSION = "0.9.1"
3
+ end
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require 'subapp_model/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "subapp_model"
7
+ spec.version = SubappModel::VERSION
8
+ spec.authors = ["gavin"]
9
+ spec.email = ["gavin@ximalaya.com"]
10
+ spec.description = %q{subapp_model}
11
+ spec.summary = %q{subapp_model}
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+ spec.rubyforge_project = "subapp_model"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: subapp_model
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.1
5
+ platform: ruby
6
+ authors:
7
+ - gavin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: subapp_model
42
+ email:
43
+ - gavin@ximalaya.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gemtags
49
+ - .gitignore
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - ctags.rb
55
+ - lib/subapp_model.rb
56
+ - lib/subapp_model/app.rb
57
+ - lib/subapp_model/app_ad.rb
58
+ - lib/subapp_model/app_ad_changelog.rb
59
+ - lib/subapp_model/app_ad_material.rb
60
+ - lib/subapp_model/app_album.rb
61
+ - lib/subapp_model/app_bozhu.rb
62
+ - lib/subapp_model/app_category.rb
63
+ - lib/subapp_model/app_material.rb
64
+ - lib/subapp_model/app_tag.rb
65
+ - lib/subapp_model/version.rb
66
+ - subapp_model.gemspec
67
+ homepage: ''
68
+ licenses:
69
+ - MIT
70
+ metadata: {}
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubyforge_project: subapp_model
87
+ rubygems_version: 2.0.3
88
+ signing_key:
89
+ specification_version: 4
90
+ summary: subapp_model
91
+ test_files: []
92
+ has_rdoc: