paltrow 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
+ SHA256:
3
+ metadata.gz: 91e1e729ab1f4f6160a6d5b0a05184a37c3ffdf71921b8ff05c5b6afba4bb998
4
+ data.tar.gz: 75a1cbf23c47f7488be4f7fe2d77f0203418bfa97ef5c42f9c2700fe29a43bc7
5
+ SHA512:
6
+ metadata.gz: 50b26eec705cec8605f34f6ec0b91c470bd357b69c12fe9f75b7a770c8462871b2413bc2ce9d8461b13918b151786b4ff527e36edb767836068b50ab2ddfd454
7
+ data.tar.gz: 9ec7884a27eb091b673f9050ac261bf3a631a8fe3718a3578596bcd8d430dba9defb32db7f0c57d610cf71929c2e838daf2d1795f2ac15cef96e20468898a852
data/.gitignore ADDED
@@ -0,0 +1,176 @@
1
+
2
+ # Created by https://www.toptal.com/developers/gitignore/api/osx,vim,ruby,rails
3
+ # Edit at https://www.toptal.com/developers/gitignore?templates=osx,vim,ruby,rails
4
+
5
+ ### OSX ###
6
+ # General
7
+ .DS_Store
8
+ .AppleDouble
9
+ .LSOverride
10
+
11
+ # Icon must end with two \r
12
+ Icon
13
+
14
+ # Thumbnails
15
+ ._*
16
+
17
+ # Files that might appear in the root of a volume
18
+ .DocumentRevisions-V100
19
+ .fseventsd
20
+ .Spotlight-V100
21
+ .TemporaryItems
22
+ .Trashes
23
+ .VolumeIcon.icns
24
+ .com.apple.timemachine.donotpresent
25
+
26
+ # Directories potentially created on remote AFP share
27
+ .AppleDB
28
+ .AppleDesktop
29
+ Network Trash Folder
30
+ Temporary Items
31
+ .apdisk
32
+
33
+ ### Rails ###
34
+ *.rbc
35
+ capybara-*.html
36
+ .rspec
37
+ /db/*.sqlite3
38
+ /db/*.sqlite3-journal
39
+ /db/*.sqlite3-[0-9]*
40
+ /public/system
41
+ /coverage/
42
+ /spec/tmp
43
+ *.orig
44
+ rerun.txt
45
+ pickle-email-*.html
46
+
47
+ # Ignore all logfiles and tempfiles.
48
+ /log/*
49
+ /tmp/*
50
+ !/log/.keep
51
+ !/tmp/.keep
52
+
53
+ # TODO Comment out this rule if you are OK with secrets being uploaded to the repo
54
+ config/initializers/secret_token.rb
55
+ config/master.key
56
+
57
+ # Only include if you have production secrets in this file, which is no longer a Rails default
58
+ # config/secrets.yml
59
+
60
+ # dotenv, dotenv-rails
61
+ # TODO Comment out these rules if environment variables can be committed
62
+ .env
63
+ .env.*
64
+
65
+ ## Environment normalization:
66
+ /.bundle
67
+ /vendor/bundle
68
+
69
+ # these should all be checked in to normalize the environment:
70
+ # Gemfile.lock, .ruby-version, .ruby-gemset
71
+
72
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
73
+ .rvmrc
74
+
75
+ # if using bower-rails ignore default bower_components path bower.json files
76
+ /vendor/assets/bower_components
77
+ *.bowerrc
78
+ bower.json
79
+
80
+ # Ignore pow environment settings
81
+ .powenv
82
+
83
+ # Ignore Byebug command history file.
84
+ .byebug_history
85
+
86
+ # Ignore node_modules
87
+ node_modules/
88
+
89
+ # Ignore precompiled javascript packs
90
+ /public/packs
91
+ /public/packs-test
92
+ /public/assets
93
+
94
+ # Ignore yarn files
95
+ /yarn-error.log
96
+ yarn-debug.log*
97
+ .yarn-integrity
98
+
99
+ # Ignore uploaded files in development
100
+ /storage/*
101
+ !/storage/.keep
102
+
103
+ ### Ruby ###
104
+ *.gem
105
+ /.config
106
+ /InstalledFiles
107
+ /pkg/
108
+ /spec/reports/
109
+ /spec/examples.txt
110
+ /test/tmp/
111
+ /test/version_tmp/
112
+ /tmp/
113
+
114
+ # Used by dotenv library to load environment variables.
115
+ # .env
116
+
117
+ # Ignore Byebug command history file.
118
+
119
+ ## Specific to RubyMotion:
120
+ .dat*
121
+ .repl_history
122
+ build/
123
+ *.bridgesupport
124
+ build-iPhoneOS/
125
+ build-iPhoneSimulator/
126
+
127
+ ## Specific to RubyMotion (use of CocoaPods):
128
+ #
129
+ # We recommend against adding the Pods directory to your .gitignore. However
130
+ # you should judge for yourself, the pros and cons are mentioned at:
131
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
132
+ # vendor/Pods/
133
+
134
+ ## Documentation cache and generated files:
135
+ /.yardoc/
136
+ /_yardoc/
137
+ /doc/
138
+ /rdoc/
139
+
140
+ /.bundle/
141
+ /lib/bundler/man/
142
+
143
+ # for a library or gem, you might want to ignore these files since the code is
144
+ # intended to run in multiple environments; otherwise, check them in:
145
+ # Gemfile.lock
146
+ # .ruby-version
147
+ # .ruby-gemset
148
+
149
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
150
+
151
+ # Used by RuboCop. Remote config files pulled in from inherit_from directive.
152
+ # .rubocop-https?--*
153
+
154
+ ### Vim ###
155
+ # Swap
156
+ [._]*.s[a-v][a-z]
157
+ !*.svg # comment out if you don't need vector files
158
+ [._]*.sw[a-p]
159
+ [._]s[a-rt-v][a-z]
160
+ [._]ss[a-gi-z]
161
+ [._]sw[a-p]
162
+
163
+ # Session
164
+ Session.vim
165
+ Sessionx.vim
166
+
167
+ # Temporary
168
+ .netrwhist
169
+ *~
170
+ # Auto-generated tag files
171
+ tags
172
+ # Persistent undo
173
+ [._]*.un~
174
+
175
+ # End of https://www.toptal.com/developers/gitignore/api/osx,vim,ruby,rails
176
+
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.3
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.6.6
6
+ before_install: gem install bundler -v 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem "rake", "~> 12.0"
6
+ gem "minitest", "~> 5.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,79 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ paltrow (0.0.1)
5
+ dry-struct (~> 1.4)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ concurrent-ruby (1.1.8)
12
+ diff-lcs (1.4.4)
13
+ dry-configurable (0.12.1)
14
+ concurrent-ruby (~> 1.0)
15
+ dry-core (~> 0.5, >= 0.5.0)
16
+ dry-container (0.7.2)
17
+ concurrent-ruby (~> 1.0)
18
+ dry-configurable (~> 0.1, >= 0.1.3)
19
+ dry-core (0.5.0)
20
+ concurrent-ruby (~> 1.0)
21
+ dry-inflector (0.2.0)
22
+ dry-logic (1.2.0)
23
+ concurrent-ruby (~> 1.0)
24
+ dry-core (~> 0.5, >= 0.5)
25
+ dry-struct (1.4.0)
26
+ dry-core (~> 0.5, >= 0.5)
27
+ dry-types (~> 1.5)
28
+ ice_nine (~> 0.11)
29
+ dry-types (1.5.1)
30
+ concurrent-ruby (~> 1.0)
31
+ dry-container (~> 0.3)
32
+ dry-core (~> 0.5, >= 0.5)
33
+ dry-inflector (~> 0.1, >= 0.1.2)
34
+ dry-logic (~> 1.0, >= 1.0.2)
35
+ ice_nine (0.11.2)
36
+ minitest (5.14.4)
37
+ parallel (1.20.1)
38
+ parser (3.0.1.0)
39
+ ast (~> 2.4.1)
40
+ rainbow (3.0.0)
41
+ rake (12.3.3)
42
+ regexp_parser (2.1.1)
43
+ rexml (3.2.5)
44
+ rspec-mocks (3.10.0)
45
+ diff-lcs (>= 1.2.0, < 2.0)
46
+ rspec-support (~> 3.10.0)
47
+ rspec-support (3.10.2)
48
+ rubocop (1.12.1)
49
+ parallel (~> 1.10)
50
+ parser (>= 3.0.0.0)
51
+ rainbow (>= 2.2.2, < 4.0)
52
+ regexp_parser (>= 1.8, < 3.0)
53
+ rexml
54
+ rubocop-ast (>= 1.2.0, < 2.0)
55
+ ruby-progressbar (~> 1.7)
56
+ unicode-display_width (>= 1.4.0, < 3.0)
57
+ rubocop-ast (1.4.1)
58
+ parser (>= 2.7.1.5)
59
+ rubocop-performance (1.10.1)
60
+ rubocop (>= 0.90.0, < 2.0)
61
+ rubocop-ast (>= 0.4.0)
62
+ ruby-progressbar (1.11.0)
63
+ standard (1.0.5)
64
+ rubocop (= 1.12.1)
65
+ rubocop-performance (= 1.10.1)
66
+ unicode-display_width (2.0.0)
67
+
68
+ PLATFORMS
69
+ ruby
70
+
71
+ DEPENDENCIES
72
+ minitest (~> 5.0)
73
+ paltrow!
74
+ rake (~> 12.0)
75
+ rspec-mocks (= 3.10)
76
+ standard (~> 1.0)
77
+
78
+ BUNDLED WITH
79
+ 2.1.4
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # Paltrow
2
+
3
+ Conciously decouple from Ruby web frameworks.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'paltrow'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install paltrow
20
+
21
+ ## Usage
22
+
23
+ * No usage instructions yet
24
+ * Currently Paltrow only contains `Page` and `View` which can be used to store details of screens to render
25
+ * More to come!
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/johngallagher/paltrow.
36
+
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+ require "standard/rake"
4
+
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.ruby_opts << "-r test_helper"
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/*_test.rb"]
10
+ t.warning = false
11
+ end
12
+
13
+ task default: ["standard:fix", :test]
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "paltrow"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/lib/paltrow.rb ADDED
@@ -0,0 +1,9 @@
1
+ require "dry-struct"
2
+ require "paltrow/version"
3
+ require "paltrow/message"
4
+ require "paltrow/view"
5
+ require "paltrow/page"
6
+
7
+ module Paltrow
8
+ class Error < StandardError; end
9
+ end
@@ -0,0 +1,30 @@
1
+ module Paltrow
2
+ class Message < Dry::Struct
3
+ attribute :text?, Dry.Types::String.optional.default("".freeze)
4
+ attribute :success, Dry.Types::Bool.optional.default(true)
5
+
6
+ def success?
7
+ success
8
+ end
9
+
10
+ def failure?
11
+ !success?
12
+ end
13
+
14
+ def notice
15
+ success? ? text : ""
16
+ end
17
+
18
+ def alert
19
+ failure? ? text : ""
20
+ end
21
+
22
+ def self.notice a_notice
23
+ new(text: a_notice, success: true)
24
+ end
25
+
26
+ def self.alert an_alert
27
+ new(text: an_alert, success: false)
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,31 @@
1
+ module Paltrow
2
+ class Page < Dry::Struct
3
+ attribute :controller, Dry.Types::String
4
+ attribute :action, Dry.Types::String.enum("new", "edit", "show", "index")
5
+ attribute :query?, Dry.Types::Hash.optional.default({}.freeze)
6
+ attribute :resource_ids?, Dry.Types::Hash.optional.default({}.freeze)
7
+ attribute :message?, Message.default { Message.new }
8
+
9
+ def to_params
10
+ {controller: controller, action: action}
11
+ .merge(query)
12
+ .merge(resource_ids)
13
+ end
14
+
15
+ def notice
16
+ message.notice
17
+ end
18
+
19
+ def alert
20
+ message.alert
21
+ end
22
+
23
+ def with_notice a_notice
24
+ new(message: Message.notice(a_notice))
25
+ end
26
+
27
+ def with_alert an_alert
28
+ new(message: Message.alert(an_alert))
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,3 @@
1
+ module Paltrow
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,24 @@
1
+ module Paltrow
2
+ class View < Dry::Struct
3
+ attribute :controller, Dry.Types::String
4
+ attribute :action, Dry.Types::String.enum("new", "edit", "show", "index")
5
+ attribute :locals?, Dry.Types::Hash.optional.default({}.freeze)
6
+ attribute :message?, Message.default { Message.new }
7
+
8
+ def notice
9
+ message.notice
10
+ end
11
+
12
+ def alert
13
+ message.alert
14
+ end
15
+
16
+ def with_notice a_notice
17
+ new(message: Message.notice(a_notice))
18
+ end
19
+
20
+ def with_alert an_alert
21
+ new(message: Message.alert(an_alert))
22
+ end
23
+ end
24
+ end
data/paltrow.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ require_relative "lib/paltrow/version"
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "paltrow"
5
+ spec.version = Paltrow::VERSION
6
+ spec.authors = ["John Gallagher"]
7
+ spec.email = ["john@synapticmishap.co.uk"]
8
+
9
+ spec.summary = "Conciously decouple from your framework"
10
+ spec.description = "Write your web app in plain old Ruby then plug into any web framework"
11
+ spec.homepage = "https://github.com/johngallagher/paltrow"
12
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.6.6")
13
+
14
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = spec.homepage
18
+ spec.metadata["changelog_uri"] = "https://github.com/johngallagher/paltrow/CHANGELOG.md"
19
+
20
+ spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
21
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ end
23
+ spec.bindir = "exe"
24
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
+ spec.require_paths = ["lib"]
26
+
27
+ spec.add_runtime_dependency "dry-struct", "~> 1.4"
28
+ spec.add_development_dependency "standard", "~> 1.0"
29
+ spec.add_development_dependency "rspec-mocks", "= 3.10"
30
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: paltrow
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - John Gallagher
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-04-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dry-struct
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: standard
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec-mocks
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: '3.10'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: '3.10'
55
+ description: Write your web app in plain old Ruby then plug into any web framework
56
+ email:
57
+ - john@synapticmishap.co.uk
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".ruby-version"
64
+ - ".travis.yml"
65
+ - Gemfile
66
+ - Gemfile.lock
67
+ - README.md
68
+ - Rakefile
69
+ - bin/console
70
+ - bin/setup
71
+ - lib/paltrow.rb
72
+ - lib/paltrow/message.rb
73
+ - lib/paltrow/page.rb
74
+ - lib/paltrow/version.rb
75
+ - lib/paltrow/view.rb
76
+ - paltrow.gemspec
77
+ homepage: https://github.com/johngallagher/paltrow
78
+ licenses: []
79
+ metadata:
80
+ homepage_uri: https://github.com/johngallagher/paltrow
81
+ source_code_uri: https://github.com/johngallagher/paltrow
82
+ changelog_uri: https://github.com/johngallagher/paltrow/CHANGELOG.md
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: 2.6.6
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubygems_version: 3.1.6
99
+ signing_key:
100
+ specification_version: 4
101
+ summary: Conciously decouple from your framework
102
+ test_files: []