pliny 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Mjk3OWZlMTRiYjE4MmU4M2JkZDQzNjA5ODllZTNhNDQxYTBjZjRlZA==
4
+ NWRlYjI3YjI4NTRlZGYzMWQ1NTEzYjQ4ZDRmNTkyNTk0OGNiMzNlZg==
5
5
  data.tar.gz: !binary |-
6
- YjExMTc1Yzk3ZTNkODY1OTFiMWMzOGVhM2YzZTViNjk2ZGIwNDk3Mw==
6
+ NjVlZTZlNDhmODRhZTY1MDNiZDJlOGQyYmViY2U3NmUxYTNhMzIzYg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- Mzg5NWFkY2NlNzA0Y2U4MmQwYTExNTBmZGUwY2Y2YzJkMDRhNzY0ODVkM2Mz
10
- NzVhM2JmN2U0ZTc0MmViYjEyM2NhZjhhYTVmOTVlNTRiNzMzMzhhMzRhN2Fj
11
- MjBiMDQ0NjY3M2E1MTUwOTM3YjE2YWFkMDU3MzMzZTI3NWE0ZGI=
9
+ ZDNjYTczMGI3YTk2YzhlZTcxYTk5ZWYxOGUzZTVkYzBiYTM3OTEzMmRjZWRm
10
+ ZDg2ZTYwYTkxOTc5NzI0NjVkNGZkMjRkMjY1ZDVjNGU5MzNmZDc1ZDk1ODFl
11
+ YzU4N2E2ZjU2OTc3ZWQ0YjI5ODA5ZjNjZTJiOTNkYzIyZTk2ZGM=
12
12
  data.tar.gz: !binary |-
13
- YWQyMzBjMWEwNmMyOWU4ZDc5MTllOGZjM2U4NGNiZDNkMzBkOGE2NDMzNzIw
14
- NGI4ZDFlMDk1OWJjNTQ2YzdjMmI3MTE5YThkMmQ5NTRiMjQwMjFmN2Q1MTU5
15
- NzQyZjk4Y2I5NDlmMzdlYWM4NTEwNDBhOTNkMGUxYzc1M2NhNmY=
13
+ MGNhMjNiOTU3ZTJkYTBjMWZkMmVkOWE2NmQ0NWExZWJmZGZmZmU5MmY1MGQ3
14
+ MTM2Zjg4ODNkYmJmMTg0OTI2YTEwMjg1ZDAzNDAyZDUyOThhOGJmMGY2Njc5
15
+ Nzc5N2Y0MWM3YzEyYTE4ZDUyYTkzYWU1NzhkNzJmZDc2NDE2MjA=
data/README.md CHANGED
@@ -129,6 +129,7 @@ rake test # Run tests
129
129
  And provides the following commands:
130
130
 
131
131
  ```bash
132
+ $ foreman start # Starts server
132
133
  $ foreman run bin/console # IRB/Pry console
133
134
  $ foreman run bin/run 'puts "hello world"' # Run automated code
134
135
  ```
@@ -1,5 +1,6 @@
1
1
  require 'pliny/version'
2
2
  require 'fileutils'
3
+ require 'uri'
3
4
 
4
5
  module Pliny::Commands
5
6
  class Creator
@@ -16,11 +16,11 @@ module Pliny::Commands
16
16
  end
17
17
 
18
18
  def singular_class_name
19
- name.gsub(/-/, '_').singularize.camelize
19
+ name.tr('-', '_').singularize.camelize
20
20
  end
21
21
 
22
22
  def plural_class_name
23
- name.gsub(/-/, '_').pluralize.camelize
23
+ name.tr('-', '_').pluralize.camelize
24
24
  end
25
25
 
26
26
  def field_name
@@ -32,7 +32,7 @@ module Pliny::Commands
32
32
  end
33
33
 
34
34
  def table_name
35
- name.tableize.gsub('/', '_')
35
+ name.tableize.tr('/', '_')
36
36
  end
37
37
 
38
38
  def display(msg)
@@ -37,7 +37,7 @@ module Pliny::Commands
37
37
  end
38
38
 
39
39
  def url_path
40
- '/' + name.pluralize.gsub(/_/, '-')
40
+ '/' + name.pluralize.tr('_', '-')
41
41
  end
42
42
  end
43
43
  end
@@ -4,14 +4,14 @@ module Pliny::Commands
4
4
  class Generator
5
5
  class Serializer < Base
6
6
  def create
7
- serializer = "./lib/serializers/#{name}.rb"
7
+ serializer = "./lib/serializers/#{field_name}.rb"
8
8
  render_template('serializer.erb', serializer,
9
9
  singular_class_name: singular_class_name)
10
10
  display "created serializer file #{serializer}"
11
11
  end
12
12
 
13
13
  def create_test
14
- test = "./spec/serializers/#{name}_spec.rb"
14
+ test = "./spec/serializers/#{field_name}_spec.rb"
15
15
  render_template('serializer_test.erb', test,
16
16
  singular_class_name: singular_class_name)
