ruby-app-ar 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bb808cb025d098f023ffab55d3527f49f3c33169fadc76e566b1c4ff80f64426
4
+ data.tar.gz: 1999dd9bae9b6850146698c945f6919d688c173cea2b5b50b8e08ab2e17682c4
5
+ SHA512:
6
+ metadata.gz: 9385e1e00a60ca597a653397423c14db7cfa689ed39c9f6e6bf1de100bacca8eb5d188dcb07d22b1bb19d6f79b9a2a85d2f01d7f7b7d86fc69738936a410f89c
7
+ data.tar.gz: 26353ddc18e580a013e397f2a077bcb751356bd56d759a9f83d01a20cabb684d523c2d70239dea22e73e105157b9de1781b7e4d02c32b0f843af64cabdb70f15
data/.gitignore CHANGED
@@ -2,3 +2,5 @@ TODO
2
2
  *.gem
3
3
  Gemfile.lock
4
4
  *.log
5
+ .bundle
6
+ .ruby-version
data/README.md CHANGED
@@ -9,7 +9,7 @@ Install
9
9
  Use generator:
10
10
 
11
11
  ruby-app new app --ar
12
-
12
+
13
13
 
14
14
  ### OR Manually
15
15
 
@@ -18,14 +18,14 @@ Add to Gemfile:
18
18
 
19
19
  gem 'ruby-app'
20
20
  gem 'ruby-app-ar'
21
-
21
+
22
22
  Add to Rakefile:
23
-
23
+
24
24
  load "ruby-app/tasks.rake"
25
25
  load "ruby-app-ar/tasks.rake"
26
-
26
+
27
27
  Create
28
-
28
+
29
29
  db/migrate
30
30
  config/database.yml
31
31
 
@@ -39,4 +39,8 @@ Examples:
39
39
 
40
40
  $ rake db:create APP_ENV=test
41
41
  $ rake db:migrate
42
-
42
+
43
+ Generate migration:
44
+
45
+ $ ruby-app migration bla
46
+
data/lib/config.rb CHANGED
@@ -9,15 +9,15 @@ App.config.define :default_ar do
9
9
  YAML.load(
10
10
  ERB.new(
11
11
  File.read(File.join(App.root, %w{config database.yml} ))
12
- ).result
12
+ ).result
13
13
  )
14
14
  rescue
15
15
  raise "Not found config/database.yml"
16
16
  end
17
17
  end
18
-
19
- database_settings do
18
+
19
+ database_settings do
20
20
  App.config.database_yml[App.env]
21
21
  end
22
-
22
+
23
23
  end
data/lib/ruby-app-ar.rb CHANGED
@@ -10,6 +10,6 @@ if defined?(Application) && (Application.send(:identifier) rescue '-') == 'ruby-
10
10
  App.initializer_paths << [
11
11
  File.join(File.dirname(__FILE__), %w{ config.rb }),
12
12
  File.join(File.dirname(__FILE__), %w{ init-activerecord.rb })
13
- ].map{|f| File.expand_path(f) }
13
+ ].map{|f| File.expand_path(f) }
14
14
 
15
15
  end
@@ -41,7 +41,7 @@ namespace :db do
41
41
  $stderr.puts "Couldn't create database for #{config.inspect}"
42
42
  end
43
43
  end
44
- return # Skip the else clause of begin/rescue
44
+ return # Skip the else clause of begin/rescue
45
45
  else
46
46
  ActiveRecord::Base.establish_connection(config)
47
47
  ActiveRecord::Base.connection
@@ -108,7 +108,19 @@ namespace :db do
108
108
  desc "Migrate the database through scripts in db/migrate. Target specific version with VERSION=x. Turn off output with VERBOSE=false."
109
109
  task :migrate => :environment do
110
110
  ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
