rur 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c17ed77b7c8b53bec66069a98c80695b30eb0eec02b18cbe071faef44ec0b577
4
- data.tar.gz: 073a1495eeef128412d4293c8b9bca527ca11703f067327fed052778a89f4712
3
+ metadata.gz: 8708a2f751cd857ad4301643144e3b4e7ac81e962f56e61ac6b9712eec225487
4
+ data.tar.gz: d947a67f1f2c52ee66b893f0148996635a08c896bbdc748f53cc48abbf6e1341
5
5
  SHA512:
6
- metadata.gz: 81944c66a687688064200e716f8e0ffd2c6192c8f44c14ac1777fe7f868b9c82b2e3cf316a5eea64f009e9f93d46bfa3334c0c5082e35ed34d0a1372d77b25b4
7
- data.tar.gz: 0c98383312942c9dc6f967ad01b9397e64080b55c509fac843dbe5fe9b32871f963cb0d4ae9f11b5dd862e4dfb570a825b88a1f4345e24ccf0da14697b4ff05a
6
+ metadata.gz: 000d6992eddcbcacb417a52e4a62593d42e715f1d82e2c11bfb3cf97617193c003146cc52594e76b1049ffe62d01c7920e9ce45c7c0362325a587346f503b570
7
+ data.tar.gz: '02579cc082aa84e430aa74d94ca5aa29d9b8e821e631c75e307ad02d1b07bd8ace78fe2186916ba31ab2054aa896ff0c4396a7d593a6a3f569903db9224aec51'
data/Gemfile CHANGED
@@ -4,7 +4,3 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in rur.gemspec
6
6
  gemspec
7
-
8
- gem 'pry', '~> 0.12.2'
9
- gem 'rubocop', '~> 0.66.0', require: false
10
- gem 'high_voltage', '~> 3.1'
@@ -0,0 +1,63 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rur (0.1.2)
5
+ high_voltage (~> 3.1)
6
+ rubocop (~> 0.66.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ast (2.4.0)
12
+ coderay (1.1.2)
13
+ diff-lcs (1.3)
14
+ high_voltage (3.1.0)
15
+ jaro_winkler (1.5.2)
16
+ method_source (0.9.2)
17
+ parallel (1.15.0)
18
+ parser (2.6.2.0)
19
+ ast (~> 2.4.0)
20
+ pry (0.12.2)
21
+ coderay (~> 1.1.0)
22
+ method_source (~> 0.9.0)
23
+ psych (3.1.0)
24
+ rainbow (3.0.0)
25
+ rake (10.5.0)
26
+ rspec (3.8.0)
27
+ rspec-core (~> 3.8.0)
28
+ rspec-expectations (~> 3.8.0)
29
+ rspec-mocks (~> 3.8.0)
30
+ rspec-core (3.8.0)
31
+ rspec-support (~> 3.8.0)
32
+ rspec-expectations (3.8.2)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.8.0)
35
+ rspec-mocks (3.8.0)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.8.0)
38
+ rspec-support (3.8.0)
39
+ rubocop (0.66.0)
40
+ jaro_winkler (~> 1.5.1)
41
+ parallel (~> 1.10)
42
+ parser (>= 2.5, != 2.5.1.1)
43
+ psych (>= 3.1.0)
44
+ rainbow (>= 2.2.2, < 4.0)
45
+ ruby-progressbar (~> 1.7)
46
+ unicode-display_width (>= 1.4.0, < 1.6)
47
+ ruby-progressbar (1.10.0)
48
+ unicode-display_width (1.5.0)
49
+
50
+ PLATFORMS
51
+ ruby
52
+
53
+ DEPENDENCIES
54
+ bundler (~> 1.16)
55
+ high_voltage (~> 3.1)
56
+ pry (~> 0.12.2)
57
+ rake (~> 10.0)
58
+ rspec (~> 3.0)
59
+ rubocop (~> 0.66.0)
60
+ rur!
61
+
62
+ BUNDLED WITH
63
+ 1.16.6
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # Rur - Rubocop reports
1
+ # Rur - Rubocop reports by HTML
2
2
 
