yasarg 0.0.1

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 ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
19
+
20
+ *.swp
21
+ *.sqlite3
22
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source :rubygems
2
+
3
+ gem 'activerecord', '~> 3.2.6'
4
+ gem 'railties', '~>3.2.6'
data/Gemfile.lock ADDED
@@ -0,0 +1,63 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ actionpack (3.2.6)
5
+ activemodel (= 3.2.6)
6
+ activesupport (= 3.2.6)
7
+ builder (~> 3.0.0)
8
+ erubis (~> 2.7.0)
9
+ journey (~> 1.0.1)
10
+ rack (~> 1.4.0)
11
+ rack-cache (~> 1.2)
12
+ rack-test (~> 0.6.1)
13
+ sprockets (~> 2.1.3)
14
+ activemodel (3.2.6)
15
+ activesupport (= 3.2.6)
16
+ builder (~> 3.0.0)
17
+ activerecord (3.2.6)
18
+ activemodel (= 3.2.6)
19
+ activesupport (= 3.2.6)
20
+ arel (~> 3.0.2)
21
+ tzinfo (~> 0.3.29)
22
+ activesupport (3.2.6)
23
+ i18n (~> 0.6)
24
+ multi_json (~> 1.0)
25
+ arel (3.0.2)
26
+ builder (3.0.0)
27
+ erubis (2.7.0)
28
+ hike (1.2.1)
29
+ i18n (0.6.0)
30
+ journey (1.0.4)
31
+ json (1.7.3)
32
+ multi_json (1.3.6)
33
+ rack (1.4.1)
34
+ rack-cache (1.2)
35
+ rack (>= 0.4)
36
+ rack-ssl (1.3.2)
37
+ rack
38
+ rack-test (0.6.1)
39
+ rack (>= 1.0)
40
+ railties (3.2.6)
41
+ actionpack (= 3.2.6)
42
+ activesupport (= 3.2.6)
43
+ rack-ssl (~> 1.3.2)
44
+ rake (>= 0.8.7)
45
+ rdoc (~> 3.4)
46
+ thor (>= 0.14.6, < 2.0)
47
+ rake (0.9.2.2)
48
+ rdoc (3.12)
49
+ json (~> 1.4)
50
+ sprockets (2.1.3)
51
+ hike (~> 1.2)
52
+ rack (~> 1.0)
53
+ tilt (~> 1.1, != 1.3.0)
54
+ thor (0.15.4)
55
+ tilt (1.3.3)
56
+ tzinfo (0.3.33)
57
+
58
+ PLATFORMS
59
+ ruby
60
+
61
+ DEPENDENCIES
62
+ activerecord (~> 3.2.6)
63
+ railties (~> 3.2.6)
data/README.md ADDED
@@ -0,0 +1,69 @@
1
+ yasarg (Yet Another Standalone Active Record Gem)
2
+ ======
3
+
4
+ The goal of this gem is to facilitates the use of Active Record on non Rails
5
+ projects. The tasks in the `db` namespace that we use when developing Rails
6
+ applications are a nice part of our lifes, so this gem tries to glue this in your
7
+ application too.
8
+
9
+ Ah! almost forgot, the generators (migration and model) are available to you too.
10
+
11
+ ```
12
+ ...............................................
13
+ Hi, thank you for use yasarg
14
+ This gem is built on top of giant's shoulder
15
+ Thank you Rails team, you're awswome!
16
+ ...............................................
17
+ ```
18
+
19
+ Use rubygems to install `yasarg`:
20
+
21
+ ```
22
+ gem install yasarg
23
+ ```
24
+
25
+ Create a configuration file in your application: `config/database.yml`, like you
26
+ would do within a Rails app:
27
+
28
+ ```
29
+ # database.yml - an example
30
+ development:
31
+ adapter: sqlite3
32
+ database: db/development.sqlite3
33
+ pool: 5
34
+ timeout: 5000
35
+
36
+ test:
37
+ adapter: sqlite3
38
+ database: db/test.sqlite3
39
+ pool: 5
40
+ timeout: 5000
41
+
42
+ production:
43
+ adapter: sqlite3
44
+ database: db/production.sqlite3
45
+ pool: 5
46
+ timeout: 5000
47
+ ```
48
+
49
+ If you want the rake db tasks in your project, you can make a Rakefile with the
50
+ following code (besides your own tasks, of course).
51
+
52
+ ```
53
+ # Rakefile
54
+ require 'yasarg'
55
+ Yasarg::Tasks.load\_tasks
56
+ ```
57
+
58
+ Now you can execute the `rake db:create`, for example.
59
+
60
+ To use a generator you can use the `yasarg` executable:
61
+
62
+ ```
63
+ $ yasarg g model Contact name nascimento:date
64
+ ```
65
+
66
+ The conventions are the same used on Rails applications. The previous command will
67
+ generate: `app/models/contact.rb` and `db/migrate/[timestamp]\_create\_table\_contats.rb`
68
+
69
+ You can run `rake db:migrate` now and you are ready to go.
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/bin/yasarg ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ if ARGV.length == 0
3
+ puts "..............................................."
4
+ puts "Hi, thank you for use yasarg"
5
+ puts " This gem is built on top of giant's shoulder"
6
+ puts " Thank you Rails team, you're awswome!"
7
+ puts "...............................................\n\n"
8
+ end
9
+
10
+ lib = File.expand_path("../../lib", __FILE__)
11
+ $:.unshift lib unless $:.include?(lib)
12
+ require "yasarg"
13
+
14
+ require "rails/commands"
15
+ require "rails/commands/generate"
@@ -0,0 +1,11 @@
1
+ module Yasarg; end
2
+ class Yasarg::RailsFakeApp < Rails::Application
3
+ config.generators.options[:rails] = {
4
+ orm: :active_record
5
+ }
6
+
7
+ config.generators.options[:active_record] = {
8
+ migration: true,
9
+ timestamps: true
10
+ }
11
+ end
@@ -0,0 +1,19 @@
1
+ module Yasarg
2
+ class Tasks
3
+ def self.load_tasks
4
+ require "rails"
5
+
6
+ require File.expand_path('../../yasarg/rails_fake_app', __FILE__)
7
+ app = Yasarg::RailsFakeApp
8
+ app.load_tasks
9
+
10
+ require "active_record"
11
+ if !ActiveRecord::Base.connected?
12
+ configuration = app.config.database_configuration[Rails.env]
13
+ ActiveRecord::Base.establish_connection(configuration)
14
+ end
15
+
16
+ load "active_record/railties/databases.rake"
17
+ end
18
+ end
19
+ end
data/lib/yasarg.rb ADDED
@@ -0,0 +1,10 @@
1
+ require "rubygems"
2
+ require "rails"
3
+
4
+ lib = File.expand_path("../", __FILE__)
5
+ $:.unshift lib unless $:.include?(lib)
6
+
7
+ APP_PATH = File.expand_path("#{lib}/yasarg/rails_fake_app", __FILE__)
8
+
9
+ require "yasarg/rails_fake_app"
10
+ require "yasarg/tasks"
data/yasarg.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ Gem::Specification.new do |s|
3
+ s.name = "yasarg"
4
+ s.version = File.read(File.expand_path("../VERSION",__FILE__)).strip
5
+ s.platform = Gem::Platform::RUBY
6
+ s.authors = ["Ricardo Valeriano"]
7
+ s.email = ["ricardo.valeriano@gmail.com"]
8
+ s.homepage = "http://github.com/ricardovaleriano/yasarg"
9
+ s.summary = "Standalone migrations, generators and Active Record"
10
+ s.description = "The goal of this gem is to facilitates the use of Active Record
11
+ in non Rails projects. The tasks in the db namespace that we use when
12
+ developing Rails applications are a nice part of our lifes, so this gem tries to
13
+ glue this in your application too."
14
+
15
+ s.required_rubygems_version = ">= 0"
16
+
17
+ s.executables = ["yasarg"]
18
+ s.require_path = 'lib'
19
+ s.files = `git ls-files | sed 's/examples.*//'`.split("\n").reject{|f| f == ""}
20
+
21
+ s.add_dependency 'activerecord', '~> 3.2.6'
22
+ s.add_dependency 'railties', '~>3.2.6'
23
+ end
24
+
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yasarg
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ricardo Valeriano
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-07-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activerecord
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.6
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.6
30
+ - !ruby/object:Gem::Dependency
31
+ name: railties
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 3.2.6
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 3.2.6
46
+ description: ! "The goal of this gem is to facilitates the use of Active Record\n
47
+ \ in non Rails projects. The tasks in the db namespace that we use when\n developing
48
+ Rails applications are a nice part of our lifes, so this gem tries to\n glue
49
+ this in your application too."
50
+ email:
51
+ - ricardo.valeriano@gmail.com
52
+ executables:
53
+ - yasarg
54
+ extensions: []
55
+ extra_rdoc_files: []
56
+ files:
57
+ - .gitignore
58
+ - Gemfile
59
+ - Gemfile.lock
60
+ - README.md
61
+ - VERSION
62
+ - bin/yasarg
63
+ - lib/yasarg.rb
64
+ - lib/yasarg/rails_fake_app.rb
65
+ - lib/yasarg/tasks.rb
66
+ - yasarg.gemspec
67
+ homepage: http://github.com/ricardovaleriano/yasarg
68
+ licenses: []
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubyforge_project:
87
+ rubygems_version: 1.8.22
88
+ signing_key:
89
+ specification_version: 3
90
+ summary: Standalone migrations, generators and Active Record
91
+ test_files: []