tracker-web 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 408e568aa4fa7036b303252afff0f6575da878cf
4
+ data.tar.gz: 757bb657c1296cd155f87d6f74fd3c0a330f6079
5
+ SHA512:
6
+ metadata.gz: 35d51a4893e7726652af88823d0ec17a2e45636e7907ed32c147ac62b6fafc4f10769a002586e0d0ac97fb45202fd6e9c949f495bda7c79217d6b5cd5aa51d38
7
+ data.tar.gz: 179c61af88c94148be863c2adadfd510adb23ddae244033a188bbd7731ed5ab6a10562988293fdf781157b76bb6ffadf978c1961ef6eb8a20da8c86a25553c7e
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'tracker-application', path: '../tracker-application'
4
+ gem 'tracker-p_g', path: '../tracker-p_g'
5
+
6
+ # Specify your gem's dependencies in tracker-web.gemspec
7
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Ben Bergstein
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Tracker::Web
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'tracker-web'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install tracker-web
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,55 @@
1
+ require 'sinatra'
2
+ require "tracker/web/version"
3
+ require 'tracker/application'
4
+
5
+ module Tracker
6
+ module Web
7
+ class Application < Sinatra::Application
8
+ include Tracker::Application
9
+
10
+ get('/'){'Hello, world.'}
11
+
12
+ get('/stories/new'){erb :'stories/new'}
13
+
14
+ get('/stories/:story_id') do
15
+ result = LoadStory.perform(story_id: params[:story_id])
16
+ erb :'stories/show', locals: result.story
17
+ end
18
+
19
+ post '/stories' do
20
+ result = CreateStory.perform(title: params[:story][:title])
21
+ redirect to('/stories/%d' % result.story_id)
22
+ end
23
+
24
+ post '/stories/:story_id/parent_story_stories' do
25
+ context = {
26
+ parent_story_id: params[:story_story][:parent_story_id].to_i,
27
+ child_story_id: params[:story_id].to_i
28
+ }
29
+
30
+ result = CreateStoryStory.perform(context)
31
+ redirect to('/stories/%d' % params[:story_id])
32
+ end
33
+
34
+ post '/stories/:story_id/child_story_stories' do
35
+ context = {
36
+ parent_story_id: params[:story_id].to_i,
37
+ child_story_id: params[:story_story][:child_story_id].to_i
38
+ }
39
+
40
+ result = CreateStoryStory.perform(context)
41
+ redirect to('/stories/%d' % params[:story_id])
42
+ end
43
+
44
+ post '/story_stories' do
45
+ context = {
46
+ parent_story_id: params[:story_story][:parent_story_id].to_i,
47
+ child_story_id: params[:story_story][:child_story_id].to_i
48
+ }
49
+
50
+ result = CreateStoryStory.perform(context)
51
+ redirect to "/stories/%d" % params[:story_story][:parent_story_id]
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,5 @@
1
+ module Tracker
2
+ module Web
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,22 @@
1
+ <html>
2
+ <head>
3
+ <title>New Story</title>
4
+ </head>
5
+
6
+ <body>
7
+ <form action='/stories' method='post'>
8
+ <h1>
9
+ Create Story
10
+ </h1>
11
+
12
+ <div>
13
+ <label for='story_title'>Title</label>
14
+ <input type='text' id='story_title' name='story[title]' />
15
+ </div>
16
+
17
+ <div>
18
+ <button>Create Story</button>
19
+ </div>
20
+ </form>
21
+ </body>
22
+ </html>
@@ -0,0 +1 @@
1
+ <%= title %>
@@ -0,0 +1,7 @@
1
+ require "tracker/web/version"
2
+ require "tracker/web/application"
3
+
4
+ module Tracker
5
+ module Web
6
+ end
7
+ end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+ require 'database_cleaner'
3
+ require 'capybara/rspec'
4
+ require 'tracker/p_g'
5
+
6
+ ENV['TEST_DATABASE_URL'] ||= 'postgres://postgres@localhost:5432/new_tracker_test'
7
+ Capybara.app = Tracker::Web::Application.new
8
+
9
+ describe 'acceptance', type: :feature do
10
+ before(:all){Tracker::PG.database_url = ENV['TEST_DATABASE_URL']}
11
+ after(:all){Tracker::PG.reset!}
12
+
13
+ around do |example|
14
+ DatabaseCleaner.strategy = :truncation
15
+ example.run
16
+ DatabaseCleaner.clean
17
+ end
18
+
19
+ it 'is ok' do
20
+ visit '/stories/new'
21
+ fill_in :story_title, with: 'Story title'
22
+ click_on 'Create Story'
23
+ page.should have_content 'Story title'
24
+ end
25
+ end
@@ -0,0 +1,80 @@
1
+ require 'spec_helper'
2
+ require 'rack/test'
3
+
4
+ module Tracker
5
+ module Web
6
+ describe Application do
7
+ include Rack::Test::Methods
8
+
9
+ def app
10
+ Application.new
11
+ end
12
+
13
+ describe 'get /' do
14
+ it 'is ok' do
15
+ expect(get('/').body).to eq 'Hello, world.'
16
+ end
17
+ end
18
+
19
+ describe 'get /stories/new' do
20
+ it 'is ok' do
21
+ expect(get('/stories/new').status).to eq 200
22
+ end
23
+ end
24
+
25
+ describe 'post /stories/99' do
26
+ it 'perform LoadStory' do
27
+ result = double(success?: true, story: { id: 1, title: 'My Story' })
28
+ Application::LoadStory.stub(perform: result)
29
+ response = get('stories/99')
30
+ expect(Application::LoadStory).to have_received(:perform).with(story_id: '99')
31
+ expect(response.status).to eq 200
32
+ end
33
+ end
34
+
35
+ describe 'post /stories' do
36
+ it 'performs CreateStory' do
37
+ result = double(success?: true, story_id: 99)
38
+ Application::CreateStory.stub(perform: result)
39
+ response = post('stories', story: { title: 'My story' })
40
+ expect(Application::CreateStory).to have_received(:perform)
41
+ follow_redirect!
42
+ expect(last_request.url).to eq 'http://example.org/stories/99'
43
+ end
44
+ end
45
+
46
+ describe 'post /story_stories/:story_id/parent_story_stories' do
47
+ it 'performs CreateStoryStory' do
48
+ result = double(success?: true, story_story_id: 109)
49
+ Application::CreateStoryStory.stub(perform: result)
50
+ response = post('stories/65/parent_story_stories', story_story: { parent_story_id: 66 })
51
+ expect(Application::CreateStoryStory).to have_received(:perform).with(child_story_id: 65, parent_story_id: 66)
52
+ follow_redirect!
53
+ expect(last_request.url).to eq 'http://example.org/stories/65'
54
+ end
55
+ end
56
+
57
+ describe 'post /story_stories/:story_id/child_stories' do
58
+ it 'performs CreateStoryStory' do
59
+ result = double(success?: true, story_story_id: 109)
60
+ Application::CreateStoryStory.stub(perform: result)
61
+ response = post('stories/200/child_story_stories', story_story: { child_story_id: 201 })
62
+ expect(Application::CreateStoryStory).to have_received(:perform).with(parent_story_id: 200, child_story_id: 201)
63
+ follow_redirect!
64
+ expect(last_request.url).to eq 'http://example.org/stories/200'
65
+ end
66
+ end
67
+
68
+ describe 'post /story_stories' do
69
+ it 'performs CreateStoryStory' do
70
+ result = double(success?: true, story_story_id: 101)
71
+ Application::CreateStoryStory.stub(perform: result)
72
+ response = post('story_stories', story_story: { child_story_id: 104, parent_story_id: 103 })
73
+ expect(Application::CreateStoryStory).to have_received(:perform).with(child_story_id: 104, parent_story_id: 103)
74
+ follow_redirect!
75
+ expect(last_request.url).to eq 'http://example.org/stories/103'
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,3 @@
1
+ require 'bundler'
2
+ Bundler.require
3
+ require 'tracker/web'
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'tracker/web/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "tracker-web"
8
+ spec.version = Tracker::Web::VERSION
9
+ spec.authors = ["Ben Bergstein"]
10
+ spec.email = ["bennyjbergstein@gmail.com"]
11
+ spec.description = "Web application for a tracker app"
12
+ spec.summary = ""
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency 'tracker-application'
22
+ spec.add_dependency 'tracker-p_g'
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.3"
25
+ spec.add_development_dependency "rake"
26
+ spec.add_development_dependency "rspec"
27
+ spec.add_development_dependency "rack-test"
28
+ spec.add_development_dependency "pry"
29
+ spec.add_development_dependency "capybara"
30
+ spec.add_development_dependency "launchy"
31
+ spec.add_development_dependency "database_cleaner"
32
+
33
+ spec.add_dependency "sinatra"
34
+ end
metadata ADDED
@@ -0,0 +1,215 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tracker-web
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ben Bergstein
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: tracker-application
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: tracker-p_g
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rack-test
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: capybara
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: launchy
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: database_cleaner
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: sinatra
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ description: Web application for a tracker app
168
+ email:
169
+ - bennyjbergstein@gmail.com
170
+ executables: []
171
+ extensions: []
172
+ extra_rdoc_files: []
173
+ files:
174
+ - .gitignore
175
+ - Gemfile
176
+ - LICENSE.txt
177
+ - README.md
178
+ - Rakefile
179
+ - lib/tracker/web.rb
180
+ - lib/tracker/web/application.rb
181
+ - lib/tracker/web/version.rb
182
+ - lib/tracker/web/views/stories/new.erb
183
+ - lib/tracker/web/views/stories/show.erb
184
+ - spec/acceptance_spec.rb
185
+ - spec/application_spec.rb
186
+ - spec/spec_helper.rb
187
+ - tracker-web.gemspec
188
+ homepage: ''
189
+ licenses:
190
+ - MIT
191
+ metadata: {}
192
+ post_install_message:
193
+ rdoc_options: []
194
+ require_paths:
195
+ - lib
196
+ required_ruby_version: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - '>='
199
+ - !ruby/object:Gem::Version
200
+ version: '0'
201
+ required_rubygems_version: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - '>='
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ requirements: []
207
+ rubyforge_project:
208
+ rubygems_version: 2.0.3
209
+ signing_key:
210
+ specification_version: 4
211
+ summary: ''
212
+ test_files:
213
+ - spec/acceptance_spec.rb
214
+ - spec/application_spec.rb
215
+ - spec/spec_helper.rb