arfy 0.1.5 → 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/Changelog.md +24 -0
- data/LICENSE +14 -0
- data/lib/arfy/application_faker.rb +5 -0
- data/lib/arfy/config_faker.rb +2 -1
- data/lib/arfy/generator.rb +8 -2
- data/lib/arfy/version.rb +1 -1
- data/lib/arfy.rb +1 -0
- data/lib/tasks/all.rb +17 -14
- metadata +6 -4
data/Changelog.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
## 0.2
|
2
|
+
|
3
|
+
Features:
|
4
|
+
|
5
|
+
- Support to all tasks
|
6
|
+
- LICENSE file created
|
7
|
+
|
8
|
+
## 0.1.5
|
9
|
+
|
10
|
+
Features:
|
11
|
+
|
12
|
+
- Support to tasks:
|
13
|
+
|
14
|
+
* db:drop
|
15
|
+
* db:migrate:status
|
16
|
+
* db:rollback
|
17
|
+
* db:schema:dump
|
18
|
+
* db:schema:load
|
19
|
+
* db:version
|
20
|
+
|
21
|
+
|
22
|
+
Bugfixes:
|
23
|
+
|
24
|
+
- No one until now
|
data/LICENSE
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Copyright [2011] [Ricardo Valeriano ricardo.valeriano@gmail.com |
|
2
|
+
ricardo@backslashes.net]
|
3
|
+
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
you may not use this file except in compliance with the License.
|
6
|
+
You may obtain a copy of the License at
|
7
|
+
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
See the License for the specific language governing permissions and
|
14
|
+
limitations under the License.
|
data/lib/arfy/config_faker.rb
CHANGED
data/lib/arfy/generator.rb
CHANGED
@@ -36,8 +36,14 @@ module Arfy
|
|
36
36
|
File.open(migration_path, "w") do |file|
|
37
37
|
file << code_for_migration(migration_name)
|
38
38
|
end
|
39
|
-
|
40
|
-
migration_path
|
39
|
+
|
40
|
+
if migration_path
|
41
|
+
puts "migration generated on: #{file}"
|
42
|
+
else
|
43
|
+
puts "FAIL. Migration not generated."
|
44
|
+
end
|
45
|
+
|
46
|
+
File.exists? migration_path
|
41
47
|
end
|
42
48
|
|
43
49
|
private
|
data/lib/arfy/version.rb
CHANGED
data/lib/arfy.rb
CHANGED
data/lib/tasks/all.rb
CHANGED
@@ -1,38 +1,41 @@
|
|
1
1
|
task :environment do
|
2
2
|
# requiring config/environment
|
3
|
+
|
3
4
|
ActiveRecord::Base.establish_connection(Rails.application.config.database_configuration[Rails.env])
|
5
|
+
|
6
|
+
module ActiveRecord
|
7
|
+
class Base
|
8
|
+
def self.establish_connection(configuration = nil)
|
9
|
+
#forget about it, we already have a connection XD
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.configurations
|
13
|
+
Rails.application.config.database_configuration
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
4
18
|
end
|
5
19
|
|
6
20
|
desc "Changes the environment (options TARGET=development) - use your's configuration name on database.yml"
|
7
21
|
task :rails_env do
|
8
|
-
ENV['RAILS_ENV'] = ENV["TARGET"] || "development"
|
22
|
+
ENV['RAILS_ENV'] = (ENV["TARGET"] || ENV["RAILS_ENV"]) || "development"
|
9
23
|
unless defined? RAILS_ENV
|
10
24
|
RAILS_ENV = ENV['RAILS_ENV']
|
11
25
|
end
|
12
|
-
|
13
|
-
# TODO: waiting for a better way of doing this
|
14
|
-
# create a new connection on pool for ActiveRecord::Base class name
|
15
|
-
# TODO: just do it on the first time
|
26
|
+
puts "working on environment: #{ENV['RAILS_ENV']}" if ENV["RAILS_ENV"]
|
16
27
|
end
|
17
28
|
|
18
29
|
namespace :generate do
|
19
30
|
desc "Generate migration (options NAME=migration_file_name, OUTDIR=db/migrate, TARGET=environment)"
|
20
|
-
task :migration do
|
31
|
+
task :migration => :rails_env do
|
21
32
|
raise "missing migration name, use the option NAME=migration_file_name" unless ENV["NAME"]
|
22
33
|
|
23
34
|
name = ENV["NAME"]
|
24
35
|
outdir = ENV["OUTDIR"] || Rails.application.config.paths['db/migrate']
|
25
|
-
ENV["RAILS_ENV"] = ENV["TARGET"] || ENV["RAILS_ENV"]
|
26
|
-
|
27
|
-
puts "working on environment: #{ENV['RAILS_ENV']}" if ENV["RAILS_ENV"]
|
28
36
|
|
29
37
|
generator = Arfy::Generator.new
|
30
38
|
file = generator.generate_migration_file ENV["NAME"], outdir
|
31
|
-
if file
|
32
|
-
puts "migration generated on: #{file}"
|
33
|
-
else
|
34
|
-
puts "FAIL. Migration not generated."
|
35
|
-
end
|
36
39
|
end
|
37
40
|
end
|
38
41
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arfy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.2'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-09-
|
12
|
+
date: 2011-09-22 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
16
|
-
requirement: &
|
16
|
+
requirement: &70304467191940 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 3.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70304467191940
|
25
25
|
description: ! 'Arfy is just a snippet: some rake tasks and environment configuration
|
26
26
|
to allow you use Rails migrations, without all the rails stack.'
|
27
27
|
email:
|
@@ -40,6 +40,8 @@ files:
|
|
40
40
|
- lib/arfy.rb
|
41
41
|
- lib/tasks/all.rb
|
42
42
|
- README.md
|
43
|
+
- LICENSE
|
44
|
+
- Changelog.md
|
43
45
|
homepage: http://github.com/ricardovaleriano/arfy
|
44
46
|
licenses: []
|
45
47
|
post_install_message:
|