sinatra-partial 0.4.0 → 1.0.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 02897de934c58caded69838e41e9fb8a45cb480e
4
+ data.tar.gz: 9ca02c4ebcd68a7f3105c7e8cc422ae667c77ca3
5
+ SHA512:
6
+ metadata.gz: 4c2861c9166d9cd273bbd4d9b1da0315b7d18132816e4b1087d8968c67b089294d8bfbc680456360b3ae2d688254f1ade05a96128889119aec839a1045950f5e
7
+ data.tar.gz: 8b7994bc6fb12a8eb6c5c36d75aef9b39993a6011625cd421a42dd371735315a997bcde8379b56be81271a704f5d9c08b8a0ffe50da4083d579da0b84a8fa0ad
data/.gitignore CHANGED
@@ -12,6 +12,7 @@ app/.sass-cache/
12
12
  .bundle/
13
13
  Gemfile.lock
14
14
  vendor/
15
+ vendor.noindex/
15
16
  .yardoc/
16
17
  bin/
17
18
  docs/
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
- --format nested
1
+ --format documentation
2
2
  --color
@@ -1,16 +1,21 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.8.7
4
- - 1.9.2
5
- - 1.9.3
6
- - ruby-head
7
- - jruby-19mode
3
+ - 2.0.0
4
+ - 2.1.0
5
+ - 2.2.2
6
+ - jruby-19mode # JRuby in 1.9 mode
8
7
  - rbx
9
- bundler_args: --binstubs --path vendor
10
- script: bundle exec rspec spec
8
+ - ruby-head
9
+ - jruby-head
11
10
 
12
11
  # whitelist
13
12
  branches:
14
13
  only:
15
14
  - master
16
- - develop
15
+ - develop
16
+
17
+ matrix:
18
+ allow_failures:
19
+ - rvm: jruby-head
20
+ - rvm: ruby-head
21
+ - rvm: rbx
@@ -1,9 +1,22 @@
1
+ ## Upcoming ##
2
+
3
+ ## v1.0.0, 7th of April 2015 ##
4
+
5
+ * Dropped support for pre-v2 Ruby. There's no changes within the library itself that should stop it working at this point, but that doesn't mean that it's supported.
6
+ * Changes because of updates to other libs. By that, I mean the ever changing RSpec API.
7
+ * Release because of http://blog.rubygems.org/2016/04/06/gem-replacement-vulnerability-and-mitigation.html
8
+ * Move to 1.0.0 for semver, this gem has been stable for a long time.
9
+
10
+ ----
11
+
12
+
1
13
  ## v0.4.0 ##
2
14
 
3
15
  10th of December 2012
4
16
 
5
17
  * Fixed example in README, re issue#4, thanks to [@moollaza](https://github.com/moollaza) for pointing it out.
6
18
  * better handling of paths, which helps fix a (hopefully rare) error when a dot is in the path.