111
- ActiveRecord::Migrator.migrate("db/migrate/", ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
111
+
112
+ version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
113
+ less52 = ActiveRecord.version < Gem::Version.create("5.2.0")
114
+ less60 = ActiveRecord.version < Gem::Version.create("6.0.0")
115
+
116
+ if less52
117
+ ActiveRecord::Migrator.migrate("db/migrate/", version)
118
+ elsif less60
119
+ ActiveRecord::MigrationContext.new("db/migrate/").migrate(version)
120
+ else
121
+ ActiveRecord::MigrationContext.new("db/migrate/", ActiveRecord::SchemaMigration).migrate(version)
122
+ end
123
+
112
124
  Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby
113
125
  end
114
126
 
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RubyAppAr
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/ruby-app-ar.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
6
6
  s.version = RubyAppAr::VERSION
7
7
 
8
8
  s.authors = ["Makarchev Konstantin"]
9
-
9
+
10
10
  s.description = %q{RubyApp extension, adds ActiveRecord support}
11
11
  s.summary = %q{RubyApp extension, adds ActiveRecord support}
12
12
 
@@ -20,9 +20,9 @@ Gem::Specification.new do |s|
20
20
 
21
21
  s.add_dependency 'activerecord'
22
22
  s.add_dependency 'ruby-app', ">= 0.1.4"
23
-
23
+
24
24
  s.add_development_dependency "rspec"
25
25
  s.add_development_dependency "rake"
26
26
  s.add_development_dependency "sqlite3"
27
-
27
+
28
28
  end
data/spec/app_spec.rb CHANGED
@@ -5,10 +5,10 @@ describe "RubyAppAr" do
5
5
  before :all do
6
6
  require File.join(File.dirname(__FILE__), %w{test_app config environment})
7
7
  end
8
-
8
+
9
9
  it "should succesfully load" do
10
10
  Task.count.should == 3
11
11
  Task.last.a.should == 3
12
12
  end
13
-
13
+
14
14
  end
@@ -1,7 +1,7 @@
1
1
  # Configs for test env
2
2
 
3
3
  App.config.define :test do
4
-
4
+
5
5
  # Set log level for App.logger
6
6
  log_level Logger::INFO
7
7
 
@@ -5,7 +5,7 @@ class CreateTasks < ActiveRecord::Migration
5
5
  t.integer :a
6
6
  t.timestamps
7
7
  end
8
-
8
+
9
9
  add_index :tasks, [:a]
10
10
  end
11
11
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  class Application
4
4
  class << self
5
-
5
+
6
6
  def name
7
7
  "11"
8
8
  end
metadata CHANGED
@@ -1,104 +1,92 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ruby-app-ar
3
- version: !ruby/object:Gem::Version
4
- hash: 25
5
- prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Makarchev Konstantin
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2012-06-23 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- type: :runtime
22
- requirement: &id001 !ruby/object:Gem::Requirement
23
- none: false
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- hash: 3
28
- segments:
29
- - 0
30
- version: "0"
31
- version_requirements: *id001
32
- prerelease: false
11
+ date: 2021-06-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
33
14
  name: activerecord
34
- - !ruby/object:Gem::Dependency
35
- type: :runtime
36
- requirement: &id002 !ruby/object:Gem::Requirement
37
- none: false
38
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
39
17
  - - ">="
40
- - !ruby/object:Gem::Version
41
- hash: 19
42
- segments:
43
- - 0
44
- - 1
45
- - 4
46
- version: 0.1.4
47
- version_requirements: *id002
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
48
21
  prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
49
28
  name: ruby-app
50
- - !ruby/object:Gem::Dependency
51
- type: :development
52
- requirement: &id003 !ruby/object:Gem::Requirement
53
- none: false
54
- requirements:
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
55
31
  - - ">="
56
- - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
- version: "0"
61
- version_requirements: *id003
32
+ - !ruby/object:Gem::Version
33
+ version: 0.1.4
34
+ type: :runtime
62
35
  prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.1.4
41
+ - !ruby/object:Gem::Dependency
63
42
  name: rspec
64
- - !ruby/object:Gem::Dependency
65
- type: :development
66
- requirement: &id004 !ruby/object:Gem::Requirement
67
- none: false
68
- requirements:
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
69
45
  - - ">="
70
- - !ruby/object:Gem::Version
71
- hash: 3
72
- segments:
73
- - 0
74
- version: "0"
75
- version_requirements: *id004
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
76
49
  prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
77
56
  name: rake
78
- - !ruby/object:Gem::Dependency
79
- type: :development
80
- requirement: &id005 !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
83
59
  - - ">="
84
- - !ruby/object:Gem::Version
85
- hash: 3
86
- segments:
87
- - 0
88
- version: "0"
89
- version_requirements: *id005
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
90
63
  prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
91
70
  name: sqlite3
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
92
83
  description: RubyApp extension, adds ActiveRecord support
93
84
  email: kostya27@gmail.com
94
85
  executables: []
95
-
96
86
  extensions: []
97
-
98
87
  extra_rdoc_files: []
99
-
100
- files:
101
- - .gitignore
88
+ files:
89
+ - ".gitignore"
102
90
  - Gemfile
103
91
  - LICENSE
104
92
  - README.md
@@ -124,36 +112,24 @@ files:
124
112
  - spec/test_app/lib/application.rb
125
113
  homepage: http://github.com/kostya/ruby-app-ar
126
114
  licenses: []
127
-
115
+ metadata: {}
128
116
  post_install_message:
129
117
  rdoc_options: []
130
-
131
- require_paths:
118
+ require_paths:
132
119
  - lib
133
- required_ruby_version: !ruby/object:Gem::Requirement
134
- none: false
135
- requirements:
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ requirements:
136
122
  - - ">="
137
- - !ruby/object:Gem::Version
138
- hash: 3
139
- segments:
140
- - 0
141
- version: "0"
142
- required_rubygems_version: !ruby/object:Gem::Requirement
143
- none: false
144
- requirements:
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ required_rubygems_version: !ruby/object:Gem::Requirement
126
+ requirements:
145
127
  - - ">="
146
- - !ruby/object:Gem::Version
147
- hash: 3
148
- segments:
149
- - 0
150
- version: "0"
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
151
130
  requirements: []
152
-
153
- rubyforge_project:
154
- rubygems_version: 1.8.24
131
+ rubygems_version: 3.1.2
155
132
  signing_key:
156
- specification_version: 3
133
+ specification_version: 4
157
134
  summary: RubyApp extension, adds ActiveRecord support
158
135
  test_files: []
159
-