postmod 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 606b9bd1ad3fb80f86c9758beb347f5abc4d1189
4
- data.tar.gz: ede68944108a10ced83d986471efea50fbb5e890
3
+ metadata.gz: d27d6be9810d1bedaac3defd784c63692cbb8ad4
4
+ data.tar.gz: 7763daeb3aec535f7ec0eb90e03d624e6d2a987b
5
5
  SHA512:
6
- metadata.gz: b489bd4d200947bc2078daa64de7115d62f1afd2391698d2bbbd8693d4feece6ed680467f46ada9a0b8d659e3f50a0dd3f4b392aa97e37caa703f19ed754f7fa
7
- data.tar.gz: 7d0dcd2bfc224350044762c9feb2d07e37081a067994295d875f69f953ae800b1986b99727ea97290367e24f39b8c276bc05f18d92f6d788607740977487682c
6
+ metadata.gz: 5dde0f6c974ad7f2b9711b2838ce1cd90c7fc2631255899f5dcc7b4b526fffee33cd5f4e9938dcc38d0871dec28439cfa72bf7cac40aa8d668d5a4320ce27250
7
+ data.tar.gz: e2b4d647f28e03a8b7a69c1ff7d35a99fe106895c38e249562cd0b513465f0dc92df73bdb920c8de87ca0798a665203e922f8e2d8e62f7f7100131158799c3bf
data/bin/postmod CHANGED
@@ -17,7 +17,7 @@ action = "Postmod::#{action_name}".constantize
17
17
 
18
18
  if subcommand == 'generate/model'
19
19
  action.(ARGV[1], ARGV[2..-1])
20
- lse
20
+ else
21
21
  action.(*ARGV[1..-1])
22
22
  end
23
23
 
@@ -22,10 +22,11 @@ module Postmod
22
22
  FileUtils.cp_r(Dir.glob(project_template_path + "/*"), project_path)
23
23
  File.write("#{project_path}/.ruby-version", '2.2.2')
24
24
  File.write("#{project_path}/.ruby-version", '2.2.2')
25
+ File.write("#{project_path}/.env", "export DATABASE_URL=postgres:///#{project_name}_dev")
25
26
  end
26
27
 
27
28
  def create_lib
28
- Postmod::Generate::Module.("#{project_path}/lib/#{project_name}")
29
+ Generate::Module.("#{project_path}/lib/#{project_name}")
29
30
  end
30
31
 
31
32
  def create_db
@@ -37,9 +38,11 @@ module Postmod
37
38
  end
38
39
 
39
40
  def create_bin
40
-
41
41
  File.open("#{project_path}/bin/console", 'w') do |console_file|
42
42
  console_file.puts '#!/usr/bin/env ruby'
43
+ console_file.puts "require 'pry'"
44
+ console_file.puts "require_relative '../lib/#{project_name}'"
45
+ console_file.puts "ActiveRecord::Base.establish_connection"
43
46
  console_file.puts "#{project_name.capitalize}.pry"
44
47
  end
45
48
  `chmod u+x #{project_path}/bin/console`
@@ -75,4 +78,6 @@ module Postmod
75
78
  end
76
79
 
77
80
  end
81
+
82
+ Dir["#{__FILE__.gsub(/\.rb$/, '')}/*.rb"].each {|file| require file }
78
83
  end
@@ -31,6 +31,8 @@ module Postmod::Generate
31
31
 
32
32
  def model_content
33
33
  <<ACTION_FILE
34
+ require 'active_record'
35
+
34
36
  class #{model_name} < ActiveRecord::Base
35
37
 
36
38
  end
@@ -4,7 +4,7 @@ module Postmod::Generate
4
4
  Module = Postmod::Action.new(:module_path) do
5
5
 
6
6
  def call
7
- Dir.mkdir(module_path)
7
+ FileUtils.mkdir_p(module_path)
8
8
 
9
9
  File.open(module_filename, 'w') do |file|
10
10
  file.puts module_content
@@ -1,7 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'postmod', git: 'git://github.com/victormours/postmod.git'
4
-
5
3
  group :web do
6
4
  gem 'chaplin', git: 'git://github.com/victormours/chaplin.git'
7
5
  end
@@ -10,12 +8,16 @@ group :lib do
10
8
  gem 'pg'
11
9
  end
12
10
 
13
- group :data_store do
11
+ group :bin do
12
+ gem 'pry'
13
+ end
14
+
15
+ group :db do
14
16
  gem 'activerecord'
15
17
  gem 'standalone_migrations'
16
18
  end
17
19
 
18
20
  group :development do
21
+ gem 'postmod', git: 'git://github.com/victormours/postmod.git'
19
22
  gem 'dotenv'
20
- gem 'pry'
21
23
  end
@@ -1,5 +1,7 @@
1
1
  require 'sinatra/base'
2
2
  require 'json'
3
3
 
4
+ ActiveRecord::Base.establish_connection
5
+
4
6
  class Api < Sinatra::Application
5
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postmod
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Mours
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-15 00:00:00.000000000 Z
11
+ date: 2015-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chaplin