zealg 0.1.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: 4a552cd14bfc776698269c5b1257805b6276c409
4
+ data.tar.gz: 3a3d8e24f29eda19fe8eb34a5b89d19627b5b5c0
5
+ SHA512:
6
+ metadata.gz: c121ffa60b0e95f0e2ac49715ccde8ca9b88f783d22298365847d6b77a3a184b51dfdb2b4dcc89d42320acf64233d76de7abf3ec790c666c5360dc257d1009ec
7
+ data.tar.gz: 37aa4ebb9088e406a93f140f72eb861b0efc6ae7f3af21767aea9a620700077c19acedc7e03f259546feb563abe8c6a53af92e214d9751852e0f286586a9c3ec
@@ -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/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in zealg.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 TODO: Write your name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,48 @@
1
+ # Zealg
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/zealg`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ $ gem install zealg
10
+
11
+ ## Usage
12
+
13
+ In a fresh rails project run:
14
+
15
+ $ zealg boilerplate
16
+
17
+ This will do the following:
18
+ - Clone the [zeal react-boilerplate](https://www.github.com/CodingZeal/react-boilerplate) into the `./tmp/` directory
19
+ - Copy any files and folders from the boilerplate into the rails root directory
20
+ - Add some methods to your `app/assets/application_helper.rb` file for asset linking
21
+ - Add a layout template `app/views/layouts/client.rb`
22
+
23
+ That's it!!!
24
+
25
+ ## Development
26
+
27
+ 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.
28
+
29
+ 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).
30
+
31
+ ## Credits
32
+
33
+ Authored by Julian Rogmans (@julianrogmans) of Coding ZEAL (http://codingzeal.com)
34
+
35
+ ![Coding ZEAL](https://googledrive.com/host/0B3TWa6M1MsWeWmxRZWhscllwTzA/ZEAL-logo-final-150.png)
36
+
37
+ ## Contributing
38
+
39
+ 1. Fork it ( https://github.com/[my-github-username]/zealg/fork )
40
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
41
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
42
+ 4. Push to the branch (`git push origin my-new-feature`)
43
+ 5. Create a new Pull Request
44
+
45
+
46
+ ## License
47
+
48
+ Copyright (c) 2016 Zeal, LLC. Licensed under the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "zealg"
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
@@ -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,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/zealg'
4
+
5
+ Zealg::Base.start
@@ -0,0 +1,13 @@
1
+ require 'thor'
2
+ require 'git'
3
+ require_relative "zealg/version"
4
+ require_relative 'zealg/boilerplate'
5
+
6
+ module Zealg
7
+ class Base < Thor
8
+ desc "boilerplate", "install base react boilerplate into rails project"
9
+ def boilerplate
10
+ Zealg::Boilerplate.new.install
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,109 @@
1
+ module Zealg
2
+ class Boilerplate
3
+ APPLICATION_HELPER_METHODS = <<-EOF
4
+ def client_stylesheet_tag
5
+ [
6
+ "\#{stylesheet_link_tag('/client.css') unless using_node_server?}",
7
+ "\#{stylesheet_link_tag('/vendor.css')}"
8
+ ].join("\\n").html_safe
9
+ end
10
+
11
+ def client_javascript_tag
12
+ javascript_include_tag(env_specific_url('client.js'))
13
+ end
14
+
15
+ def env_specific_url(resource)
16
+ using_node_server? ? "http://localhost:8080/\#{resource}" : "/\#{resource}"
17
+ end
18
+
19
+ def using_node_server?
20
+ %w(test development).include? Rails.env
21
+ end
22
+ EOF
23
+ CLIENT_LAYOUT = <<-EOF
24
+ <!DOCTYPE html>
25
+ <html>
26
+ <head>
27
+ <meta charset="utf-8">
28
+ <title>Zeal Skill Tree</title>
29
+ <%= client_stylesheet_tag %>
30
+ <%= client_javascript_tag %>
31
+ <%= javascript_include_tag :client %>
32
+ <%= csrf_meta_tags %>
33
+ <meta name="viewport" content="width=device-width, initial-scale=1">
34
+ </head>
35
+ <body>
36
+ <div id="root">
37
+ </div>
38
+ </body>
39
+ </html>
40
+ EOF
41
+
42
+ def install
43
+ puts "Cloning boilerplate"
44
+ ::Git.clone('https://github.com/CodingZeal/react-boilerplate.git', 'boilerplate', path: "#{Dir.pwd}/tmp")
45
+ move_boilerplate
46
+ add_asset_helpers
47
+ add_client_layout
48
+ puts "Installing node_modules..."
49
+ %x(npm install)
50
+ cleanup_tmp
51
+ end
52
+
53
+ private
54
+
55
+ def write_to(file_name, after:, text:)
56
+ open(file_name, 'r+') do |file|
57
+ file.each_line do |line|
58
+ if line.strip == after
59
+ current_position = file.pos
60
+ rest_of_file = file.read
61
+ file.seek current_position
62
+ file.write text
63
+ file.write rest_of_file
64
+ end
65
+ end
66
+ end
67
+ end
68
+
69
+ def cleanup_tmp
70
+ puts "Cleaning up after myself"
71
+ FileUtils.rm_r("#{Dir.pwd}/tmp/boilerplate")
72
+ end
73
+
74
+ def add_asset_helpers
75
+ write_to(
76
+ dest("app/helpers/application_helper.rb"),
77
+ after: "module ApplicationHelper",
78
+ text: APPLICATION_HELPER_METHODS
79
+ )
80
+ end
81
+
82
+ def add_client_layout
83
+ open(dest('app/views/layouts/client.html.erb'), 'w') do |f|
84
+ f.write(CLIENT_LAYOUT)
85
+ end
86
+ end
87
+
88
+ def move_boilerplate
89
+ puts "Moving boilerplate files to rails root"
90
+ Dir[src("*")].each do |file|
91
+ unless File.exist?("#{Dir.pwd}/#{File.basename(file)}")
92
+ if File.directory?(file)
93
+ FileUtils.cp_r(file, Dir.pwd)
94
+ else
95
+ FileUtils.cp(file, Dir.pwd)
96
+ end
97
+ end
98
+ end
99
+ end
100
+
101
+ def dest(name)
102
+ "#{Dir.pwd}/#{name}"
103
+ end
104
+
105
+ def src(name)
106
+ "#{Dir.pwd}/tmp/boilerplate/#{name}"
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,3 @@
1
+ module Zealg
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'zealg/version'
5
+ require "zealg/boilerplate"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "zealg"
9
+ spec.version = Zealg::VERSION
10
+ spec.authors = ["Julian Rogmans"]
11
+ spec.email = ["julian.rogmans@codingzeal.com"]
12
+
13
+ spec.summary = %q{Generate and/or install zeal tools and projects into a rails app}
14
+ spec.description = spec.summary
15
+ spec.homepage = "https://www.github.com/CodingZeal/zealg"
16
+ spec.license = "MIT"
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.bindir = "bin"
20
+ spec.executables = %w[zealg]
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_runtime_dependency 'thor', '0.19.1'
24
+ spec.add_runtime_dependency 'git', '1.3.0'
25
+ spec.add_development_dependency "bundler", "~> 1.12"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zealg
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Julian Rogmans
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-06-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.19.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.19.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: git
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.3.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.3.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.12'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.12'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ description: Generate and/or install zeal tools and projects into a rails app
70
+ email:
71
+ - julian.rogmans@codingzeal.com
72
+ executables:
73
+ - zealg
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - bin/console
83
+ - bin/setup
84
+ - bin/zealg
85
+ - lib/zealg.rb
86
+ - lib/zealg/boilerplate.rb
87
+ - lib/zealg/version.rb
88
+ - zealg.gemspec
89
+ homepage: https://www.github.com/CodingZeal/zealg
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.5.1
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: Generate and/or install zeal tools and projects into a rails app
113
+ test_files: []