achievable 0.0.1 → 0.0.2

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 CHANGED
@@ -1,4 +1,5 @@
1
1
  .bundle/
2
+ *.gem
2
3
  log/*.log
3
4
  pkg/
4
5
  test/dummy/db/*.sqlite3
@@ -11,9 +11,12 @@ To install Achievable, simply install the gem:
11
11
 
12
12
  Run generator to generate config information in `application.rb`, migration file `achievable_migration`, and model files `achievement.rb` and `achieving.rb`
13
13
 
14
- rails g achievable
14
+ rails g achievable MODEL
15
15
 
16
- ## Configuration for [resque](https://github.com/defunkt/resque)
16
+ MODEL here is the achiever - model that receives achievement, for example: user
17
+
18
+ ## Configuration for Resque
19
+ [resque](https://github.com/defunkt/resque)
17
20
 
18
21
  Achievable also provides resque functionality. Enable or disable resque in `config/application.rb`:
19
22
 
@@ -48,6 +51,8 @@ Achievable also provides resque functionality. Enable or disable resque in `conf
48
51
  ...
49
52
  end
50
53
 
54
+ ### Note that achievement items have to be created FIRST!
55
+
51
56
  ## TODO
52
57
 
53
58
 
@@ -1,3 +1,3 @@
1
1
  module Achievable
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,26 +1,33 @@
1
1
  class AchievableGenerator < Rails::Generators::NamedBase
2
+ include Rails::Generators::Migration
2
3
 
3
4
  source_root File.expand_path("../templates", __FILE__)
4
5
 
5
- class_option :migration, :type => :boolean, :default => true
6
+ def set_up_achiever
7
+ inject_into_class "app/models/#{file_name}.rb", class_name, <<-CONTENT
8
+ include Achievable::Achiever
9
+ CONTENT
10
+ end
11
+
12
+ def add_application_config
13
+ inject_into_class "config/application.rb", "Application", <<-CONTENT
14
+ # Set achievable resque
15
+ config.achievable.resque_enable = false
16
+
17
+ CONTENT
18
+ end
6
19
 
7
20
  def manifest
8
- record do |m|
9
- m.migration_template 'migration.rb', 'db/migrate', :migration_file_name => "achievable_migration"
10
- end
21
+ migration_template 'migration.rb', 'db/migrate/achievable_migration'
11
22
  end
12
23
 
13
24
  def copy_achievable_models
14
25
  template "achievement.rb", "app/models/achievement.rb"
15
26
  template "achieving.rb", "app/models/achieving.rb"
16
27
  end
17
-
18
- def add_application_config
19
- inject_into_class "config/application.rb", "Application", <<-CONTENT
20
- # Set achievable resque
21
- config.achievable.resque_enable = false
22
28
 
23
- CONTENT
29
+ def self.next_migration_number(path)
30
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
24
31
  end
25
32
 
26
33
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Qi He
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-04-11 00:00:00 -07:00
17
+ date: 2011-04-12 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency