tida_sina_weibo 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,31 @@
1
+ defaults: &defaults
2
+ api:
3
+ status:
4
+ update: 'https://api.weibo.com/2/statuses/update.json'
5
+ upload: 'https://upload.api.weibo.com/2/statuses/upload.json'
6
+ user_timeline: 'https://api.weibo.com/2/statuses/user_timeline.json'
7
+ user_timeline_ids: 'https://api.weibo.com/2/statuses/user_timeline/ids.json'
8
+ show: 'https://api.weibo.com/2/statuses/show.json'
9
+ repost_timeline: 'https://api.weibo.com/2/statuses/repost_timeline.json'
10
+ repost_timeline_ids: 'https://api.weibo.com/2/statuses/repost_timeline/ids.json'
11
+ queryid: 'https://api.weibo.com/2/statuses/queryid.json'
12
+ querymid: 'https://api.weibo.com/2/statuses/querymid.json'
13
+ comments:
14
+ show: 'https://api.weibo.com/2/comments/show.json'
15
+ user:
16
+ show: 'https://api.weibo.com/2/users/show.json'
17
+ domain_show: 'https://api.weibo.com/2/users/domain_show.json'
18
+ tags: 'https://api.weibo.com/2/tags.json'
19
+ friendships:
20
+ followers: 'https://api.weibo.com/2/friendships/followers.json'
21
+ followers_ids: 'https://api.weibo.com/2/friendships/followers/ids.json'
22
+ show: 'https://api.weibo.com/2/friendships/show.json'
23
+
24
+ development:
25
+ <<: *defaults
26
+
27
+ test:
28
+ <<: *defaults
29
+
30
+ production:
31
+ <<: *defaults
@@ -1,7 +1,14 @@
1
1
  module TidaSinaWeibo
2
2
  module Generators
3
3
  class InstallGenerator < Rails::Generators::Base
4
- namespace 'tida_sina_weibo'
4
+ source_root File.expand_path("../../templates", __FILE__)
5
+
6
+ desc "Creates a Devise initializer and copy locale files to your application."
7
+ class_option :orm
8
+
9
+ def copy_settings
10
+ copy_file "../../../config/tida_sina_weibo.yml", "config/tida_sina_weibo.yml"
11
+ end
5
12
  end
6
13
  end
7
14
  end
@@ -1,3 +1,3 @@
1
1
  module TidaSinaWeibo
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tida_sina_weibo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -72,15 +72,11 @@ files:
72
72
  - LICENSE.txt
73
73
  - README.md
74
74
  - Rakefile
75
+ - config/tida_sina_weibo.yml
75
76
  - lib/.DS_Store
76
77
  - lib/generators/.DS_Store
77
- - lib/generators/active_record/templates/migration.rb
78
- - lib/generators/active_record/templates/migration_existing.rb
79
- - lib/generators/active_record/tida_sina_weibo_generator.rb
80
78
  - lib/generators/tida_sina_weibo/.DS_Store
81
79
  - lib/generators/tida_sina_weibo/install_generator.rb
82
- - lib/generators/tida_sina_weibo/orm_helpers.rb
83
- - lib/generators/tida_sina_weibo/tida_sina_weibo_generator.rb
84
80
  - lib/tida_sina_weibo.rb
85
81
  - lib/tida_sina_weibo/api_wrapper.rb
86
82
  - lib/tida_sina_weibo/exceptions.rb
@@ -1,15 +0,0 @@
1
- class TidaSinaWeiboCreate<%= table_name.camelize %> < ActiveRecord::Migration
2
- def change
3
- create_table(:<%= table_name %>) do |t|
4
- <%= migration_data -%>
5
-
6
- <% attributes.each do |attribute| -%>
7
- t.<%= attribute.type %> :<%= attribute.name %>
8
- <% end -%>
9
-
10
- t.timestamps
11
- end
12
-
13
- add_index :<%= table_name %>, :name, :unique => true
14
- end
15
- end
@@ -1,22 +0,0 @@
1
- class AddTidaSinaWeiboTo<%= table_name.camelize %> < ActiveRecord::Migration
2
- def self.up
3
- change_table(:<%= table_name %>) do |t|
4
- <%= migration_data -%>
5
-
6
- <% attributes.each do |attribute| -%>
7
- t.<%= attribute.type %> :<%= attribute.name %>
8
- <% end -%>
9
-
10
- # Uncomment below if timestamps were not included in your original model.
11
- # t.timestamps
12
- end
13
-
14
- add_index :<%= table_name %>, :email, :unique => true
15
- end
16
-
17
- def self.down
18
- # By default, we don't want to make any assumption about how to roll back a migration when your
19
- # model already existed. Please edit below which fields you would like to remove in this migration.
20
- raise ActiveRecord::IrreversibleMigration
21
- end
22
- end
@@ -1,26 +0,0 @@
1
- require 'rails/generators/active_record'
2
- require 'generators/tida_sina_weibo/orm_helpers'
3
-
4
- module ActiveRecord
5
- module Generators
6
- class TidaSinaWeiboGenerator < ActiveRecord::Generators::Base
7
- argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
8
-
9
- include TidaSinaWeibo::Generators::OrmHelpers
10
- source_root File.expand_path("../templates", __FILE__)
11
-
12
- def copy_devise_migration
13
- if (behavior == :invoke && model_exists?) || (behavior == :revoke && migration_exists?(table_name))
14
- migration_template "migration_existing.rb", "db/migrate/add_devise_to_#{table_name}"
15
- else
16
- migration_template "migration.rb", "db/migrate/devise_create_#{table_name}"
17
- end
18
- end
19
-
20
- def generate_model
21
- invoke "active_record:model", [name], :migration => false unless model_exists? && behavior == :invoke
22
- end
23
-
24
- end
25
- end
26
- end
@@ -1,28 +0,0 @@
1
- module TidaSinaWeibo
2
- module Generators
3
- module OrmHelpers
4
- def model_contents
5
- <<-CONTENT
6
-
7
-
8
- CONTENT
9
- end
10
-
11
- def model_exists?
12
- File.exists?(File.join(destination_root, model_path))
13
- end
14
-
15
- def migration_exists?(table_name)
16
- Dir.glob("#{File.join(destination_root, migration_path)}/[0-9]*_*.rb").grep(/\d+_add_tida_sina_weibo_to_#{table_name}.rb$/).first
17
- end
18
-
19
- def migration_path
20
- @migration_path ||= File.join("db", "migrate")
21
- end
22
-
23
- def model_path
24
- @model_path ||= File.join("app", "models", "#{file_path}.rb")
25
- end
26
- end
27
- end
28
- end
@@ -1,24 +0,0 @@
1
- module TidaSinaWeibo
2
- module Generators
3
- class TidaSinaWeiboGenerator < Rails::Generators::NamedBase
4
- include Rails::Generators::ResourceHelpers
5
-
6
- namespace "tida_sina_weibo"
7
- source_root File.expand_path("../templates", __FILE__)
8
-
9
- desc "Generates a model with the given NAME (if one does not exist) with tida_sina_weibo " <<
10
- "configuration plus a migration file and tida_sina_weibo routes."
11
-
12
- hook_for :orm
13
-
14
- # class_option :routes, :desc => "Generate routes", :type => :boolean, :default => true
15
-
16
- # def add_devise_routes
17
- # devise_route = "devise_for :#{plural_name}"
18
- # devise_route << %Q(, :class_name => "#{class_name}") if class_name.include?("::")
19
- # devise_route << %Q(, :skip => :all) unless options.routes?
20
- # route devise_route
21
- # end
22
- end
23
- end
24
- end