simple_options 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.
- checksums.yaml +4 -4
- data/lib/generators/simple_options/install_generator.rb +35 -0
- data/lib/generators/{optimacms_options/install/templates/migration.rb → simple_options/templates/migrations/create_options.rb} +2 -2
- data/lib/simple_options/version.rb +1 -1
- metadata +3 -3
- data/lib/generators/optimacms_options/install/install_generator.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b76da1798f0c2b7ba3881507f9fbe5f3e72fb40
|
4
|
+
data.tar.gz: 0b5e35bf4737b8a8d81259d8c421a45cfd83f7ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99c0f67e7bfcf29df0afc509325cb8a7240fb616095e00726cba1a9dbcf36f709b3ca64182637c09303bf2ec0992a87b0854435329626f9f09536f2cc9291434
|
7
|
+
data.tar.gz: bf32fa2ce206a5698cf4ef532fa1f3133750fec263aa6d6427457dffacdfceee6c2a61ec6239c85d1364eb790aea78c5b842731534add03b13ffbc22f56e329b
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/migration'
|
3
|
+
require 'rails/generators/active_record'
|
4
|
+
|
5
|
+
|
6
|
+
module SimpleOptions
|
7
|
+
module Generators
|
8
|
+
class InstallGenerator < ::Rails::Generators::Base
|
9
|
+
include Rails::Generators::Migration
|
10
|
+
|
11
|
+
desc "Install options"
|
12
|
+
source_root File.expand_path("../templates", __FILE__)
|
13
|
+
|
14
|
+
|
15
|
+
def self.next_migration_number(path)
|
16
|
+
unless @prev_migration_nr
|
17
|
+
@prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
|
18
|
+
else
|
19
|
+
@prev_migration_nr += 1
|
20
|
+
end
|
21
|
+
@prev_migration_nr.to_s
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.next_migration_number(path)
|
25
|
+
#Time.now.utc.strftime("%Y%m%d%H%M%S")
|
26
|
+
ActiveRecord::Generators::Base.next_migration_number(path)
|
27
|
+
end
|
28
|
+
|
29
|
+
def create_migrations
|
30
|
+
migration_template 'migrations/create_options.rb', 'db/migrate/create_options.rb'
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
class
|
1
|
+
class CreateOptions < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :options do |t|
|
4
4
|
t.string :name, :null => false
|
5
5
|
t.string :title, :null => false
|
6
|
-
t.string :
|
6
|
+
t.string :option_type, :null => false
|
7
7
|
t.text :description, :null => true
|
8
8
|
t.boolean :is_changed, :null => true, :default=>1
|
9
9
|
t.string :category, :null => true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_options
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Ivak
|
@@ -55,8 +55,8 @@ files:
|
|
55
55
|
- app/models/option.rb
|
56
56
|
- app/views/layouts/simple_options/application.html.erb
|
57
57
|
- config/routes.rb
|
58
|
-
- lib/generators/
|
59
|
-
- lib/generators/
|
58
|
+
- lib/generators/simple_options/install_generator.rb
|
59
|
+
- lib/generators/simple_options/templates/migrations/create_options.rb
|
60
60
|
- lib/simple_options.rb
|
61
61
|
- lib/simple_options/engine.rb
|
62
62
|
- lib/simple_options/version.rb
|
@@ -1,28 +0,0 @@
|
|
1
|
-
#require 'active_support/concern'
|
2
|
-
require 'rails/generators/migration'
|
3
|
-
#require 'rails/generators/actions/create_migration'
|
4
|
-
|
5
|
-
|
6
|
-
module OptimacmsOptions
|
7
|
-
module Generators
|
8
|
-
class InstallGenerator < ::Rails::Generators::Base
|
9
|
-
include Rails::Generators::Migration
|
10
|
-
source_root File.expand_path('../templates', __FILE__)
|
11
|
-
desc "add the migrations"
|
12
|
-
|
13
|
-
def self.next_migration_number(path)
|
14
|
-
unless @prev_migration_nr
|
15
|
-
@prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
|
16
|
-
else
|
17
|
-
@prev_migration_nr += 1
|
18
|
-
end
|
19
|
-
@prev_migration_nr.to_s
|
20
|
-
end
|
21
|
-
|
22
|
-
def copy_migrations
|
23
|
-
migration_template "migration.rb", "db/migrate/optimacms_options.rb"
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|