has_alter_ego 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -13,18 +13,32 @@ overridden it in the database.
13
13
  rake db:migrate
14
14
 
15
15
  ### As a gem
16
- Add the following line to your config/environment.rb file:
16
+ Add the following line to your **config/environment.rb** file:
17
17
  config.gem "has_alter_ego"
18
18
  Then
19
19
  gem install has_alter_ego
20
20
  script/generate has_alter_ego
21
21
  rake db:migrate
22
22
 
23
+ Rails 3
24
+ ### As a plugin
25
+ rails plugin install git://github.com/aduffeck/has_alter_ego.git
26
+ rails generate has_alter_ego
27
+ rake db:migrate
28
+
29
+ ### As a gem
30
+ Add the following line to your **Gemfile** file:
31
+ gem "has_alter_ego"
32
+ Then
33
+ bundle install
34
+ rails generate has_alter_ego
35
+ rake db:migrate
36
+
23
37
  # Usage
24
38
 
25
- The seed data is defined in YAML files called after the model's table. The files are expected in db/fixtures/alter_egos.
39
+ The seed data is defined in YAML files called after the model's table. The files are expected in **db/fixtures/alter_egos**.
26
40
 
27
- Say you have a Model Car. has_alter_ego is enabled with the has_alter_ego method:
41
+ Say you have a Model Car. has_alter_ego is enabled with the *has_alter_ego* method:
28
42
 
29
43
  create_table :cars do |t|
30
44
  t.string :brand
@@ -36,7 +50,7 @@ Say you have a Model Car. has_alter_ego is enabled with the has_alter_ego method
36
50
  has_alter_ego
37
51
  end
38
52
 
39
- You would then create a file db/fixtures/has_alter_ego/cars.yml with the seed data:
53
+ You would then create a file **db/fixtures/alter_egos/cars.yml** with the seed data:
40
54
 
41
55
  1:
42
56
  brand: Lotus
@@ -0,0 +1,20 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/migration'
3
+
4
+ class HasAlterEgoGenerator < Rails::Generators::Base
5
+ include Rails::Generators::Migration
6
+
7
+ def copy_files(*args)
8
+ empty_directory('db/fixtures/alter_egos')
9
+ migration_template File.join(File.dirname(__FILE__), "..", "..", "generators", "has_alter_ego", "templates", "create_alter_egos.rb"),
10
+ "db/migrate/create_alter_egos.rb"
11
+ end
12
+
13
+ def self.next_migration_number dirname
14
+ if ActiveRecord::Base.timestamped_migrations
15
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
16
+ else
17
+ "%.3d" % (current_migration_number(dirname) + 1)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,6 @@
1
+ module HasAlterEgo
2
+ class Dumper
3
+ def dump
4
+ end
5
+ end
6
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_alter_ego
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Andr\xC3\xA9 Duffeck"
@@ -30,6 +30,8 @@ extra_rdoc_files: []
30
30
 
31
31
  files:
32
32
  - lib/has_alter_ego/alter_ego.rb
33
+ - lib/has_alter_ego/dumper.rb
34
+ - lib/generators/has_alter_ego_generator.rb
33
35
  - lib/has_alter_ego.rb
34
36
  - lib/tasks/has_alter_ego.rake
35
37
  - README.md