rails_history 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/README.md +32 -4
- data/exe/rails-history +17 -3
- data/lib/rails_history/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f84148e58700766cde2017601f4242043653a17
|
4
|
+
data.tar.gz: 7af9c142c9b4ae8c24c106611c39a96f0bb5f425
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd9eb60b9d55d122745c2edc1607e38df4027206f0a133fbce4e4b6acf7a3f676c4c89e94727401fd362c61e42b6491790aac7132be14c923b5bf9799cbe1c78
|
7
|
+
data.tar.gz: 148bad10e1009f2822bff05d3be8b03d6d3bb7122bfec08aa338fc06ea90ccd297ae67c3ef2afd1939a8bd8b9ef6454a464d4e40269b3edd453da6793fca4b4e
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# RailsHistory
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
A command like history for rails.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,7 +20,33 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
### History Recording
|
24
|
+
|
25
|
+
This gem records rails generate/destroy histories on the `.rails_history` file automatically.
|
26
|
+
|
27
|
+
```
|
28
|
+
$ rails g model sample
|
29
|
+
$ cat .rails_history
|
30
|
+
rails generate model sample
|
31
|
+
```
|
32
|
+
|
33
|
+
### History Reference
|
34
|
+
|
35
|
+
The `rails-history` command show entries in the history list:
|
36
|
+
|
37
|
+
```
|
38
|
+
$ bundle exec rails-history
|
39
|
+
1 rails generate model sample
|
40
|
+
```
|
41
|
+
|
42
|
+
You can re-execute a command in the history list:
|
43
|
+
|
44
|
+
```
|
45
|
+
$ bundle exec rails-history 1
|
46
|
+
bundle exec rails generate model sample
|
47
|
+
invoke active_record
|
48
|
+
...
|
49
|
+
```
|
26
50
|
|
27
51
|
## Development
|
28
52
|
|
@@ -37,3 +61,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
37
61
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
62
|
4. Push to the branch (`git push origin my-new-feature`)
|
39
63
|
5. Create a new Pull Request
|
64
|
+
|
65
|
+
## TODO
|
66
|
+
|
67
|
+
* Options like `history` command
|
data/exe/rails-history
CHANGED
@@ -1,8 +1,22 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
require 'active_support/all'
|
2
3
|
|
4
|
+
exit(0) unless File.exist?('.rails_history')
|
5
|
+
|
6
|
+
index = ARGV.shift
|
3
7
|
lines = File.open('.rails_history').readlines
|
4
|
-
digits = lines.size.to_s.size + 2
|
5
8
|
|
6
|
-
|
7
|
-
|
9
|
+
if index.blank?
|
10
|
+
digits = lines.size.to_s.size + 2
|
11
|
+
lines.each.with_index do |line, i|
|
12
|
+
puts format("%#{digits}d %s", i + 1, line)
|
13
|
+
end
|
14
|
+
else
|
15
|
+
command = lines[index.to_i - 1]
|
16
|
+
exit(1) if command.blank?
|
17
|
+
|
18
|
+
command = ['bundle exec', command].join(' ') if ENV['BUNDLE_GEMFILE'].present?
|
19
|
+
|
20
|
+
puts command
|
21
|
+
system(command)
|
8
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_history
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toshiyuki Kawanishi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|