17
17
  display "created test #{test}"
@@ -21,7 +21,7 @@ module Pliny
21
21
  def initialize(message = nil, id = nil, status = nil)
22
22
  meta = Pliny::Errors::META[self.class]
23
23
  message = message || meta[1] + "."
24
- id = id || meta[1].downcase.gsub(/ /, '_').to_sym
24
+ id = id || meta[1].downcase.tr(' ', '_').to_sym
25
25
  @status = status || meta[0]
26
26
  super(message, id)
27
27
  end
@@ -78,15 +78,11 @@ namespace :db do
78
78
  namespace :schema do
79
79
  desc "Load the database schema"
80
80
  task :load do
81
- if File.exists?("./db/schema.sql")
82
- schema = File.read("./db/schema.sql")
83
- database_urls.each do |database_url|
84
- db = Sequel.connect(database_url)
85
- db.run(schema)
86
- puts "Loaded `#{name_from_uri(database_url)}`"
87
- end
88
- else
89
- puts "Skipped schema load, schema.sql not present"
81
+ schema = File.read("./db/schema.sql")
82
+ database_urls.each do |database_url|
83
+ db = Sequel.connect(database_url)
84
+ db.run(schema)
85
+ puts "Loaded `#{name_from_uri(database_url)}`"
90
86
  end
91
87
  end
92
88
 
@@ -3,11 +3,6 @@ require "spec_helper"
3
3
  describe Endpoints::<%= plural_class_name %> do
4
4
  include Rack::Test::Methods
5
5
 
6
- def app
7
- Endpoints::<%= plural_class_name %>
8
-
9
- end
10
-
11
6
  describe "GET <%= url_path %>" do
12
7
  it "succeeds" do
13
8
  get "<%= url_path %>"
@@ -1,3 +1,3 @@
1
1
  module Pliny
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -24,6 +24,7 @@ group :development, :test do
24
24
  end
25
25
 
26
26
  group :development do
27
+ gem 'dotenv'
27
28
  gem "foreman"
28
29
  end
29
30
 
@@ -115,6 +115,7 @@ PLATFORMS
115
115
  DEPENDENCIES
116
116
  committee
117
117
  database_cleaner
118
+ dotenv
118
119
  foreman
119
120
  multi_json
120
121
  oj
@@ -9,7 +9,9 @@ function main {
9
9
  }
10
10
 
11
11
  function add_new_env_vars {
12
- touch .env
12
+ # create .env and set perms if it does not exist
13
+ [ ! -f .env ] && { touch .env ; chmod 0600 .env ; }
14
+
13
15
  export IFS=$'\n'
14
16
  for var in `cat .env.sample`; do
15
17
  key="${var%%=*}" # get var key
@@ -13,6 +13,7 @@ module Endpoints
13
13
 
14
14
  configure :development do
15
15
  register Sinatra::Reloader
16
+ also_reload '../**/*.rb'
16
17
  end
17
18
 
18
19
  error Pliny::Errors::Error do
@@ -10,17 +10,20 @@ ENV["RACK_ENV"] = "test"
10
10
  require "bundler"
11
11
  Bundler.require(:default, :test)
12
12
 
13
- root = File.expand_path("../../", __FILE__)
14
- ENV.update(Pliny::Utils.parse_env("#{root}/.env.test"))
13
+ require 'dotenv'
14
+ Dotenv.load('.env.test')
15
15
 
16
16
  require_relative "../lib/initializer"
17
17
 
18
- DatabaseCleaner.strategy = :transaction
19
-
20
18
  # pull in test initializers
21
19
  Pliny::Utils.require_glob("#{Config.root}/spec/support/**/*.rb")
22
20
 
23
21
  RSpec.configure do |config|
22
+ config.before :suite do
23
+ DatabaseCleaner.clean_with(:truncation)
24
+ DatabaseCleaner.strategy = :transaction
25
+ end
26
+
24
27
  config.before :all do
25
28
  load('db/seeds.rb') if File.exist?('db/seeds.rb')
26
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pliny
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandur Leach
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-09 00:00:00.000000000 Z
12
+ date: 2014-09-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -271,6 +271,20 @@ dependencies:
271
271
  - - ! '>='
272
272
  - !ruby/object:Gem::Version
273
273
  version: 0.7.1
274
+ - !ruby/object:Gem::Dependency
275
+ name: pry
276
+ requirement: !ruby/object:Gem::Requirement
277
+ requirements:
278
+ - - ! '>='
279
+ - !ruby/object:Gem::Version
280
+ version: '0'
281
+ type: :development
282
+ prerelease: false
283
+ version_requirements: !ruby/object:Gem::Requirement
284
+ requirements:
285
+ - - ! '>='
286
+ - !ruby/object:Gem::Version
287
+ version: '0'
274
288
  description: Pliny is a set of base classes and helpers to help developers write excellent
275
289
  APIs in Sinatra
276
290
  email: