webnames 0.0.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0d2f86594020cd71d6012077c7cffb931baa4b3e
4
+ data.tar.gz: 402feb8e9d281c01988d6d0a99e32669385d2ee7
5
+ SHA512:
6
+ metadata.gz: c16fd211f90ea4532d5fc8c26f5da625625227b1d8cbb1f055fcec76bc59e06d8039b4ee1f3cc8333094141cf7fd31ec777d44bfa25d080094a3c725e0e798c5
7
+ data.tar.gz: 08633f64ca861835776df07c54b4c3134ed0f0620fcd240af4cf71fee88c5cdaf843decf0a0cd9a512e2623bd552294be1c0146407454622477ed845c1b7e43a
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2013 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Webname'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+
22
+ Bundler::GemHelper.install_tasks
23
+
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Rails.application.routes.draw do
2
+ end
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails generate active_record Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -0,0 +1,3 @@
1
+ class ActiveRecordGenerator < Rails::Generators::NamedBase
2
+ source_root File.expand_path('../templates', __FILE__)
3
+ end
@@ -0,0 +1,13 @@
1
+ class WebnameCreate<%= table_name.camelize %> < ActiveRecord::Migration
2
+ def change
3
+ create_table(:<%= table_name %>) do |t|
4
+ t.string :webname
5
+ t.references :resource, :polymorphic => true
6
+
7
+ t.timestamps
8
+ end
9
+
10
+ add_index(:<%= table_name %>, :webname)
11
+ add_index(:<%= table_name %>, [ :webname, :resource_type, :resource_id ])
12
+ end
13
+ end
@@ -0,0 +1,26 @@
1
+ require 'rails/generators/active_record'
2
+ require 'active_support/core_ext'
3
+
4
+ module ActiveRecord
5
+ module Generators
6
+ class WebnameGenerator < ActiveRecord::Generators::Base
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ def generate_model
10
+ invoke "active_record:model", [ name ], :migration => false
11
+ end
12
+
13
+ def copy_webname_migration
14
+ migration_template "migration.rb", "db/migrate/webname_create_#{table_name}"
15
+ end
16
+
17
+ def model_path
18
+ File.join("app", "models", "#{file_path}.rb")
19
+ end
20
+
21
+ def model_content
22
+ "belongs_to :resource, :polymorphic => true"
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails generate webname Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -0,0 +1,3 @@
1
+ class Webname < ActiveRecord::Base
2
+ belongs_to :resource, :polymorphic => true
3
+ end
@@ -0,0 +1,20 @@
1
+ module Webname
2
+ module Generators
3
+ class WebnameGenerator < Rails::Generators::NamedBase
4
+ class_option :orm, :type => :string, :default => "active_record"
5
+ argument :klass_name, :type => :string, :default => "Webname"
6
+
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ hook_for :orm, :required => true
10
+
11
+ desc "Generates a model and a migration file for the webnames"
12
+
13
+ def self.start(args, config)
14
+ klass_name = args.size > 1 ? args[1] : "Webname"
15
+ args.insert(1, klass_name) # 0 being the view name
16
+ super
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :webname do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,7 @@
1
+ module Webname
2
+ class Engine < ::Rails::Engine
3
+ config.generators do |g|
4
+ g.test_framework :rspec, :fixture => false
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module Webname
2
+ VERSION = "0.0.1"
3
+ end
data/lib/webname.rb ADDED
@@ -0,0 +1,4 @@
1
+ require "webname/engine"
2
+
3
+ module Webname
4
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: webnames
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Sadjow Medeiros Leão
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>'
18
+ - !ruby/object:Gem::Version
19
+ version: '3.2'
20
+ - - <
21
+ - !ruby/object:Gem::Version
22
+ version: '5'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - '>'
28
+ - !ruby/object:Gem::Version
29
+ version: '3.2'
30
+ - - <
31
+ - !ruby/object:Gem::Version
32
+ version: '5'
33
+ - !ruby/object:Gem::Dependency
34
+ name: pg
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec-rails
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ description: webname(nickname, username) solution for Rails applications
62
+ email:
63
+ - sadjow@gmail.com
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files: []
67
+ files:
68
+ - config/routes.rb
69
+ - lib/generators/active_record/active_record_generator.rb
70
+ - lib/generators/active_record/templates/migration.rb
71
+ - lib/generators/active_record/USAGE
72
+ - lib/generators/active_record/webname_generator.rb
73
+ - lib/generators/webname/templates/webname-active_record.rb
74
+ - lib/generators/webname/USAGE
75
+ - lib/generators/webname/webname_generator.rb
76
+ - lib/tasks/webname_tasks.rake
77
+ - lib/webname/engine.rb
78
+ - lib/webname/version.rb
79
+ - lib/webname.rb
80
+ - MIT-LICENSE
81
+ - Rakefile
82
+ homepage: https://github.com/sadjow/webnames
83
+ licenses: []
84
+ metadata: {}
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubyforge_project:
101
+ rubygems_version: 2.0.6
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: webname(nickname, username) solution for Rails
105
+ test_files: []