3
- Rur gem will produce Rubocop results by `html` format.
3
+ Rur gem will produce Rubocop results by `HTML` format.
4
4
  It uses
5
- - [Rubocop gem](https://github.com/rubocop-hq/rubocop) to outputs `html` format.
6
- - [High_voltage](https://github.com/thoughtbot/high_voltage) to links `html` result in your app (`static page`)
5
+ - [Rubocop](https://github.com/rubocop-hq/rubocop) gem exports `HTML` format.
6
+ - [High_voltage](https://github.com/thoughtbot/high_voltage) gem links `HTML` results in your app (`static pages`)
7
7
 
8
8
  ## Installation
9
9
 
@@ -25,17 +25,6 @@ Or install it yourself as:
25
25
 
26
26
  $ gem install rur
27
27
 
28
- And then add `require 'rur'` into `config/application.rb`:
29
-
30
- ```ruby
31
- # config/application.rb
32
- ...
33
- require 'rails/all'
34
-
35
- require 'rur'
36
- ...
37
- ```
38
-
39
28
  ## Usage
40
29
 
41
30
  ### 1. Init `Rur`
@@ -46,13 +35,10 @@ require 'rur'
46
35
  ```bash
47
36
  $ rails g rur
48
37
 
49
- create config/initializers/high_voltage.rb
50
- create app/views/rur/home.html.erb
51
- route scope :rur do
52
- # Rur for all folders
53
- get '/' => 'high_voltage/pages#show', id: 'home'
54
- end
55
- append .gitignore
38
+ create config/initializers/high_voltage.rb
39
+ create app/views/rur/home.html.erb
40
+ insert config/routes.rb
41
+ append .gitignore
56
42
  ```
57
43
 
58
44
  ### 2. Produce views
@@ -61,16 +47,16 @@ append .gitignore
61
47
 
62
48
  $ rake rur:produce
63
49
 
64
- 2.2 For specify folder(r) you want
50
+ 2.2 For specify folder(s) you want
65
51
 
66
52
  $ rake rur:produce controllers models views lib
67
53
 
68
54
  ### 3. View results:
69
55
 
70
- Go to [http://localhost:3000/rur](http://localhost:3000/rur) to see your results.
56
+ Go to [http://localhost:3000/rur](http://localhost:3000/rur) to see results.
71
57
 
72
58
  ## Testing
73
- TODO
59
+ *TODO*
74
60
 
75
61
  ## Contributing
76
62
 
@@ -7,16 +7,13 @@ Example:
7
7
  1) This will create:
8
8
  create config/initializers/high_voltage.rb
9
9
  create app/views/rur/home.html.erb
10
- route scope :rur do
11
- # Rur for all folders
12
- get '/' => 'high_voltage/pages#show', id: 'home'
13
- end
10
+ insert config/routes.rb
14
11
  append .gitignore
15
12
 
16
13
  2) Produces Rubocop reports
17
14
  2.1 For your app
18
15
  rake rur:produce
19
16
 
20
- 2.1 For specify folder(r) you want
17
+ 2.2 For specify folder(s) you want
21
18
  rake rur:produce controllers models views lib
22
19
 
@@ -2,17 +2,19 @@ class RurGenerator < Rails::Generators::Base
2
2
  source_root File.expand_path('templates', __dir__)
3
3
 
4
4
  def copy_rur_file
5
- copy_file "high_voltage.rb", "config/initializers/high_voltage.rb"
6
- copy_file "home.html.erb", "app/views/rur/home.html.erb"
5
+ copy_file 'high_voltage.rb', 'config/initializers/high_voltage.rb'
6
+ copy_file 'home.html.erb', 'app/views/rur/home.html.erb'
7
7
  end
8
8
 
9
9
  def add_rur_routes
10
- rur_route = " scope :rur do\n"
11
- rur_route += " \# Rur for all folders\n"
12
- rur_route += " get '/' => 'high_voltage/pages#show', id: 'home'\n"
13
- rur_route += " end\n"
10
+ rur_route =
11
+ """
12
+ scope :rur do
13
+ # Rur for all folders
14
+ get '/' => 'high_voltage/pages#show', id: 'home'
15
+ end"""
14
16
 
15
- route(rur_route)
17
+ inject_into_file "config/routes.rb", rur_route, after: /Rails\.application\.routes\.draw do/
16
18
  end
17
19
 
18
20
  def append_rur_gitignore
data/lib/rur.rb CHANGED
@@ -1,9 +1,6 @@
1
- require "rur/version"
2
-
3
- require "pry"
4
- require "rubocop"
5
- require "high_voltage"
6
- require "rur/produce"
1
+ require 'rur/version'
2
+ require 'high_voltage'
3
+ require 'rur/produce'
7
4
 
8
5
  module Rur
9
6
  require 'railtie' if defined?(Rails)
@@ -1,18 +1,8 @@
1
- # include Rails::Generators
1
+ require 'rur/thor_ultils'
2
2
 
3
3
  module Rur
4
4
  module Produce
5
- def parse_routes(targets)
6
- return [] if targets.blank?
7
-
8
- if targets.include?(',')
9
- targets.gsub(/[[:space:]]/, '').split(',')
10
- else
11
- targets.split(' ')&.compact
12
- end
13
- end
14
-
15
- def r_produce(target)
5
+ def r_produce(target = '.')
16
6
  dir =
17
7
  case target
18
8
  when 'app'
@@ -20,7 +10,7 @@ module Rur
20
10
  when 'models', 'model'
21
11
  'app/models'
22
12
  when 'controllers', 'controller'
23
- 'app/contollers'
13
+ 'app/controllers'
24
14
  when 'views', 'view'
25
15
  'app/views'
26
16
  when 'config'
@@ -30,15 +20,23 @@ module Rur
30
20
  when 'db'
31
21
  'db'
32
22
  when '.'
23
+ target = 'home'
33
24
  ''
34
25
  else
35
- false
26
+ target
36
27
  end
37
28
 
38
- # TODO: catch error here!
39
- return unless dir
29
+ return "File/Folder [#{dir}] is not found!" unless File.exist?("#{Rails.root}/#{dir}")
40
30
 
31
+ # Process
41
32
  `rubocop #{Rails.root}/#{dir}/ --format html -o app/views/rur/#{target}.html.erb`
33
+ Rur::ThorUltils.new.prepend_rur_route(target)
34
+
35
+ if target != 'home'
36
+ puts "Rur produced [#{target}] !\n"
37
+ else
38
+ puts "Rur produced your app: [#{Rails.root}/] !\n"
39
+ end
42
40
  end
43
41
  end
44
42
  end
@@ -4,10 +4,14 @@ class Rur::ThorUltils < Thor
4
4
  # Prepend route into config/routes.rb
5
5
  no_commands do
6
6
  def prepend_rur_route(route)
7
- route_path = " \# Rur for #{route}\n"
8
- route_path += " get '#{route}' => 'high_voltage/pages#show', id: '#{route}'\n"
7
+ route_path = %Q(\n # Rur for #{route}\n get '#{route}' => 'high_voltage/pages#show', id: '#{route}')
9
8
 
10
- insert_into_file("#{Rails.root}/config/routes.rb", route_path, after: "scope :rur do\n")
9
+ insert_into_file(
10
+ "#{Rails.root}/config/routes.rb",
11
+ route_path,
12
+ verbose: false,
13
+ after: /scope \:rur do/
14
+ )
11
15
  end
12
16
  end
13
17
  end
@@ -1,3 +1,3 @@
1
1
  module Rur
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -1,27 +1,15 @@
1
1
  include Rur::Produce
2
- require "rur/thor_ultils"
3
2
 
4
3
  namespace :rur do
5
4
  desc "Rur produces app"
6
- task :produce, [:route] => :environment do |t, args|
7
- # routes = Rur::Produce.parse_routes(ARGV.drop(1))
5
+ task produce: :environment do
6
+ targets = ARGV.drop(1)
8
7
 
9
- routes = ARGV.drop(1)
8
+ Rur::Produce.r_produce() and return if targets.blank?
10
9
 
11
- if routes.blank?
12
- p "Rur is producing your app:[#{Rails.root}/]"
13
- Rur::Produce.r_produce('.')
14
- p "Rur produced your app:\[#{Rails.root}\/\]\n"
15
- else
16
- # dynamically writing tasks on the fly
17
- routes.each { |a| task a.to_sym do ; end }
10
+ # dynamically writing tasks on the fly
11
+ targets.each { |target| task target.to_sym do ; end }
18
12
 
19
- routes.each do |route|
20
- p "Rur is producing #{route}..."
21
- Rur::Produce.r_produce(route)
22
- Rur::ThorUltils.new.prepend_rur_route(route)
23
- p "Rur produced #{route}!\n"
24
- end
25
- end
13
+ targets.each { |target| puts Rur::Produce.r_produce(target) }
26
14
  end
27
15
  end
@@ -1,41 +1,41 @@
1
1
 
2
- lib = File.expand_path("../lib", __FILE__)
2
+ lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "rur/version"
4
+ require 'rur/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "rur"
7
+ spec.name = 'rur'
8
8
  spec.version = Rur::VERSION
9
- spec.authors = ["phunt"]
10
- spec.email = ["phunt@runsystem.net"]
9
+ spec.authors = ['phunt']
10
+ spec.email = ['phunt@runsystem.net']
11
11
 
12
12
  spec.summary = %q{Rur - Rubocop reports.}
13
13
  spec.description = %q{Rubocop reports by HTML.}
14
- spec.homepage = "http://phunt.site"
15
- spec.license = "MIT"
14
+ spec.homepage = 'http://phunt.site'
15
+ spec.license = 'MIT'
16
16
 
17
17
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
18
  # to allow pushing to a single host or delete this section to allow pushing to any host.
19
19
  if spec.respond_to?(:metadata)
20
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
20
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
21
21
  else
22
- raise "RubyGems 2.0 or newer is required to protect against " \
23
- "public gem pushes."
22
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
23
+ 'public gem pushes.'
24
24
  end
25
25
 
26
26
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
27
  f.match(%r{^(test|spec|features)/})
28
28
  end
29
- spec.bindir = "exe"
29
+ spec.bindir = 'exe'
30
30
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
- spec.require_paths = ["lib"]
31
+ spec.require_paths = ['lib']
32
+ spec.required_ruby_version = '>= 2.3.0'
32
33
 
33
- spec.post_install_message = "Thanks for installing Rur gem!"
34
+ spec.post_install_message = 'Thanks for installing!'
34
35
 
35
- spec.add_development_dependency "bundler", "~> 1.16"
36
- spec.add_development_dependency "rake", "~> 10.0"
37
- spec.add_development_dependency "rspec", "~> 3.0"
38
- spec.add_runtime_dependency 'pry', '~> 0.12.2'
36
+ spec.add_development_dependency 'bundler', '~> 1.16'
37
+ spec.add_development_dependency 'rake', '~> 10.0'
38
+ spec.add_development_dependency 'rspec', '~> 3.0'
39
39
  spec.add_runtime_dependency 'rubocop', '~> 0.66.0'
40
40
  spec.add_runtime_dependency 'high_voltage', '~> 3.1'
41
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rur
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - phunt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-25 00:00:00.000000000 Z
11
+ date: 2019-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
- - !ruby/object:Gem::Dependency
56
- name: pry
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 0.12.2
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 0.12.2
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rubocop
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -106,6 +92,7 @@ files:
106
92
  - ".travis.yml"
107
93
  - CODE_OF_CONDUCT.md
108
94
  - Gemfile
95
+ - Gemfile.lock
109
96
  - LICENSE.txt
110
97
  - README.md
111
98
  - Rakefile
@@ -129,7 +116,7 @@ licenses:
129
116
  - MIT
130
117
  metadata:
131
118
  allowed_push_host: https://rubygems.org
132
- post_install_message: Thanks for installing Rur gem!
119
+ post_install_message: Thanks for installing!
133
120
  rdoc_options: []
134
121
  require_paths:
135
122
  - lib
@@ -137,7 +124,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
137
124
  requirements:
138
125
  - - ">="
139
126
  - !ruby/object:Gem::Version
140
- version: '0'
127
+ version: 2.3.0
141
128
  required_rubygems_version: !ruby/object:Gem::Requirement
142
129
  requirements:
143
130
  - - ">="