likelion 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 33ab1cd13a2c38f8f55b28cb2b6f524b4ea9c324
4
+ data.tar.gz: d25c703eec6d504dc7535bb7bf57820878fe5162
5
+ SHA512:
6
+ metadata.gz: 6a1033bab43328a380bc92267b380d896b2431e16c98101901185ca019e4431f5da8065f867e5728755a0818e9d17a275998d31fe03cd6aa436a721662a4afcf
7
+ data.tar.gz: 772418f9bf5ca6cf772d704a05b54197b4f13188bf3ea97f22fee3db020146d2094682eb01b59e6d76d5ef4b2359f425a222295996c830f2aa5f97cf6011ee14
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.2.2
5
+ before_install: gem install bundler -v 1.12.4
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at leechhe90@gmail.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in likelion.gemspec
4
+ gemspec
@@ -0,0 +1,34 @@
1
+ # Likelion
2
+
3
+
4
+ ## Installation
5
+
6
+ Add this line to your application's Gemfile:
7
+
8
+ ```ruby
9
+ gem 'likelion', git: 'https://github.com/LEECHHE/likelion'
10
+ ```
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install likelion
19
+
20
+ ## Usage
21
+
22
+ Gem을 설치한 후 아래와 같이 사용합니다.
23
+
24
+ $ rails generate likelion:install [날짜]
25
+
26
+ 날짜는 'YYMMDD' 형식으로 입력됩니다. 예를 들어 16년 4월 8일에 진행된 수업의 코드는
27
+ $ rails generate likelion:install 160408
28
+
29
+ 와 같이 불러올 수 있습니다.
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/LEECHHE/likelion. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
34
+
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "likelion"
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,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails generate likelion Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -0,0 +1,95 @@
1
+ require 'Thor'
2
+ class CreateTemplates < Thor::Group
3
+ include Thor::Actions
4
+
5
+ raise ArgumentError, "The date should be input." if ARGV[0] == nil
6
+ @@path = "#{File.dirname(__FILE__)}/templates/#{ARGV[0]}"
7
+ def self.source_root
8
+ File.dirname(__FILE__)
9
+ end
10
+
11
+ def process
12
+ source_paths << @@path
13
+ #모델, 컨트롤러 등 생성
14
+ run_commands
15
+ #application_controller.rb 주석 처리
16
+ comment_application_controller
17
+ #bootstrap 추가
18
+ add_bootstraps
19
+ #routes.rb 설정
20
+ set_routes
21
+
22
+ end
23
+
24
+ def run_commands
25
+ # IO.readlines("#{path}/command.txt").each do |infile|
26
+ #view 생성
27
+ copy_files
28
+ File.open([@@path,'command.txt'].join('/'),"r") do |infile|
29
+ #command.txt 내에 있는 커맨드 읽기
30
+ while( line = infile.gets )
31
+ #주석은 통과
32
+ if line[0] == '#'
33
+ next
34
+ end
35
+ #Command 실행
36
+ run (line)
37
+ #Model과 Controller인 경우 내용(method, attributes 등) 추가
38
+ add_attributes(line)
39
+ end
40
+ end
41
+ end
42
+
43
+ def add_attributes(line)
44
+ #TODO : Devise는...?
45
+ line = line.split
46
+ if line[2].eql?"controller"
47
+ inject_into_class "app/controllers/#{line[3]}_controller.rb", \
48
+ "#{line[3].capitalize}Controller", \
49
+ File.read("#{@@path}/#{line[3]}_controller.rb")
50
+ elsif line[2].eql?"model"
51
+ inject_into_class "app/models/#{line[3]}.rb", \
52
+ "#{line[3].capitalize}", \
53
+ File.read("#{@@path}/#{line[3].capitalize}.rb")
54
+ end
55
+ end
56
+
57
+ def comment_application_controller
58
+ # appication_controller.rb에 protect_from_forgery 주석 처리
59
+ comment_lines 'app/controllers/application_controller.rb', /protect_from_forgery with: :exception/
60
+ end
61
+
62
+ def add_bootstraps
63
+ #Bootstrap CDN 추가
64
+ insert_into_file "app/views/layouts/application.html.erb", bootstrap_cdn, :before => "</head>\n"
65
+ end
66
+
67
+ def bootstrap_cdn
68
+ '<!-- Latest compiled and minified CSS -->
69
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
70
+
71
+ <!-- Optional theme -->
72
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
73
+
74
+ <!-- Latest compiled and minified JavaScript -->
75
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>\n'
76
+ end
77
+
78
+ def set_routes
79
+ #routes.rb 내용을 복사
80
+ insert_into_file "config/routes.rb", \
81
+ File.read("#{@@path}/routes.rb"), \
82
+ :after => "Rails.application.routes.draw do\n"
83
+ end
84
+ def copy_files
85
+ File.open("#{@@path}/views.txt","r") do |infile|
86
+ while(filename = infile.gets)
87
+ filename.rstrip!
88
+ controller, view = filename.split('.',2)
89
+ template filename, "app/views/#{controller}/#{view}"
90
+ end
91
+ end
92
+ end
93
+ end
94
+
95
+ CreateTemplates.new.process
@@ -0,0 +1,10 @@
1
+ module Likelion
2
+ class InstallGenerator < Rails::Generators::NamedBase
3
+ desc "This generator creates an initializer file at config/initializers"
4
+
5
+ def copy_snippet
6
+ path = File.dirname(__FILE__)
7
+ run("ruby #{path}/create_templates.rb #{file_name}")
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,2 @@
1
+ ## 컨트롤러 생성
2
+ rails g controller home
@@ -0,0 +1,14 @@
1
+ <div class="container">
2
+ <h1>게시판입니다.</h1>
3
+ <form action="/write" method="POST">
4
+ <div class="form-group">
5
+ <label for="exampleInputEmail1">글 제목</label>
6
+ <input type="text" class="form-control" id="exampleInputEmail1" name="title">
7
+ </div>
8
+ <div class="form-group">
9
+ <label for="exampleInputPassword1">글 내용</label>
10
+ <textarea name="content" class="form-control" id="exampleInputPassword1">
11
+ </div>
12
+ <button type="submit" class="btn btn-default">전송완료</button>
13
+ </form>
14
+ </div>
@@ -0,0 +1,6 @@
1
+ <h1>글이 써졌습니다.</h1>
2
+ <h2>여러분이 쓴 글의 제목은</h2>
3
+ <%= @almond %>
4
+ <h2>여러분이 쓴 글의 내용은</h2>
5
+ <%= @anchovy %>
6
+ <a href = '/'>메인으로 가기</a>
@@ -0,0 +1,7 @@
1
+ def index
2
+ end
3
+ def write
4
+ @almond = params[:title]
5
+ @anchovy = params[:content]
6
+ end
7
+
@@ -0,0 +1,4 @@
1
+ root 'home#index'
2
+
3
+ get '/' => 'home#index'
4
+ post '/write' => 'home#write'
@@ -0,0 +1,2 @@
1
+ home.index.html.erb
2
+ home.write.html.erb
@@ -0,0 +1,5 @@
1
+ require "likelion/version"
2
+
3
+ module Likelion
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,3 @@
1
+ module Likelion
2
+ VERSION = "0.1.1"
3
+ end
@@ -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 'likelion/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "likelion"
8
+ spec.version = Likelion::VERSION
9
+ spec.authors = ["ChangHee Lee"]
10
+ spec.email = ["leechhe90@gmail.com"]
11
+
12
+ spec.summary = %q{멋쟁이 사자처럼 수업 때 사용된 코드들을 쉽게 생성해줍니다.}
13
+ spec.homepage = "https://github.com/LEECHHE/likelion"
14
+ spec.license = "MIT"
15
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
16
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
17
+ if spec.respond_to?(:metadata)
18
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
19
+ else
20
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
21
+ end
22
+
23
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ spec.bindir = "exe"
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ["lib"]
27
+ spec.add_dependency "devise"
28
+ spec.add_dependency "fog-aws"
29
+ spec.add_dependency "carrierwave"
30
+
31
+ spec.add_development_dependency "bundler", "~> 1.12"
32
+ spec.add_development_dependency "rake", "~> 10.0"
33
+ spec.add_development_dependency "rspec", "~> 3.0"
34
+ end
metadata ADDED
@@ -0,0 +1,150 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: likelion
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - ChangHee Lee
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-05-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: devise
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: fog-aws
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: carrierwave
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.12'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.12'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ description:
98
+ email:
99
+ - leechhe90@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".travis.yml"
107
+ - CODE_OF_CONDUCT.md
108
+ - Gemfile
109
+ - README.md
110
+ - Rakefile
111
+ - bin/console
112
+ - bin/setup
113
+ - lib/generators/likelion/USAGE
114
+ - lib/generators/likelion/create_templates.rb
115
+ - lib/generators/likelion/install_generator.rb
116
+ - lib/generators/likelion/templates/160408/command.txt
117
+ - lib/generators/likelion/templates/160408/home.index.html.erb
118
+ - lib/generators/likelion/templates/160408/home.write.html.erb
119
+ - lib/generators/likelion/templates/160408/home_controller.rb
120
+ - lib/generators/likelion/templates/160408/routes.rb
121
+ - lib/generators/likelion/templates/160408/views.txt
122
+ - lib/likelion.rb
123
+ - lib/likelion/version.rb
124
+ - likelion.gemspec
125
+ homepage: https://github.com/LEECHHE/likelion
126
+ licenses:
127
+ - MIT
128
+ metadata:
129
+ allowed_push_host: https://rubygems.org
130
+ post_install_message:
131
+ rdoc_options: []
132
+ require_paths:
133
+ - lib
134
+ required_ruby_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ required_rubygems_version: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ requirements: []
145
+ rubyforge_project:
146
+ rubygems_version: 2.2.2
147
+ signing_key:
148
+ specification_version: 4
149
+ summary: "멋쟁이 사자처럼 수업 때 사용된 코드들을 쉽게 생성해줍니다."
150
+ test_files: []