hanami-reloader 0.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6e9a07925bf04c0028296a0e3dc42467200946f8
4
+ data.tar.gz: 763b859625a1740005b3d9f87228fc525b74677e
5
+ SHA512:
6
+ metadata.gz: dfead2039abf30b2d9573d5505880ba819f05734e03c6233cc7ca6cfb1722c804aa284f3177fc8378f947028121513c3298478a2a0436ef3454889d69a281f6b
7
+ data.tar.gz: fc4faf344a7353d796e8322b922b499fd28a53d5fcd92ebc3a6cbcf055d1244f6fc96f236ff202ab447ac8d7a54fe425c2f544a07971442e5203d3833a29251c
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,37 @@
1
+ # Please keep AllCops, Bundler, Layout, Style, Metrics groups and then order cops
2
+ # alphabetically
3
+ #
4
+ # References:
5
+ # * https://github.com/bbatsov/ruby-style-guide
6
+ # * https://rubocop.readthedocs.io/
7
+ AllCops:
8
+ DisplayCopNames: true
9
+ DisplayStyleGuide: true
10
+ ExtraDetails: false
11
+ TargetRubyVersion: 2.3
12
+ Bundler/OrderedGems:
13
+ Enabled: false
14
+ Metrics/BlockLength:
15
+ Exclude:
16
+ - "spec/**/*"
17
+ Metrics/ModuleLength:
18
+ Exclude:
19
+ - "spec/**/*"
20
+ Naming/FileName:
21
+ Exclude:
22
+ - "lib/hanami-reloader.rb"
23
+ Style/AndOr:
24
+ Enabled: false
25
+ Style/EmptyMethod:
26
+ Enabled: false
27
+ Style/FrozenStringLiteralComment:
28
+ Enabled: true
29
+ Metrics/LineLength:
30
+ Enabled: false
31
+ Style/RaiseArgs:
32
+ Enabled: false
33
+ Style/RegexpLiteral:
34
+ Enabled: false
35
+ Style/StringLiterals:
36
+ Enabled: true
37
+ EnforcedStyle: double_quotes
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+ gemspec
5
+
6
+ gem "hanami", git: "https://github.com/hanami/hanami.git", branch: "develop"
7
+ gem "byebug"
8
+ gem "rubocop"
data/LICENSE.md ADDED
@@ -0,0 +1,22 @@
1
+ Copyright © 2017 Luca Guidi
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,51 @@
1
+ # Hanami::Reloader
2
+
3
+ **Experimental** code reloading for Hanami.
4
+
5
+ ## Usage
6
+
7
+ :warning: **These instructions are complicated because `hanami-1.1.0` isn't out yet.** :warning:
8
+
9
+ ### 1. Setup Hanami project
10
+
11
+ ```shell
12
+ gem install hanami --pre
13
+ hanami version # this should be 1.1.0.beta3
14
+ hanami new bookshelf && cd bookshelf
15
+ ```
16
+
17
+ ### 2. Prepare Gemfile
18
+
19
+ Edit `Gemfile`
20
+
21
+ 1. Remove `shotgun`
22
+ 2. Add the following lines
23
+
24
+ ```ruby
25
+ group :plugins do
26
+ gem "hanami-reloader", "0.1.0.beta1"
27
+ end
28
+ ```
29
+
30
+ ### 3. Setup hanami-reloader
31
+
32
+ ```shell
33
+ bundle
34
+ bundle exec hanami generate reloader
35
+ ```
36
+
37
+ Now you can start the server via `bundle exec hanami server`.
38
+
39
+ ## Development
40
+
41
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
42
+
43
+ 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).
44
+
45
+ ## Contributing
46
+
47
+ Bug reports and pull requests are welcome on GitHub at https://github.com/jodosha/hanami-reloader.
48
+
49
+ ## Copyright
50
+
51
+ Copyright © 2017 Luca Guidi – Released under MIT License
data/Rakefile ADDED
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rake"
4
+ require "rake/testtask"
5
+ require "bundler/gem_tasks"
6
+ require "rspec/core/rake_task"
7
+
8
+ namespace :spec do
9
+ RSpec::Core::RakeTask.new(:unit) do |task|
10
+ file_list = FileList["spec/**/*_spec.rb"]
11
+
12
+ task.pattern = file_list
13
+ end
14
+
15
+ task :coverage do
16
+ ENV["COVERAGE"] = "true"
17
+ Rake::Task["spec:unit"].invoke
18
+ end
19
+ end
20
+
21
+ task default: "spec:unit"
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "hanami/reloader"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ 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
@@ -0,0 +1,37 @@
1
+
2
+ # frozen_string_literal: true
3
+
4
+ lib = File.expand_path("../lib", __FILE__)
5
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
+ require "hanami/reloader/version"
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = "hanami-reloader"
10
+ spec.version = Hanami::Reloader::VERSION
11
+ spec.authors = ["Luca Guidi"]
12
+ spec.email = ["me@lucaguidi.com"]
13
+
14
+ spec.summary = "Hanami reloader"
15
+ spec.description = "Code reloading for Hanami"
16
+ spec.homepage = "http://hanamirb.org"
17
+ spec.license = "MIT"
18
+
19
+ spec.required_ruby_version = ">= 2.3.0"
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
22
+ f.match(%r{^(test|spec|features)/})
23
+ end
24
+
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
30
+
31
+ spec.add_dependency "hanami", "1.1.0.beta3"
32
+ spec.add_dependency "guard-rack", "~> 2.2"
33
+
34
+ spec.add_development_dependency "bundler", "~> 1.15"
35
+ spec.add_development_dependency "rake", "~> 12.0"
36
+ spec.add_development_dependency "rspec", "~> 3.6"
37
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "hanami/reloader"
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "hanami/cli/commands"
4
+ require "hanami/utils"
5
+
6
+ module Hanami
7
+ module Utils # rubocop:disable Style/Documentation
8
+ # Monkey-patch `Hanami::Utils.reload!` to disable Ruby based code-reloading
9
+ def self.reload!(directory)
10
+ require!(directory)
11
+ warn "Requiring #{directory}"
12
+ end
13
+ end
14
+
15
+ # Hanami::Reloader
16
+ module Reloader
17
+ require "hanami/reloader/version"
18
+ require "hanami/reloader/cli"
19
+ end
20
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hanami
4
+ module Reloader
5
+ module CLI
6
+ # Generate hanami-reloader configuration
7
+ class Generate < Hanami::CLI::Commands::Command
8
+ requires "environment"
9
+
10
+ desc "Generate configuration for code reloading"
11
+
12
+ def call(*)
13
+ path = Hanami.root.join("Guardfile")
14
+
15
+ files.touch(path)
16
+ files.append path, <<~CODE
17
+ guard "rack", port: ENV["HANAMI_PORT"] || 2300 do
18
+ watch(%r{config/*})
19
+ watch(%r{lib/*})
20
+ watch(%r{apps/*})
21
+ end
22
+ CODE
23
+ end
24
+ end
25
+
26
+ # Override `hanami server` command
27
+ class Server < Hanami::CLI::Commands::Command
28
+ desc "Starts the server with code reloading (only development) reloader"
29
+
30
+ def call(*)
31
+ exec "bundle exec guard -i"
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ Hanami::CLI.register "generate reloader", Hanami::Reloader::CLI::Generate
39
+ Hanami::CLI.register "server", Hanami::Reloader::CLI::Server
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hanami
4
+ module Reloader
5
+ VERSION = "0.1.0.beta1"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hanami-reloader
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0.beta1
5
+ platform: ruby
6
+ authors:
7
+ - Luca Guidi
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-10-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: hanami
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.1.0.beta3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.1.0.beta3
27
+ - !ruby/object:Gem::Dependency
28
+ name: guard-rack
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.2'
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.15'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.15'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '12.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '12.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: '3.6'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.6'
83
+ description: Code reloading for Hanami
84
+ email:
85
+ - me@lucaguidi.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - ".rubocop.yml"
93
+ - Gemfile
94
+ - LICENSE.md
95
+ - README.md
96
+ - Rakefile
97
+ - bin/console
98
+ - bin/setup
99
+ - hanami-reloader.gemspec
100
+ - lib/hanami-reloader.rb
101
+ - lib/hanami/reloader.rb
102
+ - lib/hanami/reloader/cli.rb
103
+ - lib/hanami/reloader/version.rb
104
+ homepage: http://hanamirb.org
105
+ licenses:
106
+ - MIT
107
+ metadata:
108
+ allowed_push_host: https://rubygems.org
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: 2.3.0
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">"
121
+ - !ruby/object:Gem::Version
122
+ version: 1.3.1
123
+ requirements: []
124
+ rubyforge_project:
125
+ rubygems_version: 2.6.13
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: Hanami reloader
129
+ test_files: []