19
+ * Fix for some errors on 1.8.7 and 1.9.2 builds when run on Travis. Thanks to [@petems](https://github.com/petems)."
7
20
 
8
21
  ----
9
22
 
data/Gemfile CHANGED
@@ -1,8 +1,13 @@
1
- source :rubygems
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem "rake"
2
6
 
3
7
  group :development do
4
- gem "rake"
5
- gem "wirble"
8
+ unless RUBY_ENGINE == 'jruby' || RUBY_ENGINE == "rbx"
9
+ gem "pry-byebug"
10
+ end
6
11
  gem "reek"
7
12
  gem "maruku"
8
13
  gem "yard"
@@ -10,11 +15,11 @@ group :development do
10
15
  end
11
16
 
12
17
  group :test do
13
- gem "rake"
14
18
  gem "rack-test"
15
19
  gem "rspec"
20
+ gem "rspec-its"
16
21
  gem "simplecov"
17
- gem "sinatra"
18
22
  gem "haml"
19
23
  gem 'timecop'
24
+ gem "slim"
20
25
  end
@@ -12,7 +12,7 @@ Develop branch:
12
12
 
13
13
  ### Quick note ###
14
14
 
15
- If you do decide to use this gem, please let me know if it isn't working for you - make a contribution! Github makes it so simple..! See the Contribution section for more.
15
+ If you do decide to use this gem, please let me know if it isn't working for you - make a contribution! Github makes it so simple..! See the [Contribution section](#Contributing) for more.
16
16
 
17
17
  Back to our previously scheduled programming...
18
18
 
@@ -60,6 +60,9 @@ If you like the Rails convention of adding an underscore to the beginning of a p
60
60
 
61
61
  Otherwise, the default is for no underscore (if you like Rails you know where to get it;)
62
62
 
63
+ *Note:*
64
+
65
+ If you're using [Slim](https://rubygems.org/gems/slim) then there are examples in the examples directory, but the output is slightly different for some reason and [the project maintainers don't wish to be helpful](https://github.com/stonean/slim/issues/328). I don't use Slim, if you do then feel free to contribute and find out how to get the specs to pass, but I won't be pursuing this.
63
66
 
64
67
  ### Some examples ###
65
68
 
@@ -223,9 +226,10 @@ To contribute some code:
223
226
  * Run `reek PATH_TO_FILE_WITH_YOUR_CHANGES` and see if it gives you any good advice. You don't have to do what it says, just consider it.
224
227
  * Run specs to make sure you've not broken anything. If it doesn't pass all the specs it doesn't get in.
225
228
  - Have a look at coverage/index.htm and see if all your code was checked. We're trying for 100% code coverage.
229
+ - If your commit changes the way things work or adds a feature then add an example in the examples dir. The specs run off the examples to make sure the library works with a real project while keeping the examples up to date, so make sure you add something there if needs be.
226
230
  * Run `bin/rake docs` to generate documentation.
227
231
  - Open up docs/index.html and check your documentation has been added and is clear.
228
- * Add a short summary of your changes to the CHANGES file. Add your name and a link to your bio/website if you like too.
232
+ * Add a short summary of your changes to the top of CHANGES file. Add your name and a link to your bio/website if you like too. **Don't** add a version number, I'll handle that.
229
233
  * Send me a pull request.
230
234
  - Don't merge into the develop branch!
231
235
  - Don't merge into the master branch!
@@ -0,0 +1,23 @@
1
+ require 'sinatra/base'
2
+ require 'slim'
3
+ require File.expand_path( File.join File.dirname(__FILE__), "../ext/kernel.rb")
4
+ require_relative "../../lib/sinatra/partial.rb"
5
+ require_relative "../whitespace_remove.rb"
6
+
7
+ module AppNoUnderscoresAndSlim
8
+ class App < Sinatra::Base
9
+ register Sinatra::Partial
10
+ use WhiteSpaceRemove
11
+
12
+ configure do
13
+ set :news, ["This", "is", "all", "new"]
14
+ set :partial_template_engine, :slim
15
+ end
16
+
17
+
18
+ get "/" do
19
+ magic = partial :magic
20
+ slim :home, :locals => { :show_me_magic => magic }
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,13 @@
1
+ # encoding: utf-8
2
+
3
+ module AppNoUnderscoresAndSlim
4
+
5
+ require_relative "./app.rb"
6
+
7
+ def self.app
8
+ Rack::Builder.app do
9
+ run App
10
+ end
11
+ end # self.app
12
+
13
+ end
@@ -0,0 +1,14 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ Bundler.require
6
+
7
+ root = File.expand_path File.dirname(__FILE__)
8
+ require File.join( root , "./config.rb" )
9
+
10
+ # everything else separate module/file (config.rb) to make it easier to set up tests
11
+
12
+ map "/" do
13
+ run AppNoUnderscoresAndSlim.app
14
+ end
@@ -0,0 +1,2 @@
1
+ p Hello, World
2
+ == show_me_magic
@@ -0,0 +1,11 @@
1
+ html
2
+ head
3
+ body
4
+ == partial :meta
5
+
6
+ ul
7
+ == partial :news, :collection => settings.news, :locals => {:klass => {:class => "klassic"}}
8
+
9
+ == partial :locality, :locals => Hash[%w{a b c d}.zip(%w{A B C D})]
10
+
11
+ == yield
@@ -0,0 +1,4 @@
1
+ p= "A is #{a}"
2
+ p= "B is #{b}"
3
+ p= "C is #{c}"
4
+ p= "D is #{d}"
@@ -0,0 +1,2 @@
1
+ p
2
+ | Time is #{Time.now.localtime}
@@ -0,0 +1,2 @@
1
+ li{*klass}
2
+ = news
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module Partial
3
- VERSION = "0.4.0"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.description = %q{Just the partials helper in a gem. That is all.}
14
14
  s.license = 'MIT'
15
15
 
16
- s.add_dependency 'sinatra'
16
+ s.add_dependency 'sinatra', "~>1.4"
17
17
 
18
18
  s.files = `git ls-files`.split("\n")
19
19
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -8,24 +8,29 @@ require_relative "../examples/app_no_underscores/config.rb"
8
8
  require_relative "../examples/app_with_underscores/config.rb"
9
9
  require_relative "../examples/app_with_underscores_and_erb/config.rb"
10
10
  require_relative "../examples/app_with_underscores_and_erb_and_subdirs/config.rb"
11
+ #require_relative "../examples/app_no_underscores_and_slim/config.rb"
11
12
 
12
- shared_examples_for "all in examples dir" do
13
- let(:expected) { "<html><head></head><body><p>Time is #{Time.now}</p><ul><li class='klassic'>This</li><li class='klassic'>is</li><li class='klassic'>all</li><li class='klassic'>new</li></ul><p>A is A</p><p>B is B</p><p>C is C</p><p>D is D</p><p>Hello, World</p><p>Show me magic!</p></body></html>" }
14
- subject { browser.last_response }
15
- it { should be_ok }
16
- it { subject.body.should == expected }
13
+
14
+ shared_context "Running different apps" do |c|
15
+ include Rack::Test::Methods
16
+ let(:app){ c.app }
17
+ before{ get '/' }
17
18
  end
18
19
 
19
- def new_session( app )
20
- Rack::Test::Session.new(Rack::MockSession.new( app ) )
20
+
21
+ shared_examples_for "all in examples dir" do
22
+ subject { last_response }
23
+ it { should be_ok }
24
+ its(:body) { should == expected }
21
25
  end
22
26
 
23
- Apps = [AppNoUnderscores, AppWithUnderscores, AppWithUnderscoresAndErb, AppWithUnderscoresAndErbAndSubdirs]
24
27
 
25
- Apps.each do |app|
26
- describe app.to_s do
27
- let(:browser){ new_session( app.app ) }
28
- before{ browser.get '/' }
29
- it_should_behave_like "all in examples dir"
28
+ [AppNoUnderscores, AppWithUnderscores, AppWithUnderscoresAndErb, AppWithUnderscoresAndErbAndSubdirs
29
+ ].each do |c|
30
+ describe c.to_s do
31
+ include_context "Running different apps", c
32
+ it_should_behave_like "all in examples dir" do
33
+ let(:expected) { "<html><head></head><body><p>Time is #{Time.now}</p><ul><li class='klassic'>This</li><li class='klassic'>is</li><li class='klassic'>all</li><li class='klassic'>new</li></ul><p>A is A</p><p>B is B</p><p>C is C</p><p>D is D</p><p>Hello, World</p><p>Show me magic!</p></body></html>" }
34
+ end
30
35
  end
31
36
  end
@@ -1,6 +1,7 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  require 'rspec'
4
+ require 'rspec/its'
4
5
  Spec_dir = File.expand_path( File.dirname __FILE__ )
5
6
  unless Kernel.respond_to?(:require_relative)
6
7
  module Kernel
@@ -39,5 +40,6 @@ RSpec.configure do |config|
39
40
  end
40
41
 
41
42
  # freeze time!
43
+ require 'date'
42
44
  require 'timecop'
43
45
  Timecop.freeze( Date.today )
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-partial
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
5
- prerelease:
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Chris Schneider
@@ -11,24 +10,22 @@ authors:
11
10
  autorequire:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2012-12-10 00:00:00.000000000 Z
13
+ date: 2016-04-07 00:00:00.000000000 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: sinatra
18
17
  requirement: !ruby/object:Gem::Requirement
19
- none: false
20
18
  requirements:
21
- - - ! '>='
19
+ - - ~>
22
20
  - !ruby/object:Gem::Version
23
- version: '0'
21
+ version: '1.4'
24
22
  type: :runtime
25
23
  prerelease: false
26
24
  version_requirements: !ruby/object:Gem::Requirement
27
- none: false
28
25
  requirements:
29
- - - ! '>='
26
+ - - ~>
30
27
  - !ruby/object:Gem::Version
31
- version: '0'
28
+ version: '1.4'
32
29
  description: Just the partials helper in a gem. That is all.
33
30
  email:
34
31
  - iainspeed@gmail.com
@@ -52,6 +49,15 @@ files:
52
49
  - examples/app_no_underscores/views/magic.haml
53
50
  - examples/app_no_underscores/views/meta.haml
54
51
  - examples/app_no_underscores/views/news.haml
52
+ - examples/app_no_underscores_and_slim/app.rb
53
+ - examples/app_no_underscores_and_slim/config.rb
54
+ - examples/app_no_underscores_and_slim/config.ru
55
+ - examples/app_no_underscores_and_slim/views/home.slim
56
+ - examples/app_no_underscores_and_slim/views/layout.slim
57
+ - examples/app_no_underscores_and_slim/views/locality.slim
58
+ - examples/app_no_underscores_and_slim/views/magic.slim
59
+ - examples/app_no_underscores_and_slim/views/meta.slim
60
+ - examples/app_no_underscores_and_slim/views/news.slim
55
61
  - examples/app_with_underscores/app.rb
56
62
  - examples/app_with_underscores/config.rb
57
63
  - examples/app_with_underscores/config.ru
@@ -91,31 +97,29 @@ files:
91
97
  homepage: https://github.com/yb66/Sinatra-Partial
92
98
  licenses:
93
99
  - MIT
100
+ metadata: {}
94
101
  post_install_message:
95
102
  rdoc_options: []
96
103
  require_paths:
97
104
  - lib
98
105
  required_ruby_version: !ruby/object:Gem::Requirement
99
- none: false
100
106
  requirements:
101
- - - ! '>='
107
+ - - '>='
102
108
  - !ruby/object:Gem::Version
103
109
  version: '0'
104
110
  required_rubygems_version: !ruby/object:Gem::Requirement
105
- none: false
106
111
  requirements:
107
- - - ! '>='
112
+ - - '>='
108
113
  - !ruby/object:Gem::Version
109
114
  version: '0'
110
115
  requirements: []
111
116
  rubyforge_project:
112
- rubygems_version: 1.8.24
117
+ rubygems_version: 2.0.14
113
118
  signing_key:
114
- specification_version: 3
119
+ specification_version: 4
115
120
  summary: A sinatra extension for render partials.
116
121
  test_files:
117
122
  - spec/examples_spec.rb
118
123
  - spec/sinatra_partial_helpers_spec.rb
119
124
  - spec/sinatra_partial_private_spec.rb
120
125
  - spec/spec_helper.rb
121
- has_rdoc: