ticket_punch 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,6 @@
1
- Copyright 2013 YOURNAME
1
+ Copyright (c) 2013 Tatsuya Sato
2
+
3
+ MIT License
2
4
 
3
5
  Permission is hereby granted, free of charge, to any person obtaining
4
6
  a copy of this software and associated documentation files (the
@@ -1,3 +1,48 @@
1
1
  = TicketPunch
2
2
 
3
- This project rocks and uses MIT-LICENSE.
3
+ == Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ gem 'ticket_punch'
8
+
9
+ And then execute:
10
+
11
+ $ bundle
12
+
13
+ Or install it yourself as:
14
+
15
+ $ gem install ticket_punch
16
+
17
+ == Usage
18
+
19
+ === Install version file with the generator
20
+
21
+ $ bundle exec rails generate ticket_punch:install
22
+
23
+ This generator creates +version.yml+ under +RAILS\_ROOT/config+ directory.
24
+ This YAML file represents the version of your Rails application as follows:
25
+
26
+ version:
27
+ major: 0
28
+ minor: 0
29
+ patch: 1
30
+
31
+ In default, the version is '0.0.1' but you can specify the initial version by giving +--version+ option.
32
+
33
+ $ bundle exec rails generate ticket_punch:install --version '1.2.3'
34
+
35
+
36
+ == Contributing
37
+
38
+ 1. Fork it
39
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
40
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
41
+ 4. Push to the branch (`git push origin my-new-feature`)
42
+ 5. Create new Pull Request
43
+
44
+ == License
45
+
46
+ This project rocks and uses MIT-LICENSE.
47
+
48
+ :include: LICENSE.txt
@@ -0,0 +1,34 @@
1
+ # encoding: utf-8
2
+
3
+ require 'yaml'
4
+
5
+ module Rails
6
+ class Application < Rails::Engine
7
+ def version
8
+ [major_version,
9
+ minor_version,
10
+ patch_version].join('.')
11
+ end
12
+
13
+ def major_version
14
+ version_info['version']['major']
15
+ end
16
+
17
+ def minor_version
18
+ version_info['version']['minor']
19
+ end
20
+
21
+ def patch_version
22
+ version_info['version']['patch']
23
+ end
24
+
25
+ private
26
+ def version_info
27
+ @version_info ||= YAML.load_file(version_file_path)
28
+ end
29
+
30
+ def version_file_path
31
+ File.expand_path(File.join(Rails.root, 'config', 'version.yml'))
32
+ end
33
+ end
34
+ end
@@ -1,4 +1,3 @@
1
- --
2
1
  version:
3
2
  major: <%= @major %>
4
3
  minor: <%= @minor %>
@@ -1,5 +1,2 @@
1
1
  require "ticket_punch/version"
2
-
3
- module TicketPunch
4
- # Your code goes here...
5
- end
2
+ require "ext/rails/application"
@@ -1,3 +1,3 @@
1
1
  module TicketPunch
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
File without changes
@@ -0,0 +1,31 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+ require 'yaml'
5
+ require 'fakefs/spec_helpers'
6
+
7
+ describe Rails::Application do
8
+ include FakeFS::SpecHelpers
9
+
10
+ let(:version_info) do
11
+ { 'version' => {
12
+ 'major' => 1,
13
+ 'minor' => 2,
14
+ 'patch' => 3 }
15
+ }
16
+ end
17
+ let(:version) do
18
+ version_info['version'].map { |k, v| v.to_s }.join('.')
19
+ end
20
+ before do
21
+ config_path = File.expand_path(File.join(Rails.root, 'config'))
22
+ version_file = File.join(config_path, 'version.yml')
23
+ FileUtils.mkdir_p config_path
24
+ FileUtils.touch version_file
25
+ File.open(version_file, 'w') do |f|
26
+ YAML.dump(version_info, f)
27
+ end
28
+ end
29
+ subject { Rails.application }
30
+ its(:version) { should == version }
31
+ end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- require 'rails/generators/install_generator'
3
+ require 'generators/ticket_punch/install/install_generator'
4
4
 
5
5
  describe TicketPunch::Generators::InstallGenerator do
6
6
  destination File.expand_path('../../../tmp' , __FILE__)
@@ -2,7 +2,22 @@
2
2
 
3
3
  $: << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
4
4
 
5
- require 'rails/all'
5
+ ENV["RAILS_ENV"] = "test"
6
+
7
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
8
+ require "rails/test_help"
9
+ require 'fakefs/safe'
10
+
11
+ Rails.backtrace_cleaner.remove_silencers!
12
+
13
+ # Load support files
14
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
15
+
16
+ # Load fixtures from the engine
17
+ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
18
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
19
+ end
20
+
6
21
  require 'ammeter/init'
7
22
 
8
23
  Dir[File.join(File.dirname(__FILE__), 'support/*.rb')].each do |f|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ticket_punch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-10 00:00:00.000000000 Z
12
+ date: 2013-02-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -75,6 +75,22 @@ dependencies:
75
75
  - - ! '>='
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: fakefs
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
78
94
  - !ruby/object:Gem::Dependency
79
95
  name: rake
80
96
  requirement: !ruby/object:Gem::Requirement
@@ -98,11 +114,12 @@ executables: []
98
114
  extensions: []
99
115
  extra_rdoc_files: []
100
116
  files:
101
- - lib/rails/generators/install_generator.rb
102
- - lib/rails/generators/templates/version.yml
117
+ - lib/ext/rails/application.rb
118
+ - lib/generators/ticket_punch/install/install_generator.rb
119
+ - lib/generators/ticket_punch/install/templates/version.yml
103
120
  - lib/ticket_punch/version.rb
104
121
  - lib/ticket_punch.rb
105
- - MIT-LICENSE
122
+ - LICENSE.txt
106
123
  - Rakefile
107
124
  - README.rdoc
108
125
  - spec/dummy/app/assets/javascripts/application.js
@@ -127,6 +144,7 @@ files:
127
144
  - spec/dummy/config/routes.rb
128
145
  - spec/dummy/config.ru
129
146
  - spec/dummy/log/development.log
147
+ - spec/dummy/log/test.log
130
148
  - spec/dummy/public/404.html
131
149
  - spec/dummy/public/422.html
132
150
  - spec/dummy/public/500.html
@@ -134,6 +152,7 @@ files:
134
152
  - spec/dummy/Rakefile
135
153
  - spec/dummy/README.rdoc
136
154
  - spec/dummy/script/rails
155
+ - spec/ext/rails/application_spec.rb
137
156
  - spec/generators/install_generator_spec.rb
138
157
  - spec/spec_helper.rb
139
158
  homepage: http://github.com/satoryu/ticket_punch
@@ -183,6 +202,7 @@ test_files:
183
202
  - spec/dummy/config/routes.rb
184
203
  - spec/dummy/config.ru
185
204
  - spec/dummy/log/development.log
205
+ - spec/dummy/log/test.log
186
206
  - spec/dummy/public/404.html
187
207
  - spec/dummy/public/422.html
188
208
  - spec/dummy/public/500.html
@@ -190,6 +210,7 @@ test_files:
190
210
  - spec/dummy/Rakefile
191
211
  - spec/dummy/README.rdoc
192
212
  - spec/dummy/script/rails
213
+ - spec/ext/rails/application_spec.rb
193
214
  - spec/generators/install_generator_spec.rb
194
215
  - spec/spec_helper.rb
195
216
  has_rdoc: