arfy 0.2 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog.md +21 -1
- data/Readme.md +101 -0
- data/Readme.pt_br.md +105 -0
- data/bin/arfy +1 -0
- data/lib/arfy.rb +6 -18
- data/lib/arfy/environment.rb +200 -0
- data/lib/arfy/generator.rb +4 -38
- data/lib/arfy/migration_builder.rb +105 -0
- data/lib/arfy/migration_builder/builders/add_column.rb +17 -0
- data/lib/arfy/migration_builder/builders/add_index.rb +41 -0
- data/lib/arfy/migration_builder/builders/change_column.rb +16 -0
- data/lib/arfy/migration_builder/builders/column.rb +147 -0
- data/lib/arfy/migration_builder/builders/create_table.rb +30 -0
- data/lib/arfy/migration_builder/builders/drop_table.rb +16 -0
- data/lib/arfy/migration_builder/builders/remove_column.rb +14 -0
- data/lib/arfy/migration_builder/builders/remove_index.rb +44 -0
- data/lib/arfy/migration_builder/builders/rename_column.rb +26 -0
- data/lib/arfy/migration_builder/builders/rename_table.rb +28 -0
- data/lib/arfy/migration_builder/generic_migration.rb +98 -0
- data/lib/arfy/migration_builder/template_handler.rb +47 -0
- data/lib/arfy/string_extensions.rb +20 -0
- data/lib/arfy/version.rb +1 -1
- data/lib/arfy_tasks.rb +2 -0
- data/lib/tasks/all.rb +34 -30
- metadata +36 -11
- data/README.md +0 -64
- data/lib/arfy/application_faker.rb +0 -22
- data/lib/arfy/config_faker.rb +0 -13
- data/lib/arfy/environment_faker.rb +0 -13
- data/lib/arfy/migration_template +0 -7
- data/lib/arfy/rails_faker.rb +0 -25
@@ -1,22 +0,0 @@
|
|
1
|
-
module RailsFaker
|
2
|
-
module ApplicationFaker
|
3
|
-
def config
|
4
|
-
if @fake_config.nil?
|
5
|
-
@fake_config = Object.new
|
6
|
-
class << @fake_config
|
7
|
-
include ConfigFaker
|
8
|
-
end
|
9
|
-
end
|
10
|
-
@fake_config
|
11
|
-
end
|
12
|
-
|
13
|
-
def paths
|
14
|
-
configured_paths
|
15
|
-
end
|
16
|
-
|
17
|
-
def load_seed
|
18
|
-
seed_file = paths["db/seeds"]
|
19
|
-
load(seed_file) if File.exist?(seed_file)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
data/lib/arfy/config_faker.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
module RailsFaker
|
2
|
-
#https://github.com/rails/rails/blob/master/railties/lib/rails/application/configuration.rb
|
3
|
-
module ConfigFaker
|
4
|
-
def paths
|
5
|
-
configured_paths
|
6
|
-
end
|
7
|
-
|
8
|
-
def database_configuration
|
9
|
-
@configuration ||= YAML::load(ERB.new(IO.read(paths["config/database"])).result)
|
10
|
-
@configuration
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module RailsFaker
|
2
|
-
module EnvironmentFaker
|
3
|
-
def method_missing(who_ami, *params)
|
4
|
-
method = who_ami.to_s
|
5
|
-
ends_with_questionmark = method.index("?") == method.length - 1
|
6
|
-
if ends_with_questionmark
|
7
|
-
env_name_asked = method.slice(0, method.length-1)
|
8
|
-
return env_name_asked == ENV['RAILS_ENV'] || self.env
|
9
|
-
end
|
10
|
-
super
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
data/lib/arfy/migration_template
DELETED
data/lib/arfy/rails_faker.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
module RailsFaker
|
2
|
-
def root
|
3
|
-
"."
|
4
|
-
end
|
5
|
-
|
6
|
-
def env
|
7
|
-
if @fake_env.nil?
|
8
|
-
@fake_env = String.new(ENV['RAILS_ENV'] ||= "development")
|
9
|
-
class << @fake_env
|
10
|
-
include EnvironmentFaker
|
11
|
-
end
|
12
|
-
end
|
13
|
-
@fake_env
|
14
|
-
end
|
15
|
-
|
16
|
-
def application
|
17
|
-
if @fake_application.nil?
|
18
|
-
@fake_application = Object.new
|
19
|
-
class << @fake_application
|
20
|
-
include ApplicationFaker
|
21
|
-
end
|
22
|
-
end
|
23
|
-
@fake_application
|
24
|
-
end
|
25
|
-
